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

throw new Error('Socket is not writable'); #555

Closed
tommypowerz opened this issue Oct 2, 2011 · 12 comments
Closed

throw new Error('Socket is not writable'); #555

tommypowerz opened this issue Oct 2, 2011 · 12 comments
Labels
bug Something isn't working

Comments

@tommypowerz
Copy link

stable node and socket 0.8.4

seems like it happens during heartbeat...

is there a way to catch this error on my side?

thanks for help


net.js:391
throw new Error('Socket is not writable');
^
Error: Socket is not writable
at Socket._writeOut (net.js:391:11)
at Socket.write (net.js:377:17)
at WebSocket.write (/var/www/web17/chatserver/node_modules/socket.io/lib/transports/websocket/hybi-07-12.js:130:17)
at WebSocket.packet (/var/www/web17/chatserver/node_modules/socket.io/lib/transport.js:515:15)
at WebSocket.heartbeat (/var/www/web17/chatserver/node_modules/socket.io/lib/transport.js:330:10)
at Object._onTimeout (/var/www/web17/chatserver/node_modules/socket.io/lib/transport.js:301:12)
at Timer.callback (timers.js:83:39)

Program exited with code 01.

@einaros
Copy link
Contributor

einaros commented Oct 2, 2011

Are you able to reproduce this reliably?

@tommypowerz
Copy link
Author

yes.. just need to run my server.. and wait... it takes some hours....

by the way i can see tons of this one:
warn - client not handshaken client should reconnect

tbey come so fast, that you cannot see the "valid log action"

@einaros
Copy link
Contributor

einaros commented Oct 2, 2011

Could you pull my fork, at http://github.com/einaros/socket.io, and see if you still get the same errors? There are a few changes there (about to be merged with the main fork) which could improve stability.

@tommypowerz
Copy link
Author

ok... on the next crash, i will get your version of code......

thanks guys...

@tommypowerz
Copy link
Author

now it crashed again... will get your source now.....

but this time with a different message:

assert.js:93
throw new assert.AssertionError({
^
AssertionError: true == false
at Timer.callback (timers.js:82:11)

Program exited with code 01.

@tommypowerz
Copy link
Author

i run node v0.412 and this http://github.com/einaros/socket.io

my server is getting stabler... sometimes it crashes due to segmantion faults:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fd0a4cf36f0 (LWP 24039)]
0x000000000062a873 in v8::internal::FlexibleBodyVisitor::Visit ()
Current language: auto; currently asm

and sometimes i had this error: can this somehow be catched? i cannot find a send or emit without try/catch in my code

net.js:391
throw new Error('Socket is not writable');
^
Error: Socket is not writable
at Socket._writeOut (net.js:391:11)
at Socket.write (net.js:377:17)
at WebSocket.write (/var/www/web17/chatserver/node_modules/socket.io/lib/transports/websocket/hybi-07-12.js:180:17)
at WebSocket.packet (/var/www/web17/chatserver/node_modules/socket.io/lib/transport.js:515:15)
at WebSocket.heartbeat (/var/www/web17/chatserver/node_modules/socket.io/lib/transport.js:330:10)

at Object._onTimeout (/var/www/web17/chatserver/node_modules/socket.io/lib/transport.js:301:12)
at Timer.callback (timers.js:83:39)

Program exited with code 01.

@3rd-Eden
Copy link
Contributor

@tommypowerz you should always add a http://nodejs.org/docs/v0.4.12/api/process.html#event_uncaughtException_ also does this still occur in socket.io 0.8.5

@jasonwebster
Copy link

Just wanted to note that the SSL equivalent of this trace (for the original issue is):

        tls.js:70
            throw new Error('CryptoStream is not writable');
                  ^
        Error: CryptoStream is not writable
            at CleartextStream.write (tls.js:70:11)
            at WebSocket.write (/.../vendor/socket.io-node/lib/transports/websocket/hybi-07-12.js:130:17)
            at WebSocket.onDispatch (/.../vendor/socket.io-node/lib/transport.js:222:10)
            at Manager.onDispatch (/.../vendor/socket.io-node/lib/manager.js:342:31)
            at SocketNamespace.packet (/.../vendor/socket.io-node/lib/namespace.js:156:16)
            at Socket.packet (/.../vendor/socket.io-node/lib/socket.js:199:56)
            at Socket.emit (/.../socket.io-node/lib/socket.js:351:15)
            at /.../server.js:159:24
            at Client.get (/.../vendor/socket.io-node/lib/stores/memory.js:86:3)
            at Socket.get (/.../vendor/socket.io-node/lib/socket.js:248:14)

I'm still seeing this on 0.8.5, although I think the line numbers are slightly different (from the above snippet).

Is there a procedure in place for re-establishing the connection (or whatever is the appropriate action) when it's determined a socket isn't writable? I know there's error handling in place in the Transport for generic socket errors, but it's obviously not catching this. It seems like it may actually be an issue with node, letting an uncaught exception bubble up rather than dispatching an error event. Then again, I'm no where near familiar enough with the code base (yet) to speak to what's the intention/responsibility of that handler.

@jasonwebster
Copy link

Actually, this is probably a dupe of #512.

@stewartl60
Copy link

Experiencing the same issue intermittently:

net.js:391
throw new Error('Socket is not writable');
^
Error: Socket is not writable
at Socket._writeOut (net.js:391:11)
at Socket.write (net.js:377:17)
at WebSocket.write

Node Setup


Node v0.4.12
Socket.io v0.8.5

The logs are also showing a very high volume of:

39m client not handshaken client should reconnect

Any feedback on how to resolve?

@einaros
Copy link
Contributor

einaros commented Oct 18, 2011

I'll fix this for the websocket transports tomorrow.

@stewartl60
Copy link

Thanks einaros, that will be amazing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants