<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix"><br>
      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.<br>
      <br>
      The Exception being raised is appropriate, but the handling of it
      in BeginTryReceiveRequest is more of an issue, I believe.<br>
      <br>
      -Rob<br>
      <br>
      On 06/27/2012 08:52 AM, Rob Wilkens wrote:<br>
    </div>
    <blockquote cite="mid:4FEB021D.3020401@gmail.com" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">By the way, I noticed the bottom of
        the stack was similar to this earlier error message we
        corrected:<br>
        <meta http-equiv="content-type" content="text/html;
          charset=ISO-8859-1">
        <a moz-do-not-send="true"
href="http://mono.1490590.n4.nabble.com/Exception-at-System-ServiceModel-Channels-Http-HttpReplyChannel-TryReceiveRequest-td4649878.html">http://mono.1490590.n4.nabble.com/Exception-at-System-ServiceModel-Channels-Http-HttpReplyChannel-TryReceiveRequest-td4649878.html</a><br>
        <br>
        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.<br>
        <br>
        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.<br>
        <br>
        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.<br>
        <br>
        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.<br>
        <br>
        On 06/26/2012 08:49 AM, shahbour wrote:<br>
      </div>
      <blockquote cite="mid:1340714962865-4650173.post@n4.nabble.com"
        type="cite">
        <pre wrap="">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: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173.html">http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173.html</a>
Sent from the Mono - Dev mailing list archive at Nabble.com.
_______________________________________________
Mono-devel-list mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Mono-devel-list@lists.ximian.com">Mono-devel-list@lists.ximian.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.ximian.com/mailman/listinfo/mono-devel-list">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a>
</pre>
      </blockquote>
      <br>
      <br>
    </blockquote>
    <br>
    <br>
  </body>
</html>