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

Calling websocket.close() from client, causes server to crash[Fatal signal 6 (SIGABRT)] #109

Open
durgacharanb opened this issue Jun 23, 2015 · 0 comments

Comments

@durgacharanb
Copy link

I have posted the issue @ Olivine-Labs/Alchemy-Websockets-Example#2 .
But looks like that is not the right thread. Posting it here.

I have websocket client running in Safari in iPad(iOS v7.1.2) which tries to disconnect itself from server by calling websocket.close(). On server side I get unhandled exception and application crashes.

Unhandled Exception:
06-23 16:01:58.723 E/mono ( 5122): System.ArgumentException: Buffer is empty
06-23 16:01:58.723 E/mono ( 5122): Parameter name: buffers
06-23 16:01:58.723 E/mono ( 5122): at System.Net.Sockets.Socket.Send (IList1 buffers, SocketFlags socketFlags, System.Net.Sockets.SocketError& errorCode) [0x00000] in <filename unknown>:0 06-23 16:01:58.723 E/mono ( 5122): at System.Net.Sockets.Socket.Send (IList1 buffers, SocketFlags socketFlags) [0x00000] in :0
06-23 16:01:58.723 E/mono ( 5122): at System.Net.Sockets.Socket+Worker.SendGeneric () [0x00000] in :0
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


Further more if I look at the stack trace, 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();
}


Stack Trace

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 <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)
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)
06-23 16:01:58.753 E/mono-rt ( 5122): at System.Net.Sockets.SocketAsyncEventArgs.DispatcherCB (System.IAsyncResult)
06-23 16:01:58.753 E/mono-rt ( 5122): at (wrapper runtime-invoke) .runtime_invoke_void__this___object (object,intptr,intptr,intptr)
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): =================================================================

I am not sure if the way I am handling is not right. Is there any workaround or fix, plz let me know.

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

1 participant