Quantcast

WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

classic Classic list List threaded Threaded
30 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

shahbour
Hello

I got an WCF service that is running except at some time if the client send a request then close his program directly , ending the session the WCF console application crashes with below error


[0x7f0b42f55700:] EXCEPTION handling: System.Net.Sockets.SocketException: Connection reset by peer
[0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure
[0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure

Unhandled Exception: System.IO.IOException: Read failure ---> System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags) [0x000ad] in /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/Socket.cs:1606
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00067] in /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:399
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00078] in /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:401
  at System.Net.RequestStream.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x0003c] in /usr/local/src/mono-2.11.1/mcs/class/System/System.Net/RequestStream.cs:142
  at System.IO.StreamReader.ReadBuffer () [0x00012] in /usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:394
  at System.IO.StreamReader.Read (System.Char[] buffer, Int32 index, Int32 count) [0x00062] in /usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:471
  at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x0004f] in /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1256
  at Mono.Xml2.XmlTextReader.PeekChar () [0x00047] in /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1210
  at Mono.Xml2.XmlTextReader.ReadContent () [0x0003f] in /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1310
  at Mono.Xml2.XmlTextReader.Read () [0x00141] in /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:626
  at System.Xml.XmlTextReader.Read () [0x0006b] in /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:564
  at System.Xml.XmlSimpleDictionaryReader.Read () [0x00000] in /usr/local/src/mono-2.11.1/mcs/class/System.Runtime.Serialization/System.Xml/XmlSimpleDictionaryReader.cs:253
  at System.Xml.XmlReader.MoveToContent () [0x00050] in /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlReader.cs:574
  at System.ServiceModel.Channels.XmlReaderMessage.ReadEnvelopeStart () [0x00000] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:146
  at System.ServiceModel.Channels.XmlReaderMessage..ctor (System.ServiceModel.Channels.MessageVersion version, System.Xml.XmlDictionaryReader reader, Int32 maxSizeOfHeaders) [0x00026] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:70
  at System.ServiceModel.Channels.Message.CreateMessage (System.Xml.XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders, System.ServiceModel.Channels.MessageVersion version) [0x00022] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:427
  at System.ServiceModel.Channels.TextMessageEncoder.ReadMessage (System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String contentType) [0x00011] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncoder.cs:87
  at System.ServiceModel.Channels.Http.HttpReplyChannel.CreatePostMessage (System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x00081] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:229
  at System.ServiceModel.Channels.Http.HttpReplyChannel.TryReceiveRequest (TimeSpan timeout, System.ServiceModel.Channels.RequestContext& context) [0x000aa] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:172
  at System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__10 (TimeSpan tout, System.ServiceModel.Channels.RequestContext& ctx) [0x0002f] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs:126

I couldn't figure out how to check the connection status before trying to ReadMessage or CreatePostMessage functions.

Any Help ??
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens
I'm wondering if this is a bug.....  And maybe a report should be filed....  Sounds like a similar problem i looked at recently, but that bug was different because the sample code in the bug report also crashed in windows.

According to:  http://www.codeproject.com/Articles/8580/How-to-detect-a-connection-loss-in-Net-Sockets

The way to detect a remotely closed connection is to check if Socket.Receive (which, incidentally, is the topmost thing on the stack below) returns 0 or fewer bytes -- so you wouldn't expect an exception, instead you would expect a 0 return for number of bytes read.

This would seem to match:

http://msdn.microsoft.com/en-us/library/w3xtz6a5.aspx

Which says:

" If the remote host shuts down the Socket connection with the Shutdown method, and all available data has been received, the Receive method will complete immediately and return zero bytes."

And also says that SocketException is only raised under certain conditions, the only almost valid match is:

"An operating system error occurs while accessing the Socket."

But i don't think connection reset by peer is necessarily an operating system exception, it's rather a state of connection indicating we're disconnected, hence we should be returning zero, not raising an exception.

-Rob

On 06/26/2012 08:49 AM, shahbour wrote:
Hello

I got an WCF service that is running except at some time if the client send
a request then close his program directly , ending the session the WCF
console application crashes with below error 


[0x7f0b42f55700:] EXCEPTION handling: System.Net.Sockets.SocketException:
Connection reset by peer
[0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure
[0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure

Unhandled Exception: System.IO.IOException: Read failure --->
System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset,
Int32 size, SocketFlags flags) [0x000ad] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/Socket.cs:1606
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
offset, Int32 size) [0x00067] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:399
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
offset, Int32 size) [0x00078] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:401
  at System.Net.RequestStream.Read (System.Byte[] buffer, Int32 offset,
Int32 count) [0x0003c] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net/RequestStream.cs:142
  at System.IO.StreamReader.ReadBuffer () [0x00012] in
/usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:394
  at System.IO.StreamReader.Read (System.Char[] buffer, Int32 index, Int32
count) [0x00062] in
/usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:471
  at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x0004f] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1256
  at Mono.Xml2.XmlTextReader.PeekChar () [0x00047] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1210
  at Mono.Xml2.XmlTextReader.ReadContent () [0x0003f] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1310
  at Mono.Xml2.XmlTextReader.Read () [0x00141] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:626
  at System.Xml.XmlTextReader.Read () [0x0006b] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:564
  at System.Xml.XmlSimpleDictionaryReader.Read () [0x00000] in
/usr/local/src/mono-2.11.1/mcs/class/System.Runtime.Serialization/System.Xml/XmlSimpleDictionaryReader.cs:253
  at System.Xml.XmlReader.MoveToContent () [0x00050] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlReader.cs:574
  at System.ServiceModel.Channels.XmlReaderMessage.ReadEnvelopeStart ()
[0x00000] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:146
  at System.ServiceModel.Channels.XmlReaderMessage..ctor
(System.ServiceModel.Channels.MessageVersion version,
System.Xml.XmlDictionaryReader reader, Int32 maxSizeOfHeaders) [0x00026] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:70
  at System.ServiceModel.Channels.Message.CreateMessage
(System.Xml.XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders,
System.ServiceModel.Channels.MessageVersion version) [0x00022] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:427
  at System.ServiceModel.Channels.TextMessageEncoder.ReadMessage
(System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String contentType)
[0x00011] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncoder.cs:87
  at System.ServiceModel.Channels.Http.HttpReplyChannel.CreatePostMessage
(System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x00081] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:229
  at System.ServiceModel.Channels.Http.HttpReplyChannel.TryReceiveRequest
(TimeSpan timeout, System.ServiceModel.Channels.RequestContext& context)
[0x000aa] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:172
  at
System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__10
(TimeSpan tout, System.ServiceModel.Channels.RequestContext& ctx) [0x0002f]
in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs:126

I couldn't figure out how to check the connection status before trying to
ReadMessage or CreatePostMessage functions.

Any Help ??


--
View this message in context: http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list



_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens
In reply to this post by shahbour
Ammendment to previous reply:

http://stackoverflow.com/questions/1434451/connection-reset-by-peer

Also seems to indicate that connection reset by peer is not a clean connection close, but rather a 'hang up' (immediate disconnect) by the remote end.  So maybe it's not a mono bug.

Have you tried, in your console application, using exception handling to detect the Socket Exception, then handling as appropriate in your console application (such as restarting, if that's what you need to do).

-Rob

On 06/26/2012 08:49 AM, shahbour wrote:
Hello

I got an WCF service that is running except at some time if the client send
a request then close his program directly , ending the session the WCF
console application crashes with below error 


[0x7f0b42f55700:] EXCEPTION handling: System.Net.Sockets.SocketException:
Connection reset by peer
[0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure
[0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure

Unhandled Exception: System.IO.IOException: Read failure --->
System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset,
Int32 size, SocketFlags flags) [0x000ad] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/Socket.cs:1606
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
offset, Int32 size) [0x00067] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:399
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
offset, Int32 size) [0x00078] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:401
  at System.Net.RequestStream.Read (System.Byte[] buffer, Int32 offset,
Int32 count) [0x0003c] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net/RequestStream.cs:142
  at System.IO.StreamReader.ReadBuffer () [0x00012] in
/usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:394
  at System.IO.StreamReader.Read (System.Char[] buffer, Int32 index, Int32
count) [0x00062] in
/usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:471
  at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x0004f] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1256
  at Mono.Xml2.XmlTextReader.PeekChar () [0x00047] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1210
  at Mono.Xml2.XmlTextReader.ReadContent () [0x0003f] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1310
  at Mono.Xml2.XmlTextReader.Read () [0x00141] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:626
  at System.Xml.XmlTextReader.Read () [0x0006b] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:564
  at System.Xml.XmlSimpleDictionaryReader.Read () [0x00000] in
/usr/local/src/mono-2.11.1/mcs/class/System.Runtime.Serialization/System.Xml/XmlSimpleDictionaryReader.cs:253
  at System.Xml.XmlReader.MoveToContent () [0x00050] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlReader.cs:574
  at System.ServiceModel.Channels.XmlReaderMessage.ReadEnvelopeStart ()
[0x00000] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:146
  at System.ServiceModel.Channels.XmlReaderMessage..ctor
(System.ServiceModel.Channels.MessageVersion version,
System.Xml.XmlDictionaryReader reader, Int32 maxSizeOfHeaders) [0x00026] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:70
  at System.ServiceModel.Channels.Message.CreateMessage
(System.Xml.XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders,
System.ServiceModel.Channels.MessageVersion version) [0x00022] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:427
  at System.ServiceModel.Channels.TextMessageEncoder.ReadMessage
(System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String contentType)
[0x00011] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncoder.cs:87
  at System.ServiceModel.Channels.Http.HttpReplyChannel.CreatePostMessage
(System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x00081] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:229
  at System.ServiceModel.Channels.Http.HttpReplyChannel.TryReceiveRequest
(TimeSpan timeout, System.ServiceModel.Channels.RequestContext& context)
[0x000aa] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:172
  at
System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__10
(TimeSpan tout, System.ServiceModel.Channels.RequestContext& ctx) [0x0002f]
in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs:126

I couldn't figure out how to check the connection status before trying to
ReadMessage or CreatePostMessage functions.

Any Help ??


--
View this message in context: http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list



_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

shahbour
Hello Rob

You are correct this happen when the client (Silverlight application) request a query and then close the browser immediately before getting the response .

I tried to handle the error in my Console Application (i implemented IErrorHandler in WCF) to handle all errors still no luck.

Also i did Try Catch on my service method but still at some point the Console application crash .

BR
Shahbour
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens
WCF ("Windows" communication foundation) sounds remarkably platform
specific, but without knowing anything else, i bet they implemented it
in mono anyway....

http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.ierrorhandler.aspx

Says that the IErrorHandler should return a value indicating whether
the dispatcher aborts the session or not. I"m curious if you're
returning true or false in the case of a SocketException indicating
the connection was reset by peer?  I might suggest returning a value
indicating that you do want to abort the session (but not the whole
program) at that point, because this will allow it, in theory, to exit
that session's processing without necessarily crashing the whole
application.

-Rob

On Tue, Jun 26, 2012 at 1:43 PM, shahbour <[hidden email]> wrote:

> Hello Rob
>
> You are correct this happen when the client (Silverlight application)
> request a query and then close the browser immediately before getting the
> response .
>
> I tried to handle the error in my Console Application (i implemented
> IErrorHandler in WCF) to handle all errors still no luck.
>
> Also i did Try Catch on my service method but still at some point the
> Console application crash .
>
> BR
> Shahbour
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173p4650182.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Mono-devel-list mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Maciej Paszta-2
In reply to this post by shahbour
I don't think IErrorHandler would work in this case. Look at the stack
trace - you are unable to catch exception in any way since, the
connection is made in a separate thread (at least I suppose so looking
at the stack trace, specifically
System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__10).
Check whether your application behaves the same way on the .NET, if
not just make a bug report.

On Tue, Jun 26, 2012 at 2:49 PM, shahbour <[hidden email]> wrote:

> Hello
>
> I got an WCF service that is running except at some time if the client send
> a request then close his program directly , ending the session the WCF
> console application crashes with below error
>
>
> [0x7f0b42f55700:] EXCEPTION handling: System.Net.Sockets.SocketException:
> Connection reset by peer
> [0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure
> [0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure
>
> Unhandled Exception: System.IO.IOException: Read failure --->
> System.Net.Sockets.SocketException: Connection reset by peer
>  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset,
> Int32 size, SocketFlags flags) [0x000ad] in
> /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/Socket.cs:1606
>  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
> offset, Int32 size) [0x00067] in
> /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:399
>  --- End of inner exception stack trace ---
>  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
> offset, Int32 size) [0x00078] in
> /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:401
>  at System.Net.RequestStream.Read (System.Byte[] buffer, Int32 offset,
> Int32 count) [0x0003c] in
> /usr/local/src/mono-2.11.1/mcs/class/System/System.Net/RequestStream.cs:142
>  at System.IO.StreamReader.ReadBuffer () [0x00012] in
> /usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:394
>  at System.IO.StreamReader.Read (System.Char[] buffer, Int32 index, Int32
> count) [0x00062] in
> /usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:471
>  at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x0004f] in
> /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1256
>  at Mono.Xml2.XmlTextReader.PeekChar () [0x00047] in
> /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1210
>  at Mono.Xml2.XmlTextReader.ReadContent () [0x0003f] in
> /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1310
>  at Mono.Xml2.XmlTextReader.Read () [0x00141] in
> /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:626
>  at System.Xml.XmlTextReader.Read () [0x0006b] in
> /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:564
>  at System.Xml.XmlSimpleDictionaryReader.Read () [0x00000] in
> /usr/local/src/mono-2.11.1/mcs/class/System.Runtime.Serialization/System.Xml/XmlSimpleDictionaryReader.cs:253
>  at System.Xml.XmlReader.MoveToContent () [0x00050] in
> /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlReader.cs:574
>  at System.ServiceModel.Channels.XmlReaderMessage.ReadEnvelopeStart ()
> [0x00000] in
> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:146
>  at System.ServiceModel.Channels.XmlReaderMessage..ctor
> (System.ServiceModel.Channels.MessageVersion version,
> System.Xml.XmlDictionaryReader reader, Int32 maxSizeOfHeaders) [0x00026] in
> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:70
>  at System.ServiceModel.Channels.Message.CreateMessage
> (System.Xml.XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders,
> System.ServiceModel.Channels.MessageVersion version) [0x00022] in
> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:427
>  at System.ServiceModel.Channels.TextMessageEncoder.ReadMessage
> (System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String contentType)
> [0x00011] in
> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncoder.cs:87
>  at System.ServiceModel.Channels.Http.HttpReplyChannel.CreatePostMessage
> (System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x00081] in
> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:229
>  at System.ServiceModel.Channels.Http.HttpReplyChannel.TryReceiveRequest
> (TimeSpan timeout, System.ServiceModel.Channels.RequestContext& context)
> [0x000aa] in
> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:172
>  at
> System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__10
> (TimeSpan tout, System.ServiceModel.Channels.RequestContext& ctx) [0x0002f]
> in
> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs:126
>
> I couldn't figure out how to check the connection status before trying to
> ReadMessage or CreatePostMessage functions.
>
> Any Help ??
>
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Mono-devel-list mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/mono-devel-list



--
Maciej Paszta
_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens
I apologize, I was under the probably mistaken impression that those
"EXCEPTION handling:" messages were coming from the IErrorHandler he was
talking about.

-Rob

On 06/27/2012 01:16 AM, Maciej Paszta wrote:

