Random "Error: socket hang up"

0 views
Skip to first unread message

Jakub Szwacz

unread,
Oct 22, 2013, 3:44:29 AM10/22/13
to node-...@googlegroups.com
Hi!

I'm getting sometimes following error in node-webkit, which breaks execution of the whole application:

Uncaught node.js Error

 

Error: socket hang up
    at createHangUpError (http.js:1473:15)
    at Socket.socketCloseListener (http.js:1523:23)
    at Socket.EventEmitter.emit (events.js:117:20)
    at TCP.close (net.js:466:12)



This error emerges completely randomly, obout once every 100 node-webkit launches on my Windows7 machine.

Does someone had similar issues or even managed to diagnose it?

Jakub

Taher Ghadiali

unread,
Oct 23, 2013, 3:57:05 AM10/23/13
to node-...@googlegroups.com
I dont know about "socket hang up", but looks like you have not added a handler for the "error" event on the socket. If this is missing, node will throw an exception.

socket.on("error", function(){})

You can also suppress all exceptions by handling uncaughtExceptions on process object. This will prevent app from crashing, but might not be good as the app could be in any unknown state.

(Had read about this earlier on stack overflow but dont remember the topic)


--
You received this message because you are subscribed to the Google Groups "node-webkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-webkit...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jakub Szwacz

unread,
Oct 24, 2013, 2:47:49 AM10/24/13
to node-...@googlegroups.com
Thanks Taher. Hah, it looks like you are totally right. I'm using request library so I was certain the lib handles errors correctly for me, and this issue is something more quirky. I was wrong :).

Jakub
Reply all
Reply to author
Forward
0 new messages