function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfchesssfchess 

An existing connection was forcibly closed by the remote host

Has anyone encountered this error. I get it very random. It works sometimes and other times I get this error. The server that I am using to connect to salesforce.com is behind an Array Networks SSL accelerator.
Here is a stack trace of the error I get.

An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
   at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.TlsStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
   --- End of inner exception stack trace ---
   at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at GotMarketing.Campaigner2F.SFConnector.sforce.SforceService.describeSObject(String sObjectType) in C:\PROJECTS\GOT2005\CRM\Code\CRM\GotMarketing.Campaigner2F.SFConnector\Web References\sforce\Reference.cs:line 269
   at GotMarketing.Campaigner2F.SFConnector.SalesForceConnector.DescribeObject(String tableName)
james_galindojames_galindo
I've seen this error a few times over the course of several months on a mult-threaded C# component that I wrote to upsert data in SF. I never found the problem and it was very rare (less than a handful in over millions of upserts over several months). I just chalked it up to a killed session in SF side or network drop. Sorry I couldn't help much.
sfchesssfchess

Thanks for the reply. Unfortunate I get it more often, maybe twice a day and it happens on the production server and never on the testing one. Our production server is behind an array network SSL accelerator and firewall. Still trying to put my finger on the problem.

 

james_galindojames_galindo
Sounds like load or bandwidth issues if it's only in production, unless you can mimic production loads.  Are you caching the connection to SF or re-connecting each time?  Is it a multi-threaded process handing the connection and processing?
sfchesssfchess

It started happening when it went 1st into the production. The loads were not huge but multiple upserts where happening at the same time. It is multi threaded and each thread opens a new connection to a different salesforce.com organization. To add this server is also the web hosting server. The testing environment has the same settings.