Skip to content
This repository

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

Closed
mranney opened this Issue May 08, 2012 · 9 comments

5 participants

Matt Ranney Isaac Z. Schlueter Ben Noordhuis vadim-pavlov Douglas Christopher Wilson
Matt Ranney
mranney commented May 08, 2012

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

https://gist.github.com/2638935

Ben Noordhuis
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.

Matt Ranney
mranney commented May 08, 2012

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.

Isaac Z. Schlueter isaacs referenced this issue from a commit May 09, 2012
Commit has since been removed from the repository and is no longer available.
Isaac Z. Schlueter isaacs referenced this issue from a commit in isaacs/node May 09, 2012
Isaac Z. Schlueter http: Remove socket from agent on error
Potential fix for #3236
9d3bd8a
Isaac Z. Schlueter isaacs closed this May 11, 2012
Isaac Z. Schlueter
Collaborator
isaacs commented May 11, 2012

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.

Isaac Z. Schlueter isaacs referenced this issue from a commit May 14, 2012
Isaac Z. Schlueter 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
Isaac Z. Schlueter isaacs referenced this issue from a commit May 14, 2012
Isaac Z. Schlueter 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)

Douglas Christopher Wilson

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.

Isaac Z. Schlueter
Collaborator

@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)

Douglas Christopher Wilson

@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.

Isaac Z. Schlueter
Collaborator

@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.

Douglas Christopher Wilson

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.