> I don't think IErrorHandler would work in this case. Look at the stack
> trace - you are unable to catch exception in any way since, the
> connection is made in a separate thread (at least I suppose so looking
> at the stack trace, specifically
> System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__10).
> Check whether your application behaves the same way on the .NET, if
> not just make a bug report.
>
> On Tue, Jun 26, 2012 at 2:49 PM, shahbour <[hidden email]> wrote:
>> Hello
>>
>> I got an WCF service that is running except at some time if the client send
>> a request then close his program directly , ending the session the WCF
>> console application crashes with below error
>>
>>
>> [0x7f0b42f55700:] EXCEPTION handling: System.Net.Sockets.SocketException:
>> Connection reset by peer
>> [0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure
>> [0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure
>>
>> Unhandled Exception: System.IO.IOException: Read failure --->
>> System.Net.Sockets.SocketException: Connection reset by peer
>>  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset,
>> Int32 size, SocketFlags flags) [0x000ad] in
>> /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/Socket.cs:1606
>>  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
>> offset, Int32 size) [0x00067] in
>> /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:399
>>  --- End of inner exception stack trace ---
>>  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
>> offset, Int32 size) [0x00078] in
>> /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:401
>>  at System.Net.RequestStream.Read (System.Byte[] buffer, Int32 offset,
>> Int32 count) [0x0003c] in
>> /usr/local/src/mono-2.11.1/mcs/class/System/System.Net/RequestStream.cs:142
>>  at System.IO.StreamReader.ReadBuffer () [0x00012] in
>> /usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:394
>>  at System.IO.StreamReader.Read (System.Char[] buffer, Int32 index, Int32
>> count) [0x00062] in
>> /usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:471
>>  at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x0004f] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1256
>>  at Mono.Xml2.XmlTextReader.PeekChar () [0x00047] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1210
>>  at Mono.Xml2.XmlTextReader.ReadContent () [0x0003f] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1310
>>  at Mono.Xml2.XmlTextReader.Read () [0x00141] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:626
>>  at System.Xml.XmlTextReader.Read () [0x0006b] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:564
>>  at System.Xml.XmlSimpleDictionaryReader.Read () [0x00000] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.Runtime.Serialization/System.Xml/XmlSimpleDictionaryReader.cs:253
>>  at System.Xml.XmlReader.MoveToContent () [0x00050] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlReader.cs:574
>>  at System.ServiceModel.Channels.XmlReaderMessage.ReadEnvelopeStart ()
>> [0x00000] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:146
>>  at System.ServiceModel.Channels.XmlReaderMessage..ctor
>> (System.ServiceModel.Channels.MessageVersion version,
>> System.Xml.XmlDictionaryReader reader, Int32 maxSizeOfHeaders) [0x00026] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:70
>>  at System.ServiceModel.Channels.Message.CreateMessage
>> (System.Xml.XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders,
>> System.ServiceModel.Channels.MessageVersion version) [0x00022] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:427
>>  at System.ServiceModel.Channels.TextMessageEncoder.ReadMessage
>> (System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String contentType)
>> [0x00011] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncoder.cs:87
>>  at System.ServiceModel.Channels.Http.HttpReplyChannel.CreatePostMessage
>> (System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x00081] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:229
>>  at System.ServiceModel.Channels.Http.HttpReplyChannel.TryReceiveRequest
>> (TimeSpan timeout, System.ServiceModel.Channels.RequestContext& context)
>> [0x000aa] in
>> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:172
>>  at
>> System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__10
>> (TimeSpan tout, System.ServiceModel.Channels.RequestContext& ctx) [0x0002f]
>> in
>> /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs:126
>>
>> I couldn't figure out how to check the connection status before trying to
>> ReadMessage or CreatePostMessage functions.
>>
>> Any Help ??
>>
>>
>> --
>> View this message in context: http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173.html
>> Sent from the Mono - Dev mailing list archive at Nabble.com.
>> _______________________________________________
>> Mono-devel-list mailing list
>> [hidden email]
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>


_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens
In reply to this post by shahbour
By the way, I noticed the bottom of the stack was similar to this earlier error message we corrected:
http://mono.1490590.n4.nabble.com/Exception-at-System-ServiceModel-Channels-Http-HttpReplyChannel-TryReceiveRequest-td4649878.html

I personally believe something called "*Try*ReceiveRequest" should be more fault tolerant, and allow failure, and in the case of failure at least with SocketException, fail out peacefully without causing issues in the whole program.  I think around there is where we should be looking to fix this.

I agree, Please do file a bug report, so at least it can be looked at, and include the stack trace.  IF you could provide a small sample of code in the bug report that can reproduce this it would be helpful, one way to do this might be to start transmission in one thread and intentionally crash (throw an unhandled exception) in another thread on the client.  Or at least mention that something like this might work.

And if you didn't submit a patch on your previous report (linked above) please describe exactly the lines you changed for that fix (copy and paste the lines) and someone will probably do the patch for you.

My network connection is down as i write this e-mail but i believe you can find the bug report feature by going to mono-project.com then get over to contributing then i think the bug reporting link is there.  Bug reports on the mailing list, i believe, have a tendency to get lost unless they are constantly talked about until they are fixed.

On 06/26/2012 08:49 AM, shahbour wrote:
Hello

I got an WCF service that is running except at some time if the client send
a request then close his program directly , ending the session the WCF
console application crashes with below error 


[0x7f0b42f55700:] EXCEPTION handling: System.Net.Sockets.SocketException:
Connection reset by peer
[0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure
[0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure

Unhandled Exception: System.IO.IOException: Read failure --->
System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset,
Int32 size, SocketFlags flags) [0x000ad] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/Socket.cs:1606
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
offset, Int32 size) [0x00067] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:399
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
offset, Int32 size) [0x00078] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:401
  at System.Net.RequestStream.Read (System.Byte[] buffer, Int32 offset,
Int32 count) [0x0003c] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net/RequestStream.cs:142
  at System.IO.StreamReader.ReadBuffer () [0x00012] in
/usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:394
  at System.IO.StreamReader.Read (System.Char[] buffer, Int32 index, Int32
count) [0x00062] in
/usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:471
  at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x0004f] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1256
  at Mono.Xml2.XmlTextReader.PeekChar () [0x00047] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1210
  at Mono.Xml2.XmlTextReader.ReadContent () [0x0003f] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1310
  at Mono.Xml2.XmlTextReader.Read () [0x00141] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:626
  at System.Xml.XmlTextReader.Read () [0x0006b] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:564
  at System.Xml.XmlSimpleDictionaryReader.Read () [0x00000] in
/usr/local/src/mono-2.11.1/mcs/class/System.Runtime.Serialization/System.Xml/XmlSimpleDictionaryReader.cs:253
  at System.Xml.XmlReader.MoveToContent () [0x00050] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlReader.cs:574
  at System.ServiceModel.Channels.XmlReaderMessage.ReadEnvelopeStart ()
[0x00000] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:146
  at System.ServiceModel.Channels.XmlReaderMessage..ctor
(System.ServiceModel.Channels.MessageVersion version,
System.Xml.XmlDictionaryReader reader, Int32 maxSizeOfHeaders) [0x00026] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:70
  at System.ServiceModel.Channels.Message.CreateMessage
(System.Xml.XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders,
System.ServiceModel.Channels.MessageVersion version) [0x00022] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:427
  at System.ServiceModel.Channels.TextMessageEncoder.ReadMessage
(System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String contentType)
[0x00011] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncoder.cs:87
  at System.ServiceModel.Channels.Http.HttpReplyChannel.CreatePostMessage
(System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x00081] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:229
  at System.ServiceModel.Channels.Http.HttpReplyChannel.TryReceiveRequest
(TimeSpan timeout, System.ServiceModel.Channels.RequestContext& context)
[0x000aa] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:172
  at
System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__10
(TimeSpan tout, System.ServiceModel.Channels.RequestContext& ctx) [0x0002f]
in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs:126

I couldn't figure out how to check the connection status before trying to
ReadMessage or CreatePostMessage functions.

