Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

TypeError: Property 'onIncoming' of object #<HTTPParser> is not a function #3236

Closed
mranney opened this Issue · 9 comments

5 participants

@mranney

We are running node 0.6.17, and have started seeing these errors after upgrading:

https://gist.github.com/2638935

@bnoordhuis
Owner
Uncaught exception: TypeError: Property 'onIncoming' of object #<HTTPParser> is not a function
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:91:29)
    at Socket.ondata (http.js:1176:24)
    at TCP.onread (net.js:374:27)

Do you know if the error is caused by incoming or outgoing HTTP requests? I can't think of a reasonable explanation of how that could happen.

@mranney

I've got no good way to tell the origin of these requests. I guess we could leave a marker behind indicating which one it was, so instead of setting onIncoming to null, we could set it to a string "old server request /ping". Kinda gross, but I'll do it if that helps us get to the bottom of this.

@isaacs isaacs referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@isaacs isaacs referenced this issue from a commit in isaacs/node
@isaacs isaacs http: Remove socket from agent on error
Potential fix for #3236
9d3bd8a
@isaacs
Owner

Fixed (somewhat surprisingly) by 07d8a46, which was intended to be just a way to make the code more sane for easier debugging.

This leads me to believe that something was being trapped in the nextTick closure that should not have been. I would have guessed that the code was already correct, but it's certainly more obviously so on 07d8a46. Closing this now.

@isaacs isaacs closed this
@isaacs isaacs referenced this issue from a commit
@isaacs isaacs 2012.05.15 Version 0.6.18 (stable)
* windows: skip GetFileAttributes call when opening a file (Bert Belder)

* crypto: add PKCS12/PFX support (Sambasiva Suda)

* #3240: child_process: delete NODE_CHANNEL_FD from env in spawn (Ben Noordhuis)

* windows: add test for path.normalize with UNC paths (Bert Belder)

* windows: make path.normalize convert all slashes to backslashes (Bert Belder)

* fs: Automatically close FSWatcher on error (Bert Belder)

* #3258: fs.ReadStream.pause() emits duplicate data event (koichik)

* pipe_wrap: don't assert() on pipe accept errors (Ben Noordhuis)

* Better exception output for module load and process.nextTick (Felix Geisendörfer)

* zlib: fix error reporting (Ben Noordhuis)

* http: Don't destroy on timeout (isaacs)

* #3231: http: Don't try to emit error on a null'ed req object (isaacs)

* #3236: http: Refactor ClientRequest.onSocket (isaacs)
bb25001
@isaacs isaacs referenced this issue from a commit
@isaacs isaacs 2012.05.15 Version 0.6.18 (stable)
* windows: skip GetFileAttributes call when opening a file (Bert Belder)

* crypto: add PKCS12/PFX support (Sambasiva Suda)

* #3240: child_process: delete NODE_CHANNEL_FD from env in spawn (Ben Noordhuis)

* windows: add test for path.normalize with UNC paths (Bert Belder)

* windows: make path.normalize convert all slashes to backslashes (Bert Belder)

* fs: Automatically close FSWatcher on error (Bert Belder)

* #3258: fs.ReadStream.pause() emits duplicate data event (koichik)

* pipe_wrap: don't assert() on pipe accept errors (Ben Noordhuis)

* Better exception output for module load and process.nextTick (Felix Geisendörfer)

* zlib: fix error reporting (Ben Noordhuis)

* http: Don't destroy on timeout (isaacs)

* #3231: http: Don't try to emit error on a null'ed req object (isaacs)

* #3236: http: Refactor ClientRequest.onSocket (isaacs)
4bc1d39
@vadim-pavlov

Occurred again on v0.9.7-pre. Please see relevant information below:

http.js:119
skipBody = parser.onIncoming(parser.incoming, info.shouldKeepAlive);
^
TypeError: Property 'onIncoming' of object # is not a function
at HTTPParser.parserOnHeadersComplete as onHeadersComplete
at Socket.socket.ondata (http.js:1785:22)
at TCP.onread (net.js:476:27)
at process._makeCallback (node.js:299:20)

@dougwilson

I am also seeing this on v0.8.21-pre:

http.js:111
    skipBody = parser.onIncoming(parser.incoming, info.shouldKeepAlive);
                      ^
TypeError: Property 'onIncoming' of object #<HTTPParser> is not a function
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:111:23)
    at Socket.socketOnData [as ondata] (http.js:1485:20)
    at TCP.onread (net.js:404:27)

From initial investigation, it looks like it is because onHeadersComplete is being called after the close event was emitted on the socket and so freeParser was called and removed the onIncoming function. I typically see this when the socket is closed in the middle of parsing the headers of the request.

@isaacs
Owner

@vadim-pavlov @dougwilson Can one of you try this patch and see if it makes a difference? https://gist.github.com/isaacs/4948917

See also: #4673 (comment)

@dougwilson

@isaacs Thank you so much for coming up with a possible patch. I have applied the path to v0.8.21-pre and compiled but I still get the error to pop up :( so it looks like the patch doesn't seem to work for the particular conditions I am experiencing.

@isaacs
Owner

@dougwilson Thanks for checking it out. I guess this is something else then.

Going to leave this issue closed, however, since it's a dupe of #4673.

@dougwilson

I'm working to figure out if I can get the debugger to pause in http.js right above line 111 when onIncoming is not a function on a server that is within an environment that experiences this condition. If I find anything, I'll be sure to post in the opened issue (I didn't realize there was another one ;) ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.