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

Cannot read property '_placeholder' of null

Open jeffdupont opened this issue 12 years ago • 9 comments

I socket server listening to a configured port 3000. When I curl the connection from the localhost, it returns fine. Yet if I trigger the event from the browser I received this error:

Cannot read property '_placeholder' of null

I was originally using 1.0.0-pre, but downgraded to 0.9.16.

TypeError: Cannot read property '_placeholder' of null node_modules/socket.io/node_modules/socket.io-parser/binary.js:64:17 reconstructBinPackRecursive node_modules/socket.io/node_modules/socket.io-parser/binary.js:69:27 reconstructBinPackRecursive node_modules/socket.io/node_modules/socket.io-parser/binary.js:74:29 reconstructBinPackRecursive node_modules/socket.io/node_modules/socket.io-parser/binary.js:69:27 reconstructBinPackRecursive node_modules/socket.io/node_modules/socket.io-parser/binary.js:81:19 exports.reconstructPacket node_modules/socket.io/node_modules/socket.io-parser/index.js:347:25 takeBinaryData node_modules/socket.io/node_modules/socket.io-parser/index.js:228:35 add node_modules/socket.io/lib/client.js:166:16 ondata events.js:95:17 EventEmitter.emit node_modules/socket.io/node_modules/engine.io/lib/socket.js:96:14 onPacket events.js:117:20 EventEmitter.emit node_modules/socket.io/node_modules/engine.io/lib/transport.js:91:8 Transport.onPacket node_modules/socket.io/node_modules/engine.io/lib/transport.js:102:8 Transport.onData node_modules/socket.io/node_modules/engine.io/lib/transports/websocket.js:75:30 onData events.js:98:17 EventEmitter.emit node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocket.js:697:10 self._receiver.ontext node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.js:397:14 opcodes.1.finish node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.js:378:33 expectHandler node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.js:93:24 add node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocket.js:678:22 firstHandler events.js:117:20 EventEmitter.emit _stream_readable.js:738:14 none events.js:92:17 EventEmitter.emit stream_readable.js:408:10 emitReadable _stream_readable.js:404:5 emitReadable _stream_readable.js:165:9 readableAddChunk _stream_readable.js:127:10 Readable.push net.js:526:21 onread

jeffdupont avatar Apr 14 '14 04:04 jeffdupont

@jeffdupont if you downgraded to 0.9.x, you shouldn't be getting anything like this from parser because there is no binary file. Try removing node_modules and reinstalling via npm.

Were you getting this same error with 1.0? Do you have example code? Interesting error!!

kevin-roark avatar Apr 14 '14 21:04 kevin-roark

I was getting the error originally with 1.0.0-pre. That’s when I decided to downgrade. I did, in fact, remove the node_modules directory and reinstalled the whole package. But I’ll give it a try again just to see. When I had 1.0.0 installed, I couldn’t even make a request from the browser. With 0.9.16, I’m at least able to make the browser requests, now it just seems to die intermittently.

Jeff Dupont Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Monday, April 14, 2014 at 2:57 PM, Kevin Roark wrote:

@jeffdupont (https://github.com/jeffdupont) if you downgraded to 0.9.x, you shouldn't be getting anything like this from parser because there is no binary file. Try removing node_modules and reinstalling via npm. Were you getting this same error with 1.0? Do you have example code? Interesting error!!

— Reply to this email directly or view it on GitHub (https://github.com/LearnBoost/socket.io/issues/1495#issuecomment-40423275).

jeffdupont avatar Apr 15 '14 01:04 jeffdupont

@jeffdupont super weird that you are seeing those specific errors with the older socket. npm has been weird with caching stuff lately for me -- maybe that is a potential source of error

kevin-roark avatar Apr 15 '14 02:04 kevin-roark

I think that may have been what it was. I verified that this time those packages and files were not present. I’m monitoring the server now to see if this still happens, but at least it’s something to look at for version 1.0.0.

Jeff Dupont Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Monday, April 14, 2014 at 7:08 PM, Kevin Roark wrote:

@jeffdupont (https://github.com/jeffdupont) super weird that you are seeing those specific errors with the older socket. npm has been weird with caching stuff lately for me -- maybe that is a potential source of error

— Reply to this email directly or view it on GitHub (https://github.com/LearnBoost/socket.io/issues/1495#issuecomment-40438681).

jeffdupont avatar Apr 15 '14 02:04 jeffdupont

@kevin-roark I was getting this error as well. reconstructBinPackRecursive throws an exception when a packet is encoded as binary and contains a null value at any depth.

io.on('connection', function(socket) {
    io.emit('nulled:data', {
        a: 'b',
        c: 4,
        e: {
            g: null
        },
        h: new ArrayBuffer(9)
    });
});

... receive this on the client end and you'll hit the exception at https://github.com/LearnBoost/socket.io-client/blob/master/socket.io.js#L4733

phogue avatar May 15 '14 14:05 phogue

@phogue good find, thank you! I just submitted a pull request on socket.io-parser that should fix this bug here https://github.com/LearnBoost/socket.io-parser/pull/10.

kevin-roark avatar May 15 '14 14:05 kevin-roark

@jeffdupont are you still experiencing the issue with 1.0.2?

rase- avatar May 30 '14 09:05 rase-

I haven't been able to test this out yet. But I'll try and give it a go today and let you know. On May 30, 2014 2:21 AM, "Tony Kovanen" [email protected] wrote:

@jeffdupont https://github.com/jeffdupont are you still experiencing the issue with 1.0.2?

— Reply to this email directly or view it on GitHub https://github.com/Automattic/socket.io/issues/1495#issuecomment-44630324 .

jeffdupont avatar May 30 '14 14:05 jeffdupont

We haven't received any other reports of this issue, so I'm closing it. If you still see this @jeffdupont, please do reopen. :)

rase- avatar Oct 03 '14 00:10 rase-