user1584120
user1584120

Reputation: 1261

SocketException (0x80004005): An existing connection was forcibly closed by the remote host

Hoping somebody can help with this exception. Our client app can spawn up to 3 server apps (new processes) and communicates with each through TCP. These in turn spawn a jvm when prompted (server app essentially a wrapper for communicating to jvm through shared memory). When I set the memory on each jvm to be about 25gb (I have 8gb ram) it will not run any of the 3 server applications and throws the above exception. When I set it be 10gb it will run one of them but throw that exception when I try start the second jvm. The exception appears to happen when I try and start the jvm (prints logging statement just before it makes first java call) however this exception is only captured on the client side. I'm wondering if this is a stackoverflow on the server side?

12:58:33 : Exception : System.Net.Sockets.SocketException (0x80004005): An existing connection was forcibly closed by the remote host
Server stack trace: 
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Runtime.Remoting.Channels.SocketStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Runtime.Remoting.Channels.SocketHandler.ReadFromSocket(Byte[] buffer, Int32 offset, Int32 count)
at System.Runtime.Remoting.Channels.SocketHandler.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.Runtime.Remoting.Channels.SocketHandler.ReadAndMatchFourBytes(Byte[] buffer)
at System.Runtime.Remoting.Channels.Tcp.TcpSocketHandler.ReadVersionAndOperation(UInt16& operation)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Isl.RemotableObjects.ServerMgmtIF.initialiseApp(String licenseSource, OceanPluginTypeEnum type)
at Isl.OceanShared.Server.initialise(String licenseSource)
12:58:33 : Stacktrace: 
Server stack trace: 
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size,SocketFlags socketFlags)
at System.Runtime.Remoting.Channels.SocketStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Runtime.Remoting.Channels.SocketHandler.ReadFromSocket(Byte[] buffer, Int32 offset, Int32 count)
at System.Runtime.Remoting.Channels.SocketHandler.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.Runtime.Remoting.Channels.SocketHandler.ReadAndMatchFourBytes(Byte[] buffer)
at System.Runtime.Remoting.Channels.Tcp.TcpSocketHandler.ReadVersionAndOperation(UInt16& operation)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Isl.RemotableObjects.ServerMgmtIF.initialiseApp(String licenseSource, OceanPluginTypeEnum type)
at Isl.OceanShared.Server.initialise(String licenseSource)
12:58:33 : Message   : StackTrace: 
Server stack trace: 
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Runtime.Remoting.Channels.SocketStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Runtime.Remoting.Channels.SocketHandler.ReadFromSocket(Byte[] buffer, Int32 offset, Int32 count)
at System.Runtime.Remoting.Channels.SocketHandler.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.Runtime.Remoting.Channels.SocketHandler.ReadAndMatchFourBytes(Byte[] buffer)
at System.Runtime.Remoting.Channels.Tcp.TcpSocketHandler.ReadVersionAndOperation(UInt16& operation)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Isl.RemotableObjects.ServerMgmtIF.initialiseApp(String licenseSource, OceanPluginTypeEnum type)
at Isl.OceanShared.Server.initialise(String licenseSource)

Upvotes: 2

Views: 18459

Answers (1)

Haney
Haney

Reputation: 34802

This will happen when, as the exception implies, the remote host (server) closes the connection unexpectedly. This can be due to a multitude of reasons, but typically is due to an unhandled exception on the server side. Investigate the server code and go from there.

Upvotes: 3

Related Questions