Foo-Foo-MQ / foo-foo-mq

Abstractions around RabbitMQ
MIT License
48 stars 24 forks source link

Error: Channel ended, no reply will be forthcoming #25

Open viniciushfr opened 3 years ago

viniciushfr commented 3 years ago

I was using this lib for a while, 1 - 2 months with this basic same configuration, for some reason i starting receive this error:

[2021-03-15T02:21:23.805Z] ERROR: Error: Channel ended, no reply will be forthcoming at rej (/home/vinicius/Documents/MyProjects/WhatsappXIntegration/api/node_modules/foo-foo-mq/node_modules/amqplib/lib/channel.js:201:7) at Channel.C._rejectPending (/home/vinicius/Documents/MyProjects/WhatsappXIntegration/api/node_modules/foo-foo-mq/node_modules/amqplib/lib/channel.js:203:28) at Channel.C.toClosed (/home/vinicius/Documents/MyProjects/WhatsappXIntegration/api/node_modules/foo-foo-mq/node_modules/amqplib/lib/channel.js:171:8) at Connection.C._closeChannels (/home/vinicius/Documents/MyProjects/WhatsappXIntegration/api/node_modules/foo-foo-mq/node_modules/amqplib/lib/connection.js:394:18) at Connection.C.toClosed (/home/vinicius/Documents/MyProjects/WhatsappXIntegration/api/node_modules/foo-foo-mq/node_modules/amqplib/lib/connection.js:401:8) at Connection.C.onSocketError (/home/vinicius/Documents/MyProjects/WhatsappXIntegration/api/node_modules/foo-foo-mq/node_modules/amqplib/lib/connection.js:355:10) at Socket.emit (events.js:327:22) at emitErrorNT (internal/streams/destroy.js:92:8) at emitErrorAndCloseNT (internal/streams/destroy.js:60:3) at processTicksAndRejections (internal/process/task_queues.js:84:21)

topology configuration file:

export const rabbitmqtopology = {
    connection: {
        user: process.env.RABBITMQ_USER,
        pass: process.env.RABBITMQ_PASS,
        host: process.env.RABBITMQ_HOST,
        port: process.env.RABBITMQ_PORT,
        vhost: '%2f',
        publishTimeout: 5000,
        timeout: 10000,
        failAfter: 3000,
        retryLimit: 3,
    },
    exchanges: [
        { name: 'SESSION', type: 'fanout', persistent: false },
        { name: 'RECEIVE_MESSAGE', type: 'fanout', persistent: false },
        { name: 'SEND_MESSAGE', type: 'fanout', persistent: false },
        { name: 'STATUS_PHONE', type: 'fanout', persistent: false },
        { name: 'RUNNING_SESSIONS', type: 'fanout', persistent: false },
    ],
    queues: [
        { name: 'SESSION', autoDelete: false, subscribe: false },
        { name: 'RECEIVE_MESSAGE', autoDelete: false, subscribe: true },
        { name: 'SEND_MESSAGE', autoDelete: false, subscribe: false },
        { name: 'STATUS_PHONE', autoDelete: false, subscribe: true },
        { name: 'RUNNING_SESSIONS', autoDelete: false, subscribe: true },
    ],
    bindings: [
        { exchange: 'SESSION', target: 'SESSION', keys: [''] },
        { exchange: 'RECEIVE_MESSAGE', target: 'RECEIVE_MESSAGE', keys: [''] },
        { exchange: 'SEND_MESSAGE', target: 'SEND_MESSAGE', keys: [''] },
        { exchange: 'STATUS_PHONE', target: 'STATUS_PHONE', keys: [''] },
        { exchange: 'RUNNING_SESSIONS', target: 'RUNNING_SESSIONS', keys: [''] },
    ],
};

start

import { rabbitmqtopology } from './topology';

const rabbitmq = require('foo-foo-mq');

rabbitmq
    .configure(rabbitmqtopology)
    .then(() => logger.info('## [rabbitmq]: Connected!'))
    .catch(err => {
        logger.error(err);
        process.exit();
    });

export default rabbitmq;

any thoughts?

arsenij-melihov commented 2 years ago

I have the same problem

zlintz commented 1 year ago

@viniciushfr or @arsenij-melihov any new info on this? Are you still encountering this or have you moved on to a different code base. I would like this issue to be addressed but without your help I am not sure what to do as I have not encountered this. If something else has served you better please let me know.

arsenij-melihov commented 1 year ago

@zlintz , I have moved to the https://www.npmjs.com/package/amqp-connection-manager, it solved the issue. As I understand, the issue is that when there are high-load operations in a code, the foo-foo-mq doesn't manage to send acks to the broker and it closes the connection