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

Problematic socket.parser.resume() error #3508

Closed
binarybehemoth opened this issue Oct 24, 2015 · 21 comments
Closed

Problematic socket.parser.resume() error #3508

binarybehemoth opened this issue Oct 24, 2015 · 21 comments
Labels
http Issues or PRs related to the http subsystem.

Comments

@binarybehemoth
Copy link

This bug has been crashing my node.js server for the past one week. On average it seems to occur every 12 hours. Normally when an error occurs in node.js, node.js will tell you the line number and your source file that lead to the error. However, this error is so weird that it does not let me know where the error originates from in my source codes. I can't even find _http_server.js within the entire project and node modules. As such, I have been unable to pinpoint and eliminate the bug.

Without the stack trace module 'longjohn', I would get the following error message:
socket.parser.resume()
cannot read property resume of null (_http_server.js:442)
......

After I installed 'longjohn', I obtained the following error message:

TypeError: Cannot read property 'resume' of null
at socketOnDrain (_http_server.js:442:20)
at ServerResponse.updateOutgoingData as _onPendingData
at ServerResponse.OutgoingMessage._send (_http_outgoing.js:128:14)
at ServerResponse.OutgoingMessage.write (_http_outgoing.js:470:16)
at ReadStream.ondata (_stream_readable.js:525:20)
at emitOne (events.js:77:13)
at ReadStream.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at ReadStream.Readable.push (_stream_readable.js:110:10)
at onread (fs.js:1744:12)
at FSReqWrap.wrapper as oncomplete
at ReadStream.Readable.on (_stream_readable.js:655:33)
at ReadStream.Readable.pipe (_stream_readable.js:522:7)
at SendStream.stream (C:\XXXX\node_modules\express\node_modules\send\lib\send.js:533:10)
at SendStream.send (C:\XXXX\node_modules\express\node_modules\send\lib\send.js:480:8)
at C:\XXXX\node_modules\express\node_modules\send\lib\send.js:392:10
at FSReqWrap.oncomplete (fs.js:82:15)
worker 1760 died

The problem only occurs on my production server (ovh, Windows Hyper-V, node v4.2.1) and not on my local development computer (Windows 10, node v4.2.0).

It is worthwhile mentioning that I am using socket.io. I am also using an external service called Global Counter that displays the number of online users. I am running setInterval() in one of the workers to remove expired records.

Could someone tell me the meaning of these error messages, how the error occurs, and how I should solve it?

@silverwind silverwind added http Issues or PRs related to the http subsystem. question Issues that look for answers. labels Oct 24, 2015
@mscdex mscdex removed the question Issues that look for answers. label Oct 24, 2015
@evanlucas
Copy link
Contributor

/cc @indutny

@indutny
Copy link
Member

indutny commented Oct 26, 2015

I think adding single guard should be enough to cover this. Writing a regression test for it may be a bit trickier, though. Going to take a look tomorrow.

@binarybehemoth
Copy link
Author

Hi. We are launching the website very soon. Have you found the source of the error? Could you tell me how to fix this issue? When can I expect to get the solution?

@indutny
Copy link
Member

indutny commented Oct 29, 2015

The fix is very easy, but the test unfortunately takes a bit more time. I'll continue working on it tomorrow. Sorry for delay!

@indutny
Copy link
Member

indutny commented Oct 29, 2015

@binarybehemoth are you sure that this stack trace is from 4.2.0? Here is 128 line from _http_outgoing.js:

https://github.com/nodejs/node/blob/v4.2.0/lib/_http_outgoing.js#L128

Doesn't seem to match. I guess the version is 4.1.0?

@binarybehemoth
Copy link
Author

So sorry. You are right. That stack trace was obtained before I upgraded node from v4.1.2 to v4.2.1, but the problem persisted after the upgrade. Here is the stack trace from v4.2.1:

