You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trott, keep in mind that this isn't the first time someone has issues with this. #22135
Now, it should have been fixed on 10.12, so it was either a regression or I am doing something very sketchy with the request object that is causing it to happen.
Edit: the issue happened on ubuntu 16, actually. I am trying to reproduce on CentOS 7 now.
Edit2: it just happened again on CentOS 7 too.
If writeHead is crashing the process then in all likelihood your stream is getting closed in advance of you calling the function. Given that you're using compatibility mode, it's very much possible that some other code is causing an issue that leads to the stream prematurely closing. Note that this was also the case with the issue you linked above.
I'm going to close this out as there's no easily usable reproduction and there's not much likelihood this is a Node core issue.
So while I am not discarding the possibility to be with my code, I am not so sure it isn't with node. I remember finding some similar intermittent crash around version 5 that I also couldn't consistently reproduce but ended up being a DoS on node itself.
I tried, but it wouldn't crash with a simple wait to hold concurrent requests and another script hammering it.
The crashes seem to happen a bit at random with my software running. It works, then suddenly crash. It also seemed to be related with time. It would hardly crash right away, but once a worker crashed, it seems all the others became much more prone to crashing too.
GOT IT @mcollina https://pastebin.com/vCbVS1LT
It spent 30 minutes working fine, then crashed when outputting from gridfs, then crashed again 14 seconds later when outputting some error 500 page.
Also, notice how the error it threw originated from trying to output a response on the cache handler. But that one is inside a try catch, so it didn't crash there.
I'd also like to point that I had about 3 tabs open, no sure if that influenced anything.
So, the issue here is that is expected for the browser to sometimes interrupt the connection before the response and is up to what handles the connection to deal with it?
Activity
Trott commentedon Nov 19, 2018
@nodejs/http2 (Should this be transferred to the
helprepo?)StephenLynx commentedon Nov 19, 2018
Trott, keep in mind that this isn't the first time someone has issues with this.
#22135
Now, it should have been fixed on 10.12, so it was either a regression or I am doing something very sketchy with the request object that is causing it to happen.
Edit: the issue happened on ubuntu 16, actually. I am trying to reproduce on CentOS 7 now.
Edit2: it just happened again on CentOS 7 too.
StephenLynx commentedon Nov 19, 2018
I would also like to point out that I am using the cluster module to spawn one worker process for each CPU core.
StephenLynx commentedon Nov 19, 2018
And after installing 10.12 and 10.13 again I can't seem to reproduce it anymore.
Edit: nevermind, just happened again.
antsmartian commentedon Nov 22, 2018
@StephenLynx Could you please share a reproducible code?
StephenLynx commentedon Nov 22, 2018
I can not, aside from my software gitgud.io/LynxChan/LynxChan
Trott commentedon Nov 25, 2018
@nodejs/http2 Is it likely that the source of the problem can be determined with the information given?
apapirovski commentedon Nov 29, 2018
If
writeHeadis crashing the process then in all likelihood your stream is getting closed in advance of you calling the function. Given that you're using compatibility mode, it's very much possible that some other code is causing an issue that leads to the stream prematurely closing. Note that this was also the case with the issue you linked above.I'm going to close this out as there's no easily usable reproduction and there's not much likelihood this is a Node core issue.
StephenLynx commentedon Nov 29, 2018
How could one close it? I can look around my code, I use the request and response exclusively as I have used them for http1 for years.
StephenLynx commentedon Nov 29, 2018
So while I am not discarding the possibility to be with my code, I am not so sure it isn't with node. I remember finding some similar intermittent crash around version 5 that I also couldn't consistently reproduce but ended up being a DoS on node itself.
mcollina commentedon Nov 29, 2018
I think this is a bug in our compat API.
As you can see in
node/lib/_http_outgoing.js
Lines 240 to 247 in 9920dbc
writeHeaddoes not throw if the stream is destroyed, it just returns false.I think this is a proper bug.
mcollina commentedon Nov 29, 2018
@StephenLynx can you please upload a script to reproduce the crash?
StephenLynx commentedon Nov 29, 2018
I tried, but it wouldn't crash with a simple wait to hold concurrent requests and another script hammering it.
The crashes seem to happen a bit at random with my software running. It works, then suddenly crash. It also seemed to be related with time. It would hardly crash right away, but once a worker crashed, it seems all the others became much more prone to crashing too.
2 remaining items
StephenLynx commentedon Nov 29, 2018
GOT IT
@mcollina
https://pastebin.com/vCbVS1LT
It spent 30 minutes working fine, then crashed when outputting from gridfs, then crashed again 14 seconds later when outputting some error 500 page.
StephenLynx commentedon Nov 29, 2018
Also, notice how the error it threw originated from trying to output a response on the cache handler. But that one is inside a try catch, so it didn't crash there.
I'd also like to point that I had about 3 tabs open, no sure if that influenced anything.
http2: make compat writeHead not crash if the stream is destroyed
StephenLynx commentedon Nov 29, 2018
So, the issue here is that is expected for the browser to sometimes interrupt the connection before the response and is up to what handles the connection to deal with it?
mcollina commentedon Nov 29, 2018
The issue is just a mismatch between
writeHeadin http1 and http2. See #24723StephenLynx commentedon Nov 29, 2018
Btw, did you check if the write and end also don't crash?
mcollina commentedon Nov 29, 2018
@StephenLynx please check the test in my PR.
StephenLynx commentedon Nov 29, 2018
Ah yeah, you do a write head, write and end on the test.
The name of the pr made me think if you weren't looking just at writeHead.
http2: make compat writeHead not crash if the stream is destroyed
Trott commentedon Dec 3, 2018
Fixed in 32fed93
http2: make compat writeHead not crash if the stream is destroyed
http2: make compat writeHead not crash if the stream is destroyed
http2: make compat writeHead not crash if the stream is destroyed
http2: make compat writeHead not crash if the stream is destroyed