[Mono-dev] WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

Rob Wilkens robwilkens at gmail.com
Wed Jul 11 10:32:18 UTC 2012


This is a different problem, but it is related : It looks like i need to
handle IOException as well (in, at minimum, BeginTryReceiveRequest where
i was handling the other exceptions), i don't think that was in the
earlier stack traces, should be easy enough to catch and deal with. I'll
post in the bug report when i have that updated.

-Rob

On 07/11/2012 05:08 AM, Ali Shahbour wrote:
> Hello
>
> Unfortunately the code still crashed with the below trace
>
> [0x7ff24dc45700:] EXCEPTION handling: System.ObjectDisposedException: The
> object was used after being disposed.
> [0x7ff24dc45700:] EXCEPTION handling: System.IO.IOException: EndRead
> failure
> [0x7ff24de46700:] EXCEPTION handling: System.ObjectDisposedException: The
> object was used after being disposed.
> [0x7ff24de46700:] EXCEPTION handling: System.IO.IOException: Read failure
> [0x7ff24de46700:] EXCEPTION handling: System.IO.IOException: Read failure
>
> Unhandled Exception: System.IO.IOException: Read failure --->
> System.ObjectDisposedException: The object was used after being disposed.
>   at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32
> offset, Int32 size, SocketFlags flags) [0x0007e] in
> /usr/local/src/monorob/mono/mcs/class/System/System.Net.Sockets/Socket.cs:1
> 584
>   at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
> offset, Int32 size) [0x00067] in
> /usr/local/src/monorob/mono/mcs/class/System/System.Net.Sockets/NetworkStre
> am.cs:378
>   --- End of inner exception stack trace ---
>   at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
> offset, Int32 size) [0x00078] in
> /usr/local/src/monorob/mono/mcs/class/System/System.Net.Sockets/NetworkStre
> am.cs:380
>   at System.Net.RequestStream.Read (System.Byte[] buffer, Int32 offset,
> Int32 count) [0x0003c] in
> /usr/local/src/monorob/mono/mcs/class/System/System.Net/RequestStream.cs:14
> 1
>   at System.IO.StreamReader.ReadBuffer () [0x00012] in
> /usr/local/src/monorob/mono/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/monorob/mono/mcs/class/corlib/System.IO/StreamReader.cs:471
>   at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x0004f] in
> /usr/local/src/monorob/mono/mcs/class/System.XML/System.Xml/XmlTextReader.c
> s:1197
>   at Mono.Xml2.XmlTextReader.PeekChar () [0x00047] in
> /usr/local/src/monorob/mono/mcs/class/System.XML/System.Xml/XmlTextReader.c
> s:1151
>   at Mono.Xml2.XmlTextReader.ReadContent () [0x0003f] in
> /usr/local/src/monorob/mono/mcs/class/System.XML/System.Xml/XmlTextReader.c
> s:1251
>   at Mono.Xml2.XmlTextReader.Read () [0x00141] in
> /usr/local/src/monorob/mono/mcs/class/System.XML/System.Xml/XmlTextReader.c
> s:577
>   at System.Xml.XmlTextReader.Read () [0x0006b] in
> /usr/local/src/monorob/mono/mcs/class/System.XML/System.Xml/XmlTextReader2.
> cs:566
>   at System.Xml.XmlSimpleDictionaryReader.Read () [0x00000] in
> /usr/local/src/monorob/mono/mcs/class/System.Runtime.Serialization/System.X
> ml/XmlSimpleDictionaryReader.cs:253
>   at System.Xml.XmlReader.MoveToContent () [0x00050] in
> /usr/local/src/monorob/mono/mcs/class/System.XML/System.Xml/XmlReader.cs:61
> 0
>   at System.ServiceModel.Channels.XmlReaderMessage.ReadEnvelopeStart ()
> [0x00000] in 
> /usr/local/src/monorob/mono/mcs/class/System.ServiceModel/System.ServiceMod
> el.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/monorob/mono/mcs/class/System.ServiceModel/System.ServiceMod
> el.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/monorob/mono/mcs/class/System.ServiceModel/System.ServiceMod
> el.Channels/Message.cs:427
>   at System.ServiceModel.Channels.TextMessageEncoder.ReadMessage
> (System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String
> contentType) [0x00011] in
> /usr/local/src/monorob/mono/mcs/class/System.ServiceModel/System.ServiceMod
> el.Channels/TextMessageEncoder.cs:87
>   at System.ServiceModel.Channels.Http.HttpReplyChannel.CreatePostMessage
> (System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x0009e] in
> /usr/local/src/monorob/mono/mcs/class/System.ServiceModel/System.ServiceMod
> el.Channels.Http/HttpReplyChannel.cs:229
>   at System.ServiceModel.Channels.Http.HttpReplyChannel.TryReceiveRequest
> (TimeSpan timeout, System.ServiceModel.Channels.RequestContext& context)
> [0x000aa] in 
> /usr/local/src/monorob/mono/mcs/class/System.ServiceModel/System.ServiceMod
> el.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/monorob/mono/mcs/class/System.ServiceModel/System.ServiceMod
> el.Channels/ReplyChannelBase.cs:128
>
>
> I didn't have time yet to check it , but wanted to share it with you.
>
> BR
> Shabour
>
>
>
>
>
> On 7/9/12 2:32 PM, "Robert Wilkens" <robwilkens at gmail.com> wrote:
>
>> Just want to update the list in case anyone was followingŠ
>>
>> I was able to reproduce some of the problems, and came up with some work
>> arounds that wouldn't crash the WCF server on client disconnect (windows
>> doesn't crash the server), at least for the issues i was able to
>> reproduce.  I tried to keep the fixes confined so they have minimal
>> impact on things which were unrelated, for example, i catch the
>> exceptions where they were causing failures, but where they were not
>> causing failures, in general i tried to let the exception flow through so
>> it could be caught by something more appropriate, such as the user
>> program itself.
>>
>> The person who reported them originally is going to try these changes on
>> a live server over the next few days to see if it helps matters.  They
>> are in a pull request, but i am not in a hurry for them to be pulled,
>> because among other things, i don't generally use WCF and these issue
>> don't affect me.  They were just interesting to me.
>>
>> I have personal issues (it's not me who is having the problem, but i need
>> to deal with it), unrelated to mono, which have been holding me up from
>> trying to do more work with mono the last several days.  I don't want to
>> get into them here.  Depending on how things go, i might not touch mono
>> source again until some time next month.  Please don't take this as a
>> lack of interest from me -- I've very much enjoyed being active here,
>> both learning and contributing (when i do it right).  Will try to keep up
>> with the mailing list during this time, and if a problem really interests
>> me, i might find time to get involved.
>>
>> -Rob
>>
>> On Jun 29, 2012, at 6:15 AM, Robert Wilkens wrote:
>>
>>> Thanks - I'm on my mac now and trying to set up mono develop..  It
>>> appears to have an easier time with the alpha version of mono, but then
>>> it said 'update available' and downloaded an older version then stopped
>>> working again, I'll get it soon.  Otherwise, I'll be on my linux laptop
>>> soon, just wanted to set up a second machine to test on since networking
>>> code sometimes works better when it's not just localhost to localhost.
>>>
>>> -Rob
>>>
>>> On Jun 28, 2012, at 6:35 PM, shahbour wrote:
>>>
>>>> http://mono.1490590.n4.nabble.com/file/n4650235/TestWCFServer.zip
>>>> 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 it. After you close it by small time the
>>>> application 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
>>>>
>>>> --
>>>> View this message in context:
>>>> http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-Socke
>>>> tException-Connection-reset-by-peer-tp4650173p4650235.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
>>> _______________________________________________
>>> Mono-devel-list mailing list
>>> Mono-devel-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>




More information about the Mono-devel-list mailing list