TypeError: Cannot read property 'resume' of null
at socketOnDrain (_http_server.js:446:20)
at ServerResponse.updateOutgoingData [as _onPendingData](_http_server.js:27
4:14)
at ServerResponse.OutgoingMessage._send (_http_outgoing.js:135:14)
at ServerResponse.OutgoingMessage.write (_http_outgoing.js:479:16)
at ReadStream.ondata (_stream_readable.js:528:20)
at emitOne (events.js:77:13)
at ReadStream.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at ReadStream.Readable.push (_stream_readable.js:110:10)
at onread (fs.js:1748:12)
at FSReqWrap.wrapper as oncomplete
---------------------------------------------
at ReadStream.Readable.on (_stream_readable.js:665:33)
at ReadStream.Readable.pipe (_stream_readable.js:525:7)
at SendStream.stream (C:\XXXX\node_modules\express\node_modules\send\lib\send.js:533:10)
at SendStream.send (C:\XXXX\node_modules\express\node_modules\send\lib\send.js:480:8)
at C:\XXXX\node_modules\express\node_modules\send\lib\send.js:392:10
at FSReqWrap.oncomplete (fs.js:82:15)
worker 3876 died

@indutny
Copy link
Member

indutny commented Oct 29, 2015

@binarybehemoth we have a fix, but it will take some time to test and make sure that there are no other regressions. Please stay tuned, sorry for delay!

@binarybehemoth
Copy link
Author

Great. It is good to know you have fixed the issue. Please release the new version as soon as possible. The current bug is really annoying.

@binarybehemoth
Copy link
Author

Has the issue been addressed? I tried using v5.0.0 and the problem was still there. When can I obtain the fixed version?

@indutny
Copy link
Member

indutny commented Nov 2, 2015

@binarybehemoth the fix has not yet landed anywhere. However it should land soon, I'll keep you posted. Sorry for delay!

@kbernst30
Copy link

Is there any update on this?

@Fishrock123
Copy link
Contributor

@kbernst30 we're on it. Soon, think within two weeks.

@OtterCode
Copy link

Hey, I know this has already been reported, and that people are working on it, but it's been two weeks without an update. This bug has been causing unbelievable havoc for me. http is the beating heart of Node in web deployment. I need to be able to rely on it. It's been crashing my server every few hours, and sometimes up to multiple times a second.

@artofspeed
Copy link

i'm having this issue too after i upgraded node from 0.12.7 to 4.2.2, any update on this?

@pigeonman99
Copy link

any update on this? my server has been crashing multiple times a day...

@calzoneman
Copy link

Just discovered this issue as well. Is there a date when we can expect this to land? Is there something that we can do to help push this out?

@dimitarpetrunov
Copy link

I don't know about you but I got used to it

@bnoordhuis
Copy link
Member

A fix will be released later this week.

@indutny indutny closed this as completed in d332ae4 Dec 4, 2015
@artofspeed
Copy link

This might be a stupid question but how do I inject this fix into my existing project (that uses v4.2.2), should I reinstall node v4.2.2?

@rvagg
Copy link
Member

rvagg commented Dec 4, 2015

@artofspeed you should grab 4.2.3 http://nodejs.org/en/blog/release/v4.2.3/

@rvagg
Copy link
Member

rvagg commented Dec 4, 2015

Please be aware that this bug is related to CVE-2015-8027 and it's important that you upgrade to 4.2.3 or 5.1.1.

scovetta pushed a commit to scovetta/node that referenced this issue Apr 2, 2016
Always check that socket still has the parser. It may be destroyed
interim, and we may end up with an uncaught exception.

Fix: nodejs#3508
PR-URL: nodejs-private/node-private#5
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
jBarz pushed a commit to ibmruntimes/node that referenced this issue Nov 4, 2016
Always check that socket still has the parser. It may be destroyed
interim, and we may end up with an uncaught exception.

Fix: nodejs/node#3508
PR-URL: https://github.com/nodejs/node-private/pull/5
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem.
Projects
None yet
Development

No branches or pull requests