postwait / node-amqp

[UNMAINTAINED] node-amqp is an AMQP client for nodejs
MIT License
1.69k stars 357 forks source link

Cannot call method 'indexOf' of null #357

Open amackera opened 10 years ago

amackera commented 10 years ago

Hey all, after a few hours of operation we are seeing these types of errors in our error log:

2014-08-29T16:39:50.565Z - error: TypeError: Cannot call method 'indexOf' of null
    at Queue._onMethod (/home/ubuntu/Cottontail/node_modules/amqp/lib/queue.js:398:23)
    at Queue.Channel._onChannelMethod (/home/ubuntu/Cottontail/node_modules/amqp/lib/channel.js:85:12)
    at Connection._onMethod (/home/ubuntu/Cottontail/node_modules/amqp/lib/connection.js:421:28)
    at AMQPParser.Connection.addAllListeners.self.addListener.self.parser.onMethod (/home/ubuntu/Cottontail/node_modules/amqp/lib/connection.js:133:12)
    at AMQPParser._parseMethodFrame (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:360:10)
    at frameEnd (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:93:16)
    at frame (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:78:14)
    at header (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:64:14)
...
Hundreds of these
...
    at frame (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:78:14)
    at header (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:64:14)
    at frameEnd (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:111:16)
    at frame (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:78:14)
    at header (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:64:14)
    at frameEnd (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:111:16)
    at frame (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:78:14)
    at AMQPParser.header [as parse] (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:64:14)
    at AMQPParser.execute (/home/ubuntu/Cottontail/node_modules/amqp/lib/parser.js:137:21)
    at Connection.addAllListeners.backoffTime (/home/ubuntu/Cottontail/node_modules/amqp/lib/connection.js:171:21)
    at Connection.EventEmitter.emit (events.js:96:17)
    at Socket.EventEmitter.emit (events.js:96:17)
    at TCP.onread (net.js:397:14)
    at TCP.asyncWrap [as onread] (/home/ubuntu/Cottontail/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:295:29)

It would be nice to get some insight here. Has anybody else seen this issue?

chrono commented 7 years ago

This issue was due to an invalid input validation on our behalf. We called connection.queue(null, [...])

Perhaps, the library could do some validation of that parameter since this does lead to a crash.