Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean disconnect issue #2

Open
katterfelto opened this issue May 29, 2013 · 1 comment
Open

Clean disconnect issue #2

katterfelto opened this issue May 29, 2013 · 1 comment

Comments

@katterfelto
Copy link

I am trying to play with your example chat application. I'm running the server on ArchLinux using Mono/.Net 4.0 and for client browsers I've tried Qupzilla 1.4.3 (webkit v537.21) and Google Chrome (27.0.1453.94).

On the chat client web page when I click the disconnect button the server crashes with the following exception:

Unhandled Exception:
System.ArgumentException: Buffer is empty
Parameter name: buffers
at System.Net.Sockets.Socket.Send (IList1 buffers, SocketFlags socketFlags, System.Net.Sockets.SocketError& errorCode) [0x00000] in <filename unknown>:0 at System.Net.Sockets.Socket.Send (IList1 buffers, SocketFlags socketFlags) [0x00000] in :0
at System.Net.Sockets.Socket+Worker.SendGeneric () [0x00000] in :0

When this happens the OnDisconnect function is obviously not called for the context. If I just close the tab displaying the chat client the disconnections is handled cleanly. The following call in the demo causes the problem, Am I missing something>

$('#disconnect').bind('click', function(e) {
  e.preventDefault();
  AlchemyChatServer.Stop();
});
@durgacharanb
Copy link

I too have the same problem. when ever you tried to call websocket.close() from a client, it throws error. Seeing the log I could trace that the error is thrown while simaphore is tried to release in ReceiveEventArgs_Completed event handler under else condition. Sample code below.

if (context.ReceivedByteCount > 0)
{
context.Handler.HandleRequest(context);
context.ReceiveReady.Release();
StartReceive(context);
}
else
{
context.Disconnect();
context.ReceiveReady.Release();
}

06-23 16:01:58.748 F/ ( 5122): * Assertion at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/mono/mono/io-layer/wthreads.c:93, condition ok' not met 06-23 16:01:58.748 E/mono-rt ( 5122): Stacktrace: 06-23 16:01:58.748 E/mono-rt ( 5122): 06-23 16:01:58.748 E/mono-rt ( 5122): at <unknown> <0xffffffff> 06-23 16:01:58.748 E/mono-rt ( 5122): at (wrapper managed-to-native) System.Threading.NativeEventCalls.SetEvent_internal (intptr) <IL 0x00021, 0xffffffff> 06-23 16:01:58.748 F/libc ( 5122): Fatal signal 6 (SIGABRT) at 0x00001402 (code=-6), thread 5185 (xxxxpackage.namexxx) 06-23 16:01:58.748 E/mono-rt ( 5122): at System.Threading.EventWaitHandle.Set () <IL 0x00018, 0x000fb> 06-23 16:01:58.748 E/mono-rt ( 5122): at (wrapper remoting-invoke-with-check) System.Threading.EventWaitHandle.Set () <IL 0x00038, 0xffffffff> 06-23 16:01:58.748 E/mono-rt ( 5122): at System.Threading.SemaphoreSlim.Release (int) <IL 0x0005f, 0x001d7> 06-23 16:01:58.753 E/mono-rt ( 5122): at System.Threading.SemaphoreSlim.Release () <IL 0x00002, 0x00067> 06-23 16:01:58.753 E/mono-rt ( 5122): at Alchemy.WebSocketServer.ReceiveEventArgs_Completed (object,System.Net.Sockets.SocketAsyncEventArgs) [0x00077] in c:\Alchemy-Websockets-NetCookies\Alchemy-Websockets-NetCookies-master\src\Alchemy.NetCookies.Android\WebSocketServer.cs:331 06-23 16:01:58.753 F/ ( 5122): * Assertion at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/mono/mono/io-layer/wthreads.c:93, conditionok' not met
06-23 16:01:58.753 F/libc ( 5122): Fatal signal 6 (SIGABRT) at 0x00001402 (code=-6), thread 5222 (xxxxpackage.namexxx)
06-23 16:01:58.753 F/ ( 5122): * Assertion at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/mono/mono/io-layer/wthreads.c:93, condition ok' not met 06-23 16:01:58.753 F/ ( 5122): * Assertion at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/mono/mono/io-layer/wthreads.c:93, conditionok' not met
06-23 16:01:58.753 F/libc ( 5122): Fatal signal 6 (SIGABRT) at 0x00001402 (code=-6), thread 5241 (xxxxpackage.namexxx)
06-23 16:01:58.753 F/libc ( 5122): Fatal signal 6 (SIGABRT) at 0x00001402 (code=-6), thread 5221 (xxxxpackage.namexxx)
06-23 16:01:58.753 F/ ( 5122): * Assertion at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/mono/mono/io-layer/wthreads.c:93, condition ok' not met 06-23 16:01:58.753 F/ ( 5122): * Assertion at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/mono/mono/io-layer/wthreads.c:93, conditionok' not met
06-23 16:01:58.753 F/ ( 5122): * Assertion at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/mono/mono/io-layer/wthreads.c:93, condition ok' not met 06-23 16:01:58.753 F/ ( 5122): * Assertion at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/mono/mono/io-layer/wthreads.c:93, conditionok' not met
06-23 16:01:58.753 F/libc ( 5122): Fatal signal 6 (SIGABRT) at 0x00001402 (code=-6), thread 5240 (xxxxpackage.namexxx)
06-23 16:01:58.753 F/ ( 5122): * Assertion at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/mono/mono/io-layer/wthreads.c:93, condition ok' not met 06-23 16:01:58.753 F/libc ( 5122): Fatal signal 6 (SIGABRT) at 0x00001402 (code=-6), thread 5245 (xxxxpackage.namexxx) 06-23 16:01:58.753 F/ ( 5122): * Assertion at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/mono/mono/io-layer/wthreads.c:93, conditionok' not met
06-23 16:01:58.753 F/libc ( 5122): Fatal signal 6 (SIGABRT) at 0x00001402 (code=-6), thread 5248 (xxxxpackage.namexxx)
06-23 16:01:58.753 E/mono-rt ( 5122): at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted (System.Net.Sockets.SocketAsyncEventArgs) <IL 0x0001c, 0x000cb>
06-23 16:01:58.753 F/libc ( 5122): Fatal signal 6 (SIGABRT) at 0x00001402 (code=-6), thread 5242 (xxxxpackage.namexxx)
06-23 16:01:58.753 F/libc ( 5122): Fatal signal 6 (SIGABRT) at 0x00001402 (code=-6), thread 5246 (xxxxpackage.namexxx)
06-23 16:01:58.753 E/mono-rt ( 5122): at System.Net.Sockets.SocketAsyncEventArgs.ReceiveCallback (System.IAsyncResult) <IL 0x0003c, 0x00187>
06-23 16:01:58.753 E/mono-rt ( 5122): at System.Net.Sockets.SocketAsyncEventArgs.DispatcherCB (System.IAsyncResult) <IL 0x00039, 0x0019b>
06-23 16:01:58.753 E/mono-rt ( 5122): at (wrapper runtime-invoke) .runtime_invoke_void__this___object (object,intptr,intptr,intptr) <IL 0x00052, 0xffffffff>
06-23 16:01:58.753 E/mono-rt ( 5122):
06-23 16:01:58.753 E/mono-rt ( 5122): =================================================================
06-23 16:01:58.753 E/mono-rt ( 5122): Got a SIGSEGV while executing native code. This usually indicates
06-23 16:01:58.753 E/mono-rt ( 5122): a fatal error in the mono runtime or one of the native libraries
06-23 16:01:58.753 E/mono-rt ( 5122): used by your application.
06-23 16:01:58.753 E/mono-rt ( 5122): =================================================================

If you could fix this issue, plz post the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants