socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

TypeError: Cannot read property '0' of undefined

Open nookiepl opened this issue 15 years ago • 7 comments

I have that traceback! :) I'm starting new issue because I'm almost 100% sure that it's note related to flashsocket issue.

if (data[0] == '\ufffd') { ^ TypeError: Cannot read property '0' of undefined at Object.decodePayload (/home/data/node_modules/socket.io/lib/parser.js:226:11) at JSONPPolling.onData (/home/data/node_modules/socket.io/lib/transports/http.js:85:25) at IncomingMessage. (/home/data/node_modules/socket.io/lib/transports/http.js:57:12) at IncomingMessage.emit (events.js:61:17) at HTTPParser.onMessageComplete (http.js:133:23) at Socket.ondata (http.js:1019:22) at Socket._onReadable (net.js:683:27) at IOWatcher.onReadable as callback

nookiepl avatar Jul 18 '11 15:07 nookiepl

Is it easy to reproduce?

3rd-Eden avatar Jul 18 '11 17:07 3rd-Eden

I can send you my server code. Server was just running on high load.

Code: http://dpaste.com/570866/

nookiepl avatar Jul 18 '11 18:07 nookiepl

I am experiencing the same error during high load (~ 1.000 to 3.000 open tcp connections), also with the same stack trace:

.../node_modules/socket.io/lib/parser.js:226
  if (data[0] == '\ufffd') {
          ^
TypeError: Cannot read property '0' of undefined
    at Object.decodePayload (.../node_modules/socket.io/lib/parser.js:226:11)
    at JSONPPolling.onData (.../node_modules/socket.io/lib/transports/http.js:85:25)
    at IncomingMessage. (.../node_modules/socket.io/lib/transports/http.js:57:12)
    at IncomingMessage.emit (events.js:61:17)
    at HTTPParser.onMessageComplete (http.js:133:23)
    at Socket.ondata (http.js:1026:22)
    at Socket._onReadable (net.js:683:27)
    at IOWatcher.onReadable [as callback] (net.js:177:10)

The server ran for 3 days and crashed 5 times with this error and another time it ran out of memory. I think it's not easy to reproduce because those crashes seem occasional.

Maybe some additional information:

  • The debug level was 3 -- very verbose
  • There were around 500 to 1.200 chat rooms
  • The system was monitored by "god", which restarted the service upon crash
  • The overall cpu usage and load was very low but at some point it started to rise dramatically

If you need more information, tell me.

squidfunk avatar Aug 01 '11 08:08 squidfunk

Hey, i have the same problem every 2 - 3 days i have server crash because of that.

If i can help by adding to code base some debuging code pls post it.

2011-08-06_07:53:19.05452 Chat/js/lib/parser.js:226 2011-08-06_07:53:19.05453 if (data[0] == '\ufffd') { 2011-08-06_07:53:19.05455 ^ 2011-08-06_07:53:19.05455 TypeError: Cannot read property '0' of undefined 2011-08-06_07:53:19.05456 at Object.decodePayload (Chat/js/lib/parser.js:226:11) 2011-08-06_07:53:19.05456 at JSONPPolling.onData (Chat/js/lib/transports/http.js:85:25) 2011-08-06_07:53:19.05457 at IncomingMessage. (Chat/js/lib/transports/http.js:57:12) 2011-08-06_07:53:19.05457 at IncomingMessage.emit (events.js:61:17) 2011-08-06_07:53:19.05458 at HTTPParser.onMessageComplete (http.js:133:23) 2011-08-06_07:53:19.05458 at Socket.ondata (http.js:1026:22) 2011-08-06_07:53:19.05459 at Socket._onReadable (net.js:683:27) 2011-08-06_07:53:19.05459 at IOWatcher.onReadable as callback

dymsza avatar Aug 20 '11 20:08 dymsza

Still experiencing the problem with the latest master.

squidfunk avatar Aug 20 '11 23:08 squidfunk

What's the status of this issue? It seems like all the large, serious issues that prevent Socket.IO being used in the real world, arent getting enough attention.

thekiur avatar Oct 31 '11 11:10 thekiur

Does this still happen, @nookiepl?

rase- avatar Jul 22 '14 23:07 rase-