qingruibin / jabber-net

Automatically exported from code.google.com/p/jabber-net
Other
0 stars 0 forks source link

TCP connection close by server leads to client crash #86

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

That is not easy. The problem occurs occationally. For that I have attached
the exception stacktrace below.

Maybe the following could work:

1. Use openfire server and pollute it with as many connections that it can
handle.
2. Openfire will drop further connections.

What is the expected output? What do you see instead?

What happens: jabber-net library throws unhandeled exception leading to
application crash
Expected: Exception is handled and connection establishment fails gracefully

What version of the product are you using? On what operating system?

jabber-net.dll 2.0.0.613 on Windows XP SP3. I had a look at the svn diffs.
There seam to be no changes regarding this issue since 613.

Please provide any additional information below.

2009-11-11 14:34:25,744 [5] ERROR JabberNetExtensions.XmppConnection.ERROR
(Socket):
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: Eine vorhandene Verbindung wurde vom
Remotehost geschlossen
bei System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags)
bei System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset,
Int32 size)
--- End of internal exception stacktrace ---
bei System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset,
Int32 size)
bei System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset,
Int32 count)
bei System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer,
AsyncProtocolRequest asyncRequest)
bei
System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken
message, AsyncProtocolRequest asyncRequest)
bei System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32
count, AsyncProtocolRequest asyncRequest)
bei System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst,
Byte[] buffer, AsyncProtocolRequest asyncRequest)
bei System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult
lazyResult)
bei System.Net.Security.SslStream.AuthenticateAsClient(String targetHost,
X509CertificateCollection clientCertificates, SslProtocols
enabledSslProtocols, Boolean checkCertificateRevocation)
bei bedrock.net.AsyncSocket.StartTLS()
2009-11-11 14:34:25,822 [5] ERROR
Starface.WinClient.StarfaceAppContext.ERROR (unbhandled Exception)
Terminating?: True Message: 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: Eine vorhandene
Verbindung wurde vom Remotehost geschlossen
bei System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags)
bei System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset,
Int32 size)
--- Ende der internen Ausnahmestapelüberwachung ---
bei System.Net.Security.SslState.CheckThrow(Boolean authSucessCheck)
bei System.Net.Security.SslStream.get_RemoteCertificate()
bei bedrock.net.AsyncSocket.get_RemoteCertificate()
bei
jabber.connection.SocketStanzaStream.bedrock.net.ISocketEventListener.OnConnect(
BaseSocket
sock)
bei bedrock.net.AsyncSocket.ExecuteConnect(IAsyncResult ar)
bei System.Net.LazyAsyncResult.Complete(IntPtr userToken)
bei System.Net.ContextAwareResult.CompleteCallback(Object state)
bei System.Threading.ExecutionContext.runTryCode(Object userData)
bei
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(
TryCode
code, CleanupCode backoutCode, Object userData)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
bei System.Net.ContextAwareResult.Complete(IntPtr userToken)
bei System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result,
IntPtr userToken)
bei System.Net.Sockets.Socket.ConnectCallback()
bei System.Net.Sockets.Socket.RegisteredWaitCallback(Object state, Boolean
timedOut)

Original issue reported on code.google.com by tilm...@googlemail.com on 11 Nov 2009 at 3:01

GoogleCodeExporter commented 8 years ago
Here is another one occuring at the same place in the code that is very easy to
reproduce.

Steps to reproduce:
1. Use openfire as server with SSL on 5223
2. Connect using SSL and wrong port 5222 (5223 works correctly of course)
3. jabber-net throws unhandled exception shown below

System.IO.IOException: Authentication failed as remote party has closed the 
transport
stream.
   bei System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes,
AsyncProtocolRequest asyncRequest)
   bei System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer,
AsyncProtocolRequest asyncRequest)
   bei System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken
message, AsyncProtocolRequest asyncRequest)
   bei System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count,
AsyncProtocolRequest asyncRequest)
   bei System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[]
buffer, AsyncProtocolRequest asyncRequest)
   bei System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
   bei System.Net.Security.SslStream.AuthenticateAsClient(String targetHost,
X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, 
Boolean 

checkCertificateRevocation)
   bei bedrock.net.AsyncSocket.StartTLS()

ERROR (unbhandled Exception) Terminating?: True Message: System.IO.IOException:
Authentication failed as remote party has closed the transport stream.
   bei System.Net.Security.SslState.CheckThrow(Boolean authSucessCheck)
   bei System.Net.Security.SslStream.get_RemoteCertificate()
   bei bedrock.net.AsyncSocket.get_RemoteCertificate()
   bei
jabber.connection.SocketStanzaStream.bedrock.net.ISocketEventListener.OnConnect(
BaseSocket
sock)
   bei bedrock.net.AsyncSocket.ExecuteConnect(IAsyncResult ar)
   bei System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   bei System.Net.ContextAwareResult.CompleteCallback(Object state)
   bei System.Threading.ExecutionContext.runTryCode(Object userData)
   bei
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(
TryCode
code, CleanupCode backoutCode, Object userData)
   bei System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state)
   bei System.Net.ContextAwareResult.Complete(IntPtr userToken)
   bei System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr
userToken)
   bei System.Net.Sockets.Socket.ConnectCallback()
   bei System.Net.Sockets.Socket.RegisteredWaitCallback(Object state, Boolean timedOut)
   bei
System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(Objec
t
state, Boolean timedOut)

Original comment by tilm...@googlemail.com on 11 Nov 2009 at 3:25

GoogleCodeExporter commented 8 years ago
Any news about this?

Original comment by gkoloc...@makingsense.com on 7 Aug 2013 at 8:25

GoogleCodeExporter commented 8 years ago
Any news about this? (2)

Original comment by da...@directip.com.br on 15 Sep 2014 at 8:26