Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

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

Closed
mranney opened this issue May 8, 2012 · 9 comments
Closed
Labels

Comments

@mranney
Copy link

mranney commented May 8, 2012

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

https://gist.github.com/2638935

@bnoordhuis
Copy link
Member

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
Copy link
Author

mranney commented May 9, 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.

isaacs added a commit to isaacs/node-v0.x-archive that referenced this issue May 11, 2012
@isaacs
Copy link

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.

@isaacs isaacs closed this as completed May 11, 2012
isaacs added a commit that referenced this issue May 14, 2012
* 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)
isaacs added a commit that referenced this issue May 15, 2012
* 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)
@vadim-pavlov
Copy link

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
Copy link
Member

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
Copy link

isaacs commented Feb 23, 2013

@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
Copy link
Member

@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
Copy link

isaacs commented Feb 23, 2013

@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
Copy link
Member

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants