arobson / rabbot

Deprecated: Please see https://github.com/Foo-Foo-MQ/foo-foo-mq
MIT License
276 stars 129 forks source link

unhandledRejection upon network issues #144

Open manuel-reil opened 6 years ago

manuel-reil commented 6 years ago

"rabbot": "^2.1.0" Developing locally, I see the following error when my MacBook goes into sleep:

You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
Error: Operation failed: ExchangeBind; 404 (NOT-FOUND) with message "NOT_FOUND - no exchange 'std-jobs-q' in vhost 'XXX'"
  at reply (/myPath/node_modules/amqplib/lib/channel.js:127:17)
  at Channel.C.accept (/myPath/node_modules/amqplib/lib/channel.js:401:7)
  at Connection.mainAccept [as accept] (/myPath/node_modules/amqplib/lib/connection.js:64:33)
  at Socket.go (/myPath/node_modules/amqplib/lib/connection.js:477:48)
  at emitNone (events.js:106:13)
  at Socket.emit (events.js:208:7)
  at emitReadable_ (_stream_readable.js:513:10)
  at emitReadable (_stream_readable.js:507:7)
  at addChunk (_stream_readable.js:274:7)
  at readableAddChunk (_stream_readable.js:250:11)
  at Socket.Readable.push (_stream_readable.js:208:10)
  at TCP.onread (net.js:594:20)

My code looks like this:

//...
rabbit
  .configure(config)
  .then(function() {
    info('RabbitMQ config successful');
  })
  .catch(function(err) {
    error('rabbit-configure: Could not connect to Q');
  });

// For debugging this
rabbit.on('closed', function() {
  error('rabbit-configure: closed');
  rabbit.retry();
});

rabbit.on('failed', function() {
  error('rabbit-configure: failed');
  rabbit.retry();
});

rabbit.on('unreachable', function() {
  error('rabbit-configure: unreachable');
  rabbit.retry();
});
//...

When the failure happens the error msgs on catch and on the the closed, etc. events are not printed.

The rejection not being handled seems to be in amqplib, not in rabbot originally. Questions:

marcuzy commented 5 years ago

I'm getting same in production. After that, consumer stopped working. Any ideas?

richtu4n commented 5 years ago

I'm having this issue in production too