<div>Hello Rob</div><div><br></div><div>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 .</div><div><br></div><div>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.</div><div><br></div><div>BR</div><div>Shahbour</div><div><br></div><span id="OLK_SRC_BODY_SECTION"><div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt"><span style="font-weight:bold">From: </span> "Rob Wilkens [via Mono]" <<a href="/user/SendEmail.jtp?type=node&node=4650233&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>><br><span style="font-weight:bold">Date: </span> Thursday, June 28, 2012 5:38 PM<br><span style="font-weight:bold">To: </span> Ali Shahbour <<a href="/user/SendEmail.jtp?type=node&node=4650233&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a>><br><span style="font-weight:bold">Subject: </span> Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer<br></div><div><br></div>

        

    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">


    <div class="moz-cite-prefix">Re : The stacktrace below...<br>
      <br>
      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.  <br>
      <br>
      It's apparent that some data is apparently being sent, such as
      headers, on the RequestContext (rc) before we get to this
      exception.<br>
      <br>
      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.<br>
      <br>
      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).<br>
      <br>
      -Rob<br>
      <br>
      <br>
      On 06/27/2012 01:02 PM, shahbour wrote:<br>
    </div>
    <blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #CCCCCC;padding:0 1em" cite="mid:1340816552773-4650210.post@n4.nabble.com" type="cite">
      <h4>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 </h4>
      <h6>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</h6>
    </blockquote>
    <br>
    <blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #CCCCCC;padding:0 1em" cite="mid:1340816552773-4650210.post@n4.nabble.com" type="cite">
      <h6>/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</h6>
      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</blockquote>
    <blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #CCCCCC;padding:0 1em" cite="mid:1340816552773-4650210.post@n4.nabble.com" type="cite">{System.Net.HttpListenerException}
      error.ErrorCode 1229
      BR
      Shahbour <br>
      <hr align="left" width="300">
      View this message in context: <a moz-do-not-send="true" href="http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173p4650210.html" target="_top" rel="nofollow" link="external">Re:
        WCF Fail with System.Net.Sockets.SocketException: Connection
        reset by peer</a><br>
      Sent from the <a moz-do-not-send="true" href="http://mono.1490590.n4.nabble.com/Mono-Dev-f1517221.html" target="_top" rel="nofollow" link="external">Mono
        - Dev mailing list archive</a> at Nabble.com.<br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Mono-devel-list mailing list
<a href="/user/SendEmail.jtp?type=node&node=4650228&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a><a class="moz-txt-link-freetext" href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" target="_top" rel="nofollow" link="external">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a></pre>
    </blockquote>
    <br>
    <br>


<br>_______________________________________________
<br>Mono-devel-list mailing list
<br><a href="/user/SendEmail.jtp?type=node&node=4650228&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a><br><a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" target="_top" rel="nofollow" link="external">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><br>
        
        <br>
        <br>
        <hr noshade="noshade" size="1" color="#cccccc">
        <div style="color:#444; font: 12px tahoma,geneva,helvetica,arial,sans-serif;">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173p4650228.html" target="_top" rel="nofollow" link="external">http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173p4650228.html</a>
        </div>
        <div style="color:#666; font: 11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer, <a href="" target="_top" rel="nofollow" link="external">click here</a>.<br>
                <a href="http://mono.1490590.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_top" link="external">NAML</a>
        </div></span>

        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173p4650233.html">Re: WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer</a><br/>
Sent from the <a href="http://mono.1490590.n4.nabble.com/Mono-Dev-f1517221.html">Mono - Dev mailing list archive</a> at Nabble.com.<br/>