[Mono-list] An existing connection was forcibly closed by the remote host (SocketException - Service Stack)

mauzik mauzik at centrum.cz
Sat Nov 2 21:08:03 UTC 2013


Hi, I am trying to test Service Stack (HTTP) on Mono. I wrote test code which
send n-times (actually n is 1000)request to server. It runs well on .NET,
but on Mono there are exceptions. I tried to run it repeatedly and from 1000
requests to server there are about 30 requests (sometimes only 5 requests)
unsuccessful. I discovered that unsuccessful request are not in ordered one
by one. It means that for example first failure is in request NO. 10, second
in request NO. 150, etc. I also set timeout client. Has anybody same or
similar issue? 


Code:
for (int i = 0; i<interval; i++)
                    {
                        try{
                            service = Client.GetServiceStackClient();
                            service.Timeout = new TimeSpan(0, 10, 0);

                        list.Add(service.Send(new GetPerson()));
                            service.Dispose();
                       // Thread.Sleep(250);
                        }
                        catch(WebException ex)
                        {
                           
swritter.WriteLine(String.Format("exception: {0}, i: {1}",ex,i));
                        }
                    }



Exception:

exception: System.Net.WebException: Error getting response stream
(ReadDone1): ReceiveFailure ---> System.IO.IOException: EndRead failure --->
System.Net.Sockets.SocketException: An existing connection was forcibly
closed by the remote host.

  at System.Net.Sockets.Socket.EndReceive (IAsyncResult result) [0x0002d] in
C:\cygwin\sources\mono\mcs\class\System\System.Net.Sockets\Socket_2_1.cs:1816 
  at System.Net.Sockets.NetworkStream.EndRead (IAsyncResult ar) [0x0002f] in
C:\cygwin\sources\mono\mcs\class\System\System.Net.Sockets\NetworkStream.cs:326 
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.EndRead (IAsyncResult ar) [0x0003d] in
C:\cygwin\sources\mono\mcs\class\System\System.Net.Sockets\NetworkStream.cs:328 
  at System.Net.WebConnection.ReadDone (IAsyncResult result) [0x0002a] in
C:\cygwin\sources\mono\mcs\class\System\System.Net\WebConnection.cs:512 
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult)
[0x0005e] in
C:\cygwin\sources\mono\mcs\class\System\System.Net\HttpWebRequest.cs:949 
  at System.Net.HttpWebRequest.GetResponse () [0x0000e] in
C:\cygwin\sources\mono\mcs\class\System\System.Net\HttpWebRequest.cs:957 
  at ServiceStack.ServiceClient.Web.ServiceClientBase.Send[Person]
(System.Object request) [0x00000] in <filename unknown>:0 , i: 114
exception: System.Net.WebException: Error getting response stream
(ReadDone2): ReceiveFailure ---> System.Exception:    at
System.Net.WebConnection.HandleError(WebExceptionStatus st, System.Exception
e, System.String where)
   at System.Net.WebConnection.ReadDone(IAsyncResult result)
  at System.Net.WebConnection.HandleError (WebExceptionStatus st,
System.Exception e, System.String where) [0x0003a] in
C:\cygwin\sources\mono\mcs\class\System\System.Net\WebConnection.cs:482 
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult)
[0x0005e] in
C:\cygwin\sources\mono\mcs\class\System\System.Net\HttpWebRequest.cs:949 
  at System.Net.HttpWebRequest.GetResponse () [0x0000e] in
C:\cygwin\sources\mono\mcs\class\System\System.Net\HttpWebRequest.cs:957 
  at ServiceStack.ServiceClient.Web.ServiceClientBase.Send[Person]
(System.Object request) [0x00000] in <filename unknown>:0



--
View this message in context: http://mono.1490590.n4.nabble.com/An-existing-connection-was-forcibly-closed-by-the-remote-host-SocketException-Service-Stack-tp4661237.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list