Any Help ??


--
View this message in context: http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list



_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens

I sent a suggested fix, untested, under another thread, titled "BeginTryReceiveRequest and Socket error handling?".  I'm more wondering if it's a good idea or not, but it looks like it is safe to me in this case because we're in our own thread starting there.

The Exception being raised is appropriate, but the handling of it in BeginTryReceiveRequest is more of an issue, I believe.

-Rob

On 06/27/2012 08:52 AM, Rob Wilkens wrote:
By the way, I noticed the bottom of the stack was similar to this earlier error message we corrected:
http://mono.1490590.n4.nabble.com/Exception-at-System-ServiceModel-Channels-Http-HttpReplyChannel-TryReceiveRequest-td4649878.html

I personally believe something called "*Try*ReceiveRequest" should be more fault tolerant, and allow failure, and in the case of failure at least with SocketException, fail out peacefully without causing issues in the whole program.  I think around there is where we should be looking to fix this.

I agree, Please do file a bug report, so at least it can be looked at, and include the stack trace.  IF you could provide a small sample of code in the bug report that can reproduce this it would be helpful, one way to do this might be to start transmission in one thread and intentionally crash (throw an unhandled exception) in another thread on the client.  Or at least mention that something like this might work.

And if you didn't submit a patch on your previous report (linked above) please describe exactly the lines you changed for that fix (copy and paste the lines) and someone will probably do the patch for you.

My network connection is down as i write this e-mail but i believe you can find the bug report feature by going to mono-project.com then get over to contributing then i think the bug reporting link is there.  Bug reports on the mailing list, i believe, have a tendency to get lost unless they are constantly talked about until they are fixed.

On 06/26/2012 08:49 AM, shahbour wrote:
Hello

I got an WCF service that is running except at some time if the client send
a request then close his program directly , ending the session the WCF
console application crashes with below error 


[0x7f0b42f55700:] EXCEPTION handling: System.Net.Sockets.SocketException:
Connection reset by peer
[0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure
[0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure

Unhandled Exception: System.IO.IOException: Read failure --->
System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset,
Int32 size, SocketFlags flags) [0x000ad] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/Socket.cs:1606
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
offset, Int32 size) [0x00067] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:399
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
offset, Int32 size) [0x00078] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:401
  at System.Net.RequestStream.Read (System.Byte[] buffer, Int32 offset,
Int32 count) [0x0003c] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net/RequestStream.cs:142
  at System.IO.StreamReader.ReadBuffer () [0x00012] in
/usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:394
  at System.IO.StreamReader.Read (System.Char[] buffer, Int32 index, Int32
count) [0x00062] in
/usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:471
  at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x0004f] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1256
  at Mono.Xml2.XmlTextReader.PeekChar () [0x00047] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1210
  at Mono.Xml2.XmlTextReader.ReadContent () [0x0003f] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1310
  at Mono.Xml2.XmlTextReader.Read () [0x00141] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:626
  at System.Xml.XmlTextReader.Read () [0x0006b] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:564
  at System.Xml.XmlSimpleDictionaryReader.Read () [0x00000] in
/usr/local/src/mono-2.11.1/mcs/class/System.Runtime.Serialization/System.Xml/XmlSimpleDictionaryReader.cs:253
  at System.Xml.XmlReader.MoveToContent () [0x00050] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlReader.cs:574
  at System.ServiceModel.Channels.XmlReaderMessage.ReadEnvelopeStart ()
[0x00000] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:146
  at System.ServiceModel.Channels.XmlReaderMessage..ctor
(System.ServiceModel.Channels.MessageVersion version,
System.Xml.XmlDictionaryReader reader, Int32 maxSizeOfHeaders) [0x00026] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:70
  at System.ServiceModel.Channels.Message.CreateMessage
(System.Xml.XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders,
System.ServiceModel.Channels.MessageVersion version) [0x00022] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:427
  at System.ServiceModel.Channels.TextMessageEncoder.ReadMessage
(System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String contentType)
[0x00011] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncoder.cs:87
  at System.ServiceModel.Channels.Http.HttpReplyChannel.CreatePostMessage
(System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x00081] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:229
  at System.ServiceModel.Channels.Http.HttpReplyChannel.TryReceiveRequest
(TimeSpan timeout, System.ServiceModel.Channels.RequestContext& context)
[0x000aa] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:172
  at
System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__10
(TimeSpan tout, System.ServiceModel.Channels.RequestContext& ctx) [0x0002f]
in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs:126

I couldn't figure out how to check the connection status before trying to
ReadMessage or CreatePostMessage functions.

Any Help ??


--
View this message in context: http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list





_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

shahbour
This post was updated on .
In reply to this post by Maciej Paszta-2
Hello

Thanks for the suggestion and updates.

I tested the application on windows machine (in fact i am using visual studio to develop it) and the result was that if i close the browser while running the console application under windows the application doesn't crash but still raise an error where it should (ErrorHandler)

The below error is what i got and as you can see.

it was forward to ErrorHandler class and didn't crash the application

2012-06-27 13:51:09,213 [3] ERROR (XXXXX\ErrorHandler.cs:19) CDRServer.ErrorHandler CDRServer.ErrorHandler.HandleError(XXXXX\ErrorHandler.cs:19) - An operation was attempted on a nonexistent network connection
System.Net.HttpListenerException: An operation was attempted on a nonexistent network connection
   at System.Net.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.ServiceModel.Channels.BytesReadPositionStream.Write(Byte[] buffer,Int32 offset, Int32 count)
   at System.ServiceModel.Channels.HttpOutput.ListenerResponseHttpOutput.ListenerResponseOutputStream.Write(Byte[] buffer, Int32 offset, Int32 count)

while same thing if hosting it under mono in linux i got

2012-06-27 14:19:08,755 [Threadpool worker] WARN  CDRServer.WCFHost.bgwWCFHost_DoWork(:0) - WCF is still running with status Opened
[0x44d7d940:] EXCEPTION handling: System.ObjectDisposedException: The object was used after being disposed.
[0x44d7d940:] EXCEPTION handling: System.IO.IOException: EndRead failure
[0x43b74940:] EXCEPTION handling: System.Net.Sockets.SocketException: The socket has been shut down
[0x43b74940:] EXCEPTION handling: System.IO.IOException: Write failure
Exception Write failure   at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, Int32 offset, Int32 size) [0x0008e] in /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:445
  at System.Net.ResponseStream.InternalWrite (System.Byte[] buffer, Int32 offset, Int32 count) [0x00029] in /usr/local/src/mono-2.11.1/mcs/class/System/System.Net/ResponseStream.cs:129
  at System.Net.ResponseStream.Write (System.Byte[] buffer, Int32 offset, Int32 count) [0x000dd] in /usr/local/src/mono-2.11.1/mcs/class/System/System.Net/ResponseStream.cs:162
  at System.ServiceModel.Channels.Http.HttpRequestContext.InternalReply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00157] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:160
  at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:101
  at System.ServiceModel.Dispatcher.MessageProcessingContext.Reply (Boolean useTimeout) [0x00026] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/MessageProcessingContext.cs:96
  at System.ServiceModel.Dispatcher.OperationInvokerHandler.Reply (System.ServiceModel.Dispatcher.MessageProcessingContext mrc, Boolean useTimeout) [0x0001d] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/OperationInvokerHandler.cs:69
  at System.ServiceModel.Dispatcher.OperationInvokerHandler.ProcessRequest (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00044] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/OperationInvokerHandler.cs:29
  at System.ServiceModel.Dispatcher.BaseRequestProcessorHandler.ProcessRequestChain (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00000] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseRequestProcessorHandler.cs:15
  at System.ServiceModel.Dispatcher.BaseRequestProcessorHandler.ProcessRequestChain (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00017] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseRequestProcessorHandler.cs:16
  at System.ServiceModel.Dispatcher.HandlersChain.ProcessRequestChain (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x0000b] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseRequestProcessor.cs:72
  at System.ServiceModel.Dispatcher.BaseRequestProcessor.ProcessRequest (System.ServiceModel.Dispatcher.MessageProcessingContext mrc) [0x00018] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseRequestProcessor.cs:26
