-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot call method 'writeHead' of undefined #609
Comments
@guille this https://github.com/LearnBoost/socket.io/blob/master/lib/transports/jsonp-polling.js#L68 causes it :p I don't really know why.. |
getting the same error |
Hey, in my opinion this is source of problem https://github.com/LearnBoost/socket.io/blob/master/lib/transports/http.js#L72 so the response is set only for request req.method != 'POST' but onData is called for req.method == 'POST' |
+1. I'll try to take a look at it tonight; surprised more people haven't run into this. |
Have the same problem. Happens usually after system is up for a while |
Have same issue with 0.8.7, but I'm unable to replicate it reliably. Happens on heavy load, with 400 clients connected and 20+ connecting/disconecting per second. |
I had the issue. I found out that I forgot to encode the message in the POST method. Here a example T 192.168.10.1:57908 -> 192.168.10.141:3000 [AP] GOOD WAY HERE Content-Length: 111. Hope that can help. |
I also have this issue, but it's only after a few days of execution of my node/socket.io program, still don't know the exact reason. Survivant, I am not sure that I'm following your answer. Are you saying that we should encode the arguments to the socket.send function? Thanks for the help. |
Anybody have any news about this bug? |
I'm currently looking into this. |
Great! Gracias! |
Having the same problem here. DEBUG: /root/node/node_modules/socket.io/lib/transports/jsonp-polling.js:87 DEBUG: this.response.writeHead(200, { DEBUG: DEBUG: TypeError: Cannot call method 'writeHead' of undefined |
+1 on this bug, happens randomly, sometimes 5 min, sometimes 20 hours. |
+1, have same problems. |
The quick fix is to remove jsonp-polling from transports. |
thank you men |
Any ETA on this? It's still an issue. |
+1 I'm seeing this on 0.8.7 similar sort of behaviour to what DefV describes. |
Might be unrelated, but my upgrade to 0.9.0 has dramatically increased the occurrences of this error. |
Do you see this only with jsonp ? Or also xhr-polling ? |
Also is it correlated to another exception beforehand in your logs ? |
i have disabled xhr-polling and jsop-polling and now my server works fine. |
@guille I'm only seeing this on jsonp |
@guille Still haven't tested if the issue arrises on jsonp or xhr, but I can confirm it's unrelated to 0.9.0. |
@DavidChouinard Thanks for the update. I'll keep you posted on my findings |
i have the same problem, work fine after disable jsonp-polling |
It seems that this is caused by a chain reaction possibly set off by a high number of jsonp-polling connections. I get bursts of 100-200 of this exception. |
+1 on this issue, but only on IE7, and only since I added a cookie-based authentication check before rendering the page... |
+1 on this issue, my first time using socket.io and this error occurs whenever i visit using a nokia/c3 (old webkit-based browser). source is straight from the socket.io homepage |
having the same problem.. /node_modules/socket.io/lib/transports/jsonp-polling.js:88 |
Or you can just ignore this issue and keep it enabled? Just use the uncaughtException handler On Wednesday, May 2, 2012 at 12:31 PM, tommypowerz wrote:
|
it is broken here cf76b13#lib/transports/jsonp-polling.js After this commit. The flow is like this
So the root cause is we should not call this.error('parse', 'reconnect') on JSON.parse exception on OnData call. instead we should write some debug error for the same. Though I am not able to reproduce this on my local box we got this on production environment but I am still interested to know in which use case JSON.parse throws an error before fixing it. Can anybody tell me how to reproduce this locally or can anybody post the JSON data coming through jsonp-polling that causes this issue? Note: This happens only in case of jsonp-polling because it is inside overridden 'onData' method of jsonp-polling |
anybody any luck? as mentioned above can anybody tell for which kind of data JSON.parse throws an exception or how to reproduce it on local box? |
I also have this issue. I would love to have it fixed. |
+1 |
I have the same issue with 0.9.6. when using JSONP. I am not using cookie-based auth, so that is not related as zackster contemplated above. |
+1 also in 0.9.6 |
I get exactly this issue on the following scenario. I use JMeter to do some load testing, so my server is configured to accept only the jsonp-polling and on JMeter I script the messages one by one, manually. At some point I had a typo in one of the POST messages, which looked like this: "5:::{"name":"myServerMethod","args":[{"param1":43,"param2":{"member1":["TestValue1"],"member2":[]},"isNew":false} This caused the exact same exception from this thread, and the server crashed. When I fixed the message above in my test script, everything worked fine: "5:::{"name":"myServerMethod","args":[{"param1":43,"param2":{"member1":["TestValue1"],"member2":[]},"isNew":false}]}" (note the trailing characters that were missing in my original message). |
Thank you for sharing ececon! I'm still waiting for one of those strange messages to appear. What we did was to patch it and now we are waiting since we are getting messages from to many sources: It's ok to get an error, just makes no sense that it crashes the server. |
i had the same issue. But if you have something like works fine for me in Node 0.10.25 - hope that can help |
Should check packet.id for non-null, not 0
I'm getting this in 0.8.6
I'm not sure which browser connected or caused the problem, this is just something I found in my err.log trying to figure out the reason for a crash.
Back to 0.8.5 for now.
The text was updated successfully, but these errors were encountered: