[Mono-dev] WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer
Rob Wilkens
robwilkens at gmail.com
Wed Jun 27 13:16:53 UTC 2012
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
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120627/52a73a9b/attachment.html>
More information about the Mono-devel-list
mailing list