2012-06-27 14:20:07,744 [Threadpool worker] ERROR CDRServer.ErrorHandler.HandleError(:0) - Write failure
System.Net.Sockets.SocketException: The socket has been shut down
  at System.Net.Sockets.Socket.Send (System.Byte[] buf, Int32 offset, Int32 size, SocketFlags flags) [0x0008b] in /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/Socket.cs:1908
  at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, Int32 offset, Int32 size) [0x0006e] in /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:442
[0x43b74940:] EXCEPTION handling: System.IO.IOException: Write failure
2012-06-27 14:20:07,747 [Threadpool worker] ERROR CDRServer.ErrorHandler.HandleError(:0) - Write failure
System.Net.Sockets.SocketException: The socket has been shut down
  at System.Net.Sockets.Socket.Send (System.Byte[] buf, Int32 offset, Int32 size, SocketFlags flags) [0x0008b] in /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/Socket.cs:1908
  at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, Int32 offset, Int32 size) [0x0006e] in /usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:442
[0x43b74940:] EXCEPTION handling: System.ArgumentException: Value does not fall within the expected range.

Unhandled Exception: System.ArgumentException: Value does not fall within the expected range.
  at System.Xml.XmlWriter.WriteQualifiedNameInternal (System.String localName, System.String ns) [0x000c9] in /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlWriter.cs:417
  at System.Xml.XmlWriter.WriteQualifiedName (System.String localName, System.String ns) [0x00000] in /usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlWriter.cs:342
  at System.Xml.XmlSimpleDictionaryWriter.WriteQualifiedName (System.String localName, System.String ns) [0x00000] in /usr/local/src/mono-2.11.1/mcs/class/System.Runtime.Serialization/System.Xml/XmlSimpleDictionaryWriter.cs:144
  at System.ServiceModel.Channels.MessageFault.WriteFaultCode (System.Xml.XmlDictionaryWriter writer, System.ServiceModel.EnvelopeVersion version, System.ServiceModel.FaultCode code, Boolean sub) [0x00058] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageFault.cs:431
  at System.ServiceModel.Channels.MessageFault.WriteTo (System.Xml.XmlDictionaryWriter writer, System.ServiceModel.EnvelopeVersion version) [0x00011] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageFault.cs:417
  at System.ServiceModel.Channels.MessageFaultBodyWriter.OnWriteBodyContents (System.Xml.XmlDictionaryWriter writer) [0x00000] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageFaultBodyWriter.cs:57
  at System.ServiceModel.Channels.BodyWriter.WriteBodyContents (System.Xml.XmlDictionaryWriter writer) [0x00000] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/BodyWriter.cs:57
  at System.ServiceModel.Channels.SimpleMessage.OnWriteBodyContents (System.Xml.XmlDictionaryWriter writer) [0x00000] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:331
  at System.ServiceModel.Channels.Message.WriteBodyContents (System.Xml.XmlDictionaryWriter writer) [0x00022] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:164
  at System.ServiceModel.Channels.Message.WriteBody (System.Xml.XmlDictionaryWriter writer) [0x0001c] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:149
  at System.ServiceModel.Channels.Message.OnWriteMessage (System.Xml.XmlDictionaryWriter writer) [0x00065] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:274
  at System.ServiceModel.Channels.Message.WriteMessage (System.Xml.XmlDictionaryWriter writer) [0x00026] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:176
  at System.ServiceModel.Channels.Message.WriteMessage (System.Xml.XmlWriter writer) [0x00000] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:181
  at System.ServiceModel.Logger.LogMessage (System.ServiceModel.Diagnostics.MessageLogTraceRecord log) [0x0008d] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel/Logger.cs:191
  at System.ServiceModel.Logger.LogMessage (MessageLogSourceKind sourceKind, System.ServiceModel.Channels.Message& msg, Int64 maxMessageSize) [0x00029] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel/Logger.cs:171
  at System.ServiceModel.Channels.Http.HttpRequestContext.InternalReply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00011] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:136
  at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:101
  at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg) [0x00000] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:96
  at System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessRequest (IReplyChannel reply, System.ServiceModel.Channels.RequestContext rc) [0x0003b] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:601
  at System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveRequestDone (IAsyncResult result) [0x0001a] in /usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:575

The error change little depending if the host is replying or still getting the request.

I think it is a bug , how to raise that ??

BR
Shahbour
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

shahbour
In reply to this post by shahbour

Hello After more testing between Mac and Windows this is what i got Crash Windows Mac Linux Without ErroHandler No Yes Yes With ErrorHandler (return false ) No Yes Yes With ErrorHandler (return true) No No No Before i was always returning false in IErrorHandler implementation because i only implemented for logging purpose but when i return true for the HandleError , the application fire the error and log it but never crash. Now i trying to debug the application under MonoDevelop and repreduce the error, below is what i got

System.InvalidOperationException: Cannot be changed after headers are sent. at System.Net.HttpListenerResponse.set_ContentType (System.String value) [0x00027] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System/System.Net/HttpListenerResponse.cs:107 at System.ServiceModel.Channels.Http.HttpStandaloneResponseInfo.set_ContentType (System.String value) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpContextInfo.cs:274 at System.ServiceModel.Channels.Http.HttpRequestContext.InternalReply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00046] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:140 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:101 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:96 at System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessRequest (IReplyChannel reply, System.ServiceModel.Channels.RequestContext rc) [0x0003b] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:601 at System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveRequestDone (IAsyncResult result) [0x0001a] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:575
Reproducing the error is very simple, just host any application under console app and in any service function put Thread.Sleep(..) to give you time to close the browser before it reply. Then call this function from any client and close it before getting the response. In my live program i don't put Thread.sleep it is only to give us time between calling the function and closing the browser. Under windows we got the bellow that don't crash the application error.Message "An operation was attempted on a nonexistent network connection" error.InnerException {"An operation was attempted on a nonexistent network connection"} System.Exception {System.Net.HttpListenerException} error.ErrorCode 1229 BR Shahbour
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens
This looks like an entirely different kind of error than we were seeing
before.  Here we are attempting, apparently, to change the content type
after we've already sent the headers, if the exception message is right,
and that sounds like a bug -- but i don't have the patience to dig
through the code right now to confirm that.  Tomorrow is a beach day for
me (my sister, the teacher, is home from school for the summer, so we've
got weekday group activities now).  Maybe tomorrow night if nothing is
going on i will try to look at it if no one else wants to.  I didn't
pick any bug reports to work on, so if i remember (no promises) to look
at this it will be at the top of my list.

Feel free to file a bug report about this -- earlier today from cell
phone i e-mailed you privately a link to the bug report feature.  It's
better than counting on me

-Rob


System.InvalidOperationException: Cannot be changed after headers are
sent. at System.Net.HttpListenerResponse.set_ContentType (System.String
value) [0x00027] in
/private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System/System.Net/HttpListenerResponse.cs:107
at
System.ServiceModel.Channels.Http.HttpStandaloneResponseInfo.set_ContentType
(System.String value) [0x00000] in
/private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpContextInfo.cs:274
at System.ServiceModel.Channels.Http.HttpRequestContext.InternalReply
(System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00046]
in
/private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:140
at System.ServiceModel.Channels.Http.HttpRequestContext.Reply
(System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000]
in
/private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:101
at System.ServiceModel.Channels.Http.HttpRequestContext.Reply
(System.ServiceModel.Channels.Message msg) [0x00000] in
/private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:96
at System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessRequest
(IReplyChannel reply, System.ServiceModel.Channels.RequestContext rc)
[0x0003b] in
/private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:601
at
System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveRequestDone
(IAsyncResult result) [0x0001a] in
/private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:575
_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens
In reply to this post by shahbour
On 06/27/2012 01:02 PM, shahbour wrote:
Reproducing the error is very simple, just host any application under console app and in any service function put Thread.Sleep(..) to give you time to close the browser before it reply. Then call this function from any client and close it before getting the response. In my live program i don't put Thread.sleep it is only to give us time between calling the function and closing the browser. Under windows we got the bellow that don't crash the application error.Message "An operation was attempted on a nonexistent network connection" error.InnerException {"An operation was attempted on a nonexistent network connection"} System.Exception {System.Net.HttpListenerException} error.ErrorCode 1229 BR Shahbour


First, I'm glad you managed to get the error handler to prevent the application from crashing altogether by changing the return value.  I think i suggested that the other day or was that this morning, i don't remember now.

Next, I personally don't know what it means (above) when you say "just host any application under console app," or how to build a "service function", but that's my fault for never having used WCF.  Please understand, for example, just because someone knows how to code -- take for example -- an operating system, doesn't mean they know how to use every possible application that can run on the operating system (take, for example, some advanced math, science, or engineering program -- knowledge of low level C doesn't imply knowledge of advanced chemistry or physics for example).

-Rob

_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens
In reply to this post by shahbour
Re : The stacktrace below...

This occurs when an exception is raised in ChannelDispatcher.cs on line 601.  It tries to send back an exception message to the client here, i believe.  But when it does that, it uses the existing RequestContext. 

It's apparent that some data is apparently being sent, such as headers, on the RequestContext (rc) before we get to this exception.

If we're dealing with the case of SocketException, which caused us to fail mid-send on the RequestContext, perhaps, again, we shouldn't handle this like every other exception and not reply.  i.e. in the exception handler here, if exception is typeof(SocketException) don't reply, what might be more interesting, if this is reproducable, would be to - as debugging - print the exception message and/or stacktrace to the screen to see what exception caused this.

Did you file a bug report on this?  The discussion on this particular issue (or any particular bug) is probably better stored in the bug report comments than on the whole mailing list.  PLus comments like the above would stay in the bug report rather than get lost in the list.  IF you file a bug report, post a link to the bug report in this thread (the bug # should be enough).

-Rob


On 06/27/2012 01:02 PM, shahbour wrote:

Hello After more testing between Mac and Windows this is what i got Crash Windows Mac Linux Without ErroHandler No Yes Yes With ErrorHandler (return false ) No Yes Yes With ErrorHandler (return true) No No No Before i was always returning false in IErrorHandler implementation because i only implemented for logging purpose but when i return true for the HandleError , the application fire the error and log it but never crash. Now i trying to debug the application under MonoDevelop and repreduce the error, below is what i got

System.InvalidOperationException: Cannot be changed after headers are sent. at System.Net.HttpListenerResponse.set_ContentType (System.String value) [0x00027] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System/System.Net/HttpListenerResponse.cs:107 at System.ServiceModel.Channels.Http.HttpStandaloneResponseInfo.set_ContentType (System.String value) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpContextInfo.cs:274 at System.ServiceModel.Channels.Http.HttpRequestContext.InternalReply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00046] in /private/tmp/monobuild/build/BUILD/mono-2.10.9

/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:140 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:101 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:96 at System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessRequest (IReplyChannel reply, System.ServiceModel.Channels.RequestContext rc) [0x0003b] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:601 at System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveRequestDone (IAsyncResult result) [0x0001a] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:575
Reproducing the error is very simple, just host any application under console app and in any service function put Thread.Sleep(..) to give you time to close the browser before it reply. Then call this function from any client and close it before getting the response. In my live program i don't put Thread.sleep it is only to give us time between calling the function and closing the browser. Under windows we got the bellow that don't crash the application error.Message "An operation was attempted on a nonexistent network connection" error.InnerException {"An operation was attempted on a nonexistent network connection"} System.Exception :q
{System.Net.HttpListenerException} error.ErrorCode 1229 BR Shahbour

View this message in context: Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer
Sent from the Mono - Dev mailing list archive at Nabble.com.


_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list



_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens

Either of the attached patches illustrates what i was trying to say in that last patch

(1) attempt2.patch  : This attempts to patch just the below concern, and is based on a guess.
-or- (not both)
(2) combined.patch : This combines attempt2.patch with the patch i sent last night since they were on the same branch.

I'm not able to test these anything beyond "does it compile" because i don't have sample code to reproduce this with.

-Rob

On 06/28/2012 07:55 AM, Rob Wilkens wrote:
Re : The stacktrace below...

This occurs when an exception is raised in ChannelDispatcher.cs on line 601.  It tries to send back an exception message to the client here, i believe.  But when it does that, it uses the existing RequestContext. 

It's apparent that some data is apparently being sent, such as headers, on the RequestContext (rc) before we get to this exception.

If we're dealing with the case of SocketException, which caused us to fail mid-send on the RequestContext, perhaps, again, we shouldn't handle this like every other exception and not reply.  i.e. in the exception handler here, if exception is typeof(SocketException) don't reply, what might be more interesting, if this is reproducable, would be to - as debugging - print the exception message and/or stacktrace to the screen to see what exception caused this.

Did you file a bug report on this?  The discussion on this particular issue (or any particular bug) is probably better stored in the bug report comments than on the whole mailing list.  PLus comments like the above would stay in the bug report rather than get lost in the list.  IF you file a bug report, post a link to the bug report in this thread (the bug # should be enough).

-Rob


On 06/27/2012 01:02 PM, shahbour wrote:

Hello After more testing between Mac and Windows this is what i got Crash Windows Mac Linux Without ErroHandler No Yes Yes With ErrorHandler (return false ) No Yes Yes With ErrorHandler (return true) No No No Before i was always returning false in IErrorHandler implementation because i only implemented for logging purpose but when i return true for the HandleError , the application fire the error and log it but never crash. Now i trying to debug the application under MonoDevelop and repreduce the error, below is what i got

System.InvalidOperationException: Cannot be changed after headers are sent. at System.Net.HttpListenerResponse.set_ContentType (System.String value) [0x00027] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System/System.Net/HttpListenerResponse.cs:107 at System.ServiceModel.Channels.Http.HttpStandaloneResponseInfo.set_ContentType (System.String value) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpContextInfo.cs:274 at System.ServiceModel.Channels.Http.HttpRequestContext.InternalReply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00046] in /private/tmp/monobuild/build/BUILD/mono-2.10.9

/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:140 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:101 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:96 at System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessRequest (IReplyChannel reply, System.ServiceModel.Channels.RequestContext rc) [0x0003b] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:601 at System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveRequestDone (IAsyncResult result) [0x0001a] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:575
Reproducing the error is very simple, just host any application under console app and in any service function put Thread.Sleep(..) to give you time to close the browser before it reply. Then call this function from any client and close it before getting the response. In my live program i don't put Thread.sleep it is only to give us time between calling the function and closing the browser. Under windows we got the bellow that don't crash the application error.Message "An operation was attempted on a nonexistent network connection" error.InnerException {"An operation was attempted on a nonexistent network connection"} System.Exception :q
{System.Net.HttpListenerException} error.ErrorCode 1229 BR Shahbour

View this message in context: Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer
Sent from the Mono - Dev mailing list archive at Nabble.com.


_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list





_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list

attempt2.patch (955 bytes) Download Attachment
combined.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens
Worth noting, with Combined patch applied (or both other applied separately), zero unit tests are failing.  So apparently, it doesn't make anything worse, at least as far as tests go.

-Rob

On 06/28/2012 08:20 AM, Rob Wilkens wrote:

Either of the attached patches illustrates what i was trying to say in that last patch

(1) attempt2.patch  : This attempts to patch just the below concern, and is based on a guess.
-or- (not both)
(2) combined.patch : This combines attempt2.patch with the patch i sent last night since they were on the same branch.

