-
Notifications
You must be signed in to change notification settings - Fork 7.3k
http.js parser.onIncoming #4673
Comments
Do you have a test case I can try? With what version of node.js are you seeing this? |
version of node is 0.9.8 |
Sometimes be wrong,so i don't know why it get error |
Can you post the full stack trace then? |
http.js:119 |
It's happening to me too.
Both stable (v0.8.18) and latest (v0.9.8) |
I'm having the same problem as well. Trace:
|
Same here, a MJPEG stream over HTTP triggered this issue. |
It seems like this bug is the perfect combination of happening rarely and only-under-load, thus making it nearly impossible to reproduce. Anyone seeing this frequently, can you try applying this patch and let me know if it makes a difference? https://gist.github.com/isaacs/4948917 The patch just changes the order in which we add the .onbody and .onIncoming functions. |
Update: the patch I posted above doesn't solve the problem. |
@isaacs I'm still looking into it, but it may be interesting to know that if I change the |
I'm still working on it, but I'm starting to think it looks like the issue may be within the |
I changed
Both frees on the same parser was called from I know |
@isaacs I doubt this is the right way to do it, but this patch (on v0.8.21-pre) solves the issue for me: diff --git a/lib/http.js b/lib/http.js
index 0081432..b2b5df6 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -1788,7 +1788,9 @@ function connectionListener(socket) {
function serverSocketCloseListener() {
debug('server socket close');
// mark this parser as reusable
- freeParser(parser);
+ if (this === parser.socket) {
+ freeParser(parser);
+ }
abortIncoming();
} It checks that the |
@isaacs I just wanted to let you know I have not even looked into the cause on v0.9, but it is likely to be the same (or similar) to that on v0.8 I found (calling Also, a better patch for v0.8.21-pre would be: diff --git a/lib/http.js b/lib/http.js
index aee579a..90725f0 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -1749,8 +1749,11 @@ function connectionListener(socket) {
function serverSocketCloseListener() {
debug('server socket close');
- // mark this parser as reusable
- freeParser(parser);
+ var parser = this.parser;
+ if (parser) {
+ // mark this parser as reusable
+ freeParser(parser);
+ }
abortIncoming();
} as it would match the way the parser is loaded and detected before attempting to free in other parts of the code (if it were freed from the socket before, Also, the work-around in user-space for the issue is to do |
Thank you dougwilson for your investigation. I'm going to try this patch on the v0.9.8-release branch and let you guys know how it will go. We had a couple of outages each week as a result of this issue, so with our current load It could take 2 weeks to make sure that this issue is solved. |
@dougwilson This is awesome. Thanks! |
@dougwilson Would you mind signing the CLA? I'm going to dig into this a bit before just taking the patches here, but since I'm tainted now, it'd be good to know that I have permission to use your patch to fix your bug :) http://nodejs.org/cla.html |
@isaacs Good to know I was able to help :) I have just signed the CLA (been looking for an excuse to for a while ;) ). |
This appears to fix #4673. That bug is very hard to reproduce, so it's hard to tell for certain, but this approach is more correct anyway. Hat-tip: @dougwilson
Should be fixed on 0.8.21 |
Thank you~~~~ |
Still occuring under load in 0.9.8 |
@Peter-E-Lenz that patch did not apply to version 0.9.8, as 0.9.8 was released a month before this patch. The patch is in 0.8.21 and higher 0.8.x series and in 0.9.11 and up. |
You're right - mental date parsing fail on my part. whoops |
v0.10 is end of life as of November 1st. Additionally, this repo is largely abandoned. If you can reproduce a bug on v4, v6, or v7, feel free to open it at https://github.com/nodejs/node. |
The text was updated successfully, but these errors were encountered: