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

shahbour shahbour at gmail.com
Wed Jun 27 14:14:14 UTC 2012


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 what forward to
ErrorHandler class. 

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

--
View this message in context: http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173p4650199.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list