I'm not able to test these anything beyond "does it compile" because i don't have sample code to reproduce this with.

-Rob

On 06/28/2012 07:55 AM, Rob Wilkens wrote:
Re : The stacktrace below...

This occurs when an exception is raised in ChannelDispatcher.cs on line 601.  It tries to send back an exception message to the client here, i believe.  But when it does that, it uses the existing RequestContext. 

It's apparent that some data is apparently being sent, such as headers, on the RequestContext (rc) before we get to this exception.

If we're dealing with the case of SocketException, which caused us to fail mid-send on the RequestContext, perhaps, again, we shouldn't handle this like every other exception and not reply.  i.e. in the exception handler here, if exception is typeof(SocketException) don't reply, what might be more interesting, if this is reproducable, would be to - as debugging - print the exception message and/or stacktrace to the screen to see what exception caused this.

Did you file a bug report on this?  The discussion on this particular issue (or any particular bug) is probably better stored in the bug report comments than on the whole mailing list.  PLus comments like the above would stay in the bug report rather than get lost in the list.  IF you file a bug report, post a link to the bug report in this thread (the bug # should be enough).

-Rob


On 06/27/2012 01:02 PM, shahbour wrote:

Hello After more testing between Mac and Windows this is what i got Crash Windows Mac Linux Without ErroHandler No Yes Yes With ErrorHandler (return false ) No Yes Yes With ErrorHandler (return true) No No No Before i was always returning false in IErrorHandler implementation because i only implemented for logging purpose but when i return true for the HandleError , the application fire the error and log it but never crash. Now i trying to debug the application under MonoDevelop and repreduce the error, below is what i got

System.InvalidOperationException: Cannot be changed after headers are sent. at System.Net.HttpListenerResponse.set_ContentType (System.String value) [0x00027] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System/System.Net/HttpListenerResponse.cs:107 at System.ServiceModel.Channels.Http.HttpStandaloneResponseInfo.set_ContentType (System.String value) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpContextInfo.cs:274 at System.ServiceModel.Channels.Http.HttpRequestContext.InternalReply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00046] in /private/tmp/monobuild/build/BUILD/mono-2.10.9

/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:140 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:101 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:96 at System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessRequest (IReplyChannel reply, System.ServiceModel.Channels.RequestContext rc) [0x0003b] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:601 at System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveRequestDone (IAsyncResult result) [0x0001a] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:575
Reproducing the error is very simple, just host any application under console app and in any service function put Thread.Sleep(..) to give you time to close the browser before it reply. Then call this function from any client and close it before getting the response. In my live program i don't put Thread.sleep it is only to give us time between calling the function and closing the browser. Under windows we got the bellow that don't crash the application error.Message "An operation was attempted on a nonexistent network connection" error.InnerException {"An operation was attempted on a nonexistent network connection"} System.Exception :q
{System.Net.HttpListenerException} error.ErrorCode 1229 BR Shahbour

View this message in context: Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer
Sent from the Mono - Dev mailing list archive at Nabble.com.


_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list







_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens
I mean zero RELATED unit tests were failing (in System.ServiceModel)


On 06/28/2012 08:38 AM, Rob Wilkens wrote:
Worth noting, with Combined patch applied (or both other applied separately), zero unit tests are failing.  So apparently, it doesn't make anything worse, at least as far as tests go.

-Rob

On 06/28/2012 08:20 AM, Rob Wilkens wrote:

Either of the attached patches illustrates what i was trying to say in that last patch

(1) attempt2.patch  : This attempts to patch just the below concern, and is based on a guess.
-or- (not both)
(2) combined.patch : This combines attempt2.patch with the patch i sent last night since they were on the same branch.

I'm not able to test these anything beyond "does it compile" because i don't have sample code to reproduce this with.

-Rob


On 06/28/2012 07:55 AM, Rob Wilkens wrote:
Re : The stacktrace below...

This occurs when an exception is raised in ChannelDispatcher.cs on line 601.  It tries to send back an exception message to the client here, i believe.  But when it does that, it uses the existing RequestContext. 

It's apparent that some data is apparently being sent, such as headers, on the RequestContext (rc) before we get to this exception.

If we're dealing with the case of SocketException, which caused us to fail mid-send on the RequestContext, perhaps, again, we shouldn't handle this like every other exception and not reply.  i.e. in the exception handler here, if exception is typeof(SocketException) don't reply, what might be more interesting, if this is reproducable, would be to - as debugging - print the exception message and/or stacktrace to the screen to see what exception caused this.

Did you file a bug report on this?  The discussion on this particular issue (or any particular bug) is probably better stored in the bug report comments than on the whole mailing list.  PLus comments like the above would stay in the bug report rather than get lost in the list.  IF you file a bug report, post a link to the bug report in this thread (the bug # should be enough).

-Rob


On 06/27/2012 01:02 PM, shahbour wrote:

Hello After more testing between Mac and Windows this is what i got Crash Windows Mac Linux Without ErroHandler No Yes Yes With ErrorHandler (return false ) No Yes Yes With ErrorHandler (return true) No No No Before i was always returning false in IErrorHandler implementation because i only implemented for logging purpose but when i return true for the HandleError , the application fire the error and log it but never crash. Now i trying to debug the application under MonoDevelop and repreduce the error, below is what i got

System.InvalidOperationException: Cannot be changed after headers are sent. at System.Net.HttpListenerResponse.set_ContentType (System.String value) [0x00027] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System/System.Net/HttpListenerResponse.cs:107 at System.ServiceModel.Channels.Http.HttpStandaloneResponseInfo.set_ContentType (System.String value) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpContextInfo.cs:274 at System.ServiceModel.Channels.Http.HttpRequestContext.InternalReply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00046] in /private/tmp/monobuild/build/BUILD/mono-2.10.9

/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:140 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:101 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:96 at System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessRequest (IReplyChannel reply, System.ServiceModel.Channels.RequestContext rc) [0x0003b] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:601 at System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveRequestDone (IAsyncResult result) [0x0001a] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:575
Reproducing the error is very simple, just host any application under console app and in any service function put Thread.Sleep(..) to give you time to close the browser before it reply. Then call this function from any client and close it before getting the response. In my live program i don't put Thread.sleep it is only to give us time between calling the function and closing the browser. Under windows we got the bellow that don't crash the application error.Message "An operation was attempted on a nonexistent network connection" error.InnerException {"An operation was attempted on a nonexistent network connection"} System.Exception :q
{System.Net.HttpListenerException} error.ErrorCode 1229 BR Shahbour

View this message in context: Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer
Sent from the Mono - Dev mailing list archive at Nabble.com.


_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list










_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

shahbour
In reply to this post by Robert Wilkens
Hello Rob

Sorry ,I was busy today and couldn't either fill a bug or test what we discussed, during this weekend I will build two small console applications , one server and one client that reproduce the below problem and post it as bug , this way you can see exactly what I am talking about and reproduce it under you environment .

Currently I don't have the framework source compiled under my mac (where I develop) so I need to start preparing the environment for my self to be able to edit the framework and test it fast.

BR
Shahbour

From: "Rob Wilkens [via Mono]" <[hidden email]>
Date: Thursday, June 28, 2012 5:38 PM
To: Ali Shahbour <[hidden email]>
Subject: Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Re : The stacktrace below...

This occurs when an exception is raised in ChannelDispatcher.cs on line 601.  It tries to send back an exception message to the client here, i believe.  But when it does that, it uses the existing RequestContext. 

It's apparent that some data is apparently being sent, such as headers, on the RequestContext (rc) before we get to this exception.

If we're dealing with the case of SocketException, which caused us to fail mid-send on the RequestContext, perhaps, again, we shouldn't handle this like every other exception and not reply.  i.e. in the exception handler here, if exception is typeof(SocketException) don't reply, what might be more interesting, if this is reproducable, would be to - as debugging - print the exception message and/or stacktrace to the screen to see what exception caused this.

Did you file a bug report on this?  The discussion on this particular issue (or any particular bug) is probably better stored in the bug report comments than on the whole mailing list.  PLus comments like the above would stay in the bug report rather than get lost in the list.  IF you file a bug report, post a link to the bug report in this thread (the bug # should be enough).

-Rob


On 06/27/2012 01:02 PM, shahbour wrote:

Hello After more testing between Mac and Windows this is what i got Crash Windows Mac Linux Without ErroHandler No Yes Yes With ErrorHandler (return false ) No Yes Yes With ErrorHandler (return true) No No No Before i was always returning false in IErrorHandler implementation because i only implemented for logging purpose but when i return true for the HandleError , the application fire the error and log it but never crash. Now i trying to debug the application under MonoDevelop and repreduce the error, below is what i got

System.InvalidOperationException: Cannot be changed after headers are sent. at System.Net.HttpListenerResponse.set_ContentType (System.String value) [0x00027] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System/System.Net/HttpListenerResponse.cs:107 at System.ServiceModel.Channels.Http.HttpStandaloneResponseInfo.set_ContentType (System.String value) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpContextInfo.cs:274 at System.ServiceModel.Channels.Http.HttpRequestContext.InternalReply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00046] in /private/tmp/monobuild/build/BUILD/mono-2.10.9

/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:140 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:101 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:96 at System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessRequest (IReplyChannel reply, System.ServiceModel.Channels.RequestContext rc) [0x0003b] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:601 at System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveRequestDone (IAsyncResult result) [0x0001a] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:575
Reproducing the error is very simple, just host any application under console app and in any service function put Thread.Sleep(..) to give you time to close the browser before it reply. Then call this function from any client and close it before getting the response. In my live program i don't put Thread.sleep it is only to give us time between calling the function and closing the browser. Under windows we got the bellow that don't crash the application error.Message "An operation was attempted on a nonexistent network connection" error.InnerException {"An operation was attempted on a nonexistent network connection"} System.Exception :q
{System.Net.HttpListenerException} error.ErrorCode 1229 BR Shahbour

View this message in context: Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer
Sent from the Mono - Dev mailing list archive at Nabble.com.


_______________________________________________
Mono-devel-list mailing list
[hidden email]http://lists.ximian.com/mailman/listinfo/mono-devel-list



_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list



To unsubscribe from WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer, click here.
NAML
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

shahbour
This post was updated on .
In reply to this post by Robert Wilkens
TestWCFServer.zip

Hello Rob

I am attaching a simple application to demonstrate the error we are getting.

Unfortunately using the above example the server is not crashing but still it raise the error (note that in my live app , some time it do the same but crash more)

If you run the server like below you will notice the error

mono --debug --trace=N:nothing TestWCFServer.exe
Press enter to exit
[0xb0a7d000:] EXCEPTION handling: System.Net.Sockets.SocketException: Connection reset by peer
[0xb0a7d000:] EXCEPTION handling: System.IO.IOException: EndRead failure

To run the example just start the server , then start the client and before getting the result back from server close it (Ctrl+C)

I put a delay in the server to demonstrate the request over internet and to have time to close the client. After you close the client by small time the server will raise the above error .

Tomorrow I will change the client to a silver light application to simulate exactly my application because the server crash approximately every time I close the browser before getting the result in my live example.

BR
Shahbour
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Robert Wilkens
In reply to this post by shahbour

Thanks for being willing to write the sample code, I had started to read about WCF tonight, I'm familiar with the concepts (already was on most of them), but didn't yet get up to actual implementation (only got about 13 pages into the book when I received your message).  It's something i'll learn when i need to, and since you're writing the sample code, you're saving me (or whomever looks into it) some time, which makes it more likely it will be resolved for you in a reasonable amount of time.  Right now, this problem is interesting to me, so i'd like to look into it.  If I do look into it, I'll try to compare to Windows .NET behavior.

I'm going to remove the pull request until I have a chance to compare to .net behavior with actual code.

-Rob

On 06/28/2012 01:45 PM, shahbour wrote:
Hello Rob

Sorry ,I was busy today and couldn't either fill a bug or test what we discussed, during this weekend I will build two small console applications , one server and one client that reproduce the below problem and post it as bug , this way you can see exactly what I am talking about and reproduce it under you environment .

Currently I don't have the framework source compiled under my mac (where I develop) so I need to start preparing the environment for my self to be able to edit the framework and test it fast.

BR
Shahbour

From: "Rob Wilkens [via Mono]" <[hidden email]>
Date: Thursday, June 28, 2012 5:38 PM
To: Ali Shahbour <[hidden email]>
Subject: Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Re : The stacktrace below...

This occurs when an exception is raised in ChannelDispatcher.cs on line 601.  It tries to send back an exception message to the client here, i believe.  But when it does that, it uses the existing RequestContext. 

It's apparent that some data is apparently being sent, such as headers, on the RequestContext (rc) before we get to this exception.

If we're dealing with the case of SocketException, which caused us to fail mid-send on the RequestContext, perhaps, again, we shouldn't handle this like every other exception and not reply.  i.e. in the exception handler here, if exception is typeof(SocketException) don't reply, what might be more interesting, if this is reproducable, would be to - as debugging - print the exception message and/or stacktrace to the screen to see what exception caused this.

Did you file a bug report on this?  The discussion on this particular issue (or any particular bug) is probably better stored in the bug report comments than on the whole mailing list.  PLus comments like the above would stay in the bug report rather than get lost in the list.  IF you file a bug report, post a link to the bug report in this thread (the bug # should be enough).

-Rob


On 06/27/2012 01:02 PM, shahbour wrote:

Hello After more testing between Mac and Windows this is what i got Crash Windows Mac Linux Without ErroHandler No Yes Yes With ErrorHandler (return false ) No Yes Yes With ErrorHandler (return true) No No No Before i was always returning false in IErrorHandler implementation because i only implemented for logging purpose but when i return true for the HandleError , the application fire the error and log it but never crash. Now i trying to debug the application under MonoDevelop and repreduce the error, below is what i got

System.InvalidOperationException: Cannot be changed after headers are sent. at System.Net.HttpListenerResponse.set_ContentType (System.String value) [0x00027] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System/System.Net/HttpListenerResponse.cs:107 at System.ServiceModel.Channels.Http.HttpStandaloneResponseInfo.set_ContentType (System.String value) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpContextInfo.cs:274 at System.ServiceModel.Channels.Http.HttpRequestContext.InternalReply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00046] in /private/tmp/monobuild/build/BUILD/mono-2.10.9

/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:140 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:101 at System.ServiceModel.Channels.Http.HttpRequestContext.Reply (System.ServiceModel.Channels.Message msg) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpRequestContext.cs:96 at System.ServiceModel.Dispatcher.ListenerLoopManager.ProcessRequest (IReplyChannel reply, System.ServiceModel.Channels.RequestContext rc) [0x0003b] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:601 at System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveRequestDone (IAsyncResult result) [0x0001a] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:575
Reproducing the error is very simple, just host any application under console app and in any service function put Thread.Sleep(..) to give you time to close the browser before it reply. Then call this function from any client and close it before getting the response. In my live program i don't put Thread.sleep it is only to give us time between calling the function and closing the browser. Under windows we got the bellow that don't crash the application error.Message "An operation was attempted on a nonexistent network connection" error.InnerException {"An operation was attempted on a nonexistent network connection"} System.Exception :q
{System.Net.HttpListenerException} error.ErrorCode 1229 BR Shahbour

View this message in context: Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer
Sent from the Mono - Dev mailing list archive at Nabble.com.


_______________________________________________
Mono-devel-list mailing list
[hidden email]http://lists.ximian.com/mailman/listinfo/mono-devel-list



_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list



To unsubscribe from WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer, click here.
NAML


View this message in context: Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer
Sent from the Mono - Dev mailing list archive at Nabble.com.


_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list



_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
12
Loading...