mklabs / tiny-lr

tiny livereload

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Investigate "handle socket error to prevent possible app crash, such as ECONNRESET"

mklabs opened this issue · comments

See if we should rollback this commit to limit the described behavior in

303f95c#commitcomment-19591161

@matthewmueller I confirm that the error is caught by my pr.

However, different versions of node has different behavior about Error: read ECONNRESET (an error occured when client abruptly closed the connection of TCP.)

When I push the code, my console sometimes output the message:

Error: read ECONNRESET
    at exports._errnoException (util.js)
    at TCP.onread (net.js)

It's annoying and you can't control it. (Um, maybe you can listen to uncaughtexception).

I tested on node@6.9.0, the ECONNRESET seems be dropped (wont output) defaultly?

By the way, maybe you can ignore it by filter the error with:

if (error.code !== 'ECONNRESET') { console.log(error) }

because the error is like

{ Error: read ECONNRESET
       at exports._errnoException (util.js:1026:11)
       at TCP.onread (net.js:569:26) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' } }

I don't think this will lead to tons of the error. When I test, one tab of chrome only lead to one error.

Thanks @creeperyang for detailed explanation.

I need to test it further, but maybe we can silent out ECONNRESET type of errors

@mklabs yeah, you're right. It seems inevitable to get this error in our case.

fwiw, this isn't an issue at all if i downgrade to "tiny-lr": "0.2.1"

I keep getting this error, Node 6.9.1.

Could be wrong, but ignoring the error seems like a bandaid. If this error was inevitable, wouldn't it affect all websocket servers?

Don't know if it is related, but with version 1.0.2 I sometimes get:

console - ... Uhoh. Got error undefined ...

Don't seem to get it with version 1.0.3 (for now). I was trying to check if something was changed in 1.0.3 which could explain it.

Only noticed a bug in one of the latest pr's: https://github.com/mklabs/tiny-lr/pull/114/files#diff-c945a46d13b34fcaff544d966cffcabaR157

Function apply expects an array, not an Error object (function call a comma separated list)

@asgoth yeah, a silly mistake. Really sorry for it.