Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no clean exit on shutdown, with disableBalancer: true #1167

Closed
me23 opened this issue Dec 2, 2022 · 1 comment · Fixed by #1168
Closed

no clean exit on shutdown, with disableBalancer: true #1167

me23 opened this issue Dec 2, 2022 · 1 comment · Fixed by #1168

Comments

@me23
Copy link
Contributor

me23 commented Dec 2, 2022

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [ x] I am running the latest version
  • [ x] I checked the documentation and found no answer
  • [ x] I checked to make sure that this issue has not already been filed
  • [ x] I'm reporting the issue to the correct repository

Current Behavior

Maybe it correspond to this issue: moleculerjs/moleculer-channels#49

I start a service with amqp-transport (rabbitmq) and moleculer-channels listen to a given topic. If i start
a client with( disableBalancer:true) which send to this channel and then exit afterwards, than i get this error message :

moleculer-channels-amqp-test/node_modules/moleculer/src/transporters/amqp.js:434
			.assertQueue(queue, this._getQueueOptions(PACKET_REQUEST, true))
			 ^

TypeError: Cannot read properties of null (reading 'assertQueue')
    at AmqpTransporter.subscribeBalancedRequest (/home/me/public_html/moleculer-channels-amqp-test/node_modules/moleculer/src/transporters/amqp.js:434:5)
    at /home/me/public_html/moleculer-channels-amqp-test/node_modules/moleculer/src/transporters/base.js:269:14
    at Array.map (<anonymous>)
    at /home/me/public_html/moleculer-channels-amqp-test/node_modules/moleculer/src/transporters/base.js:268:37
    at Array.map (<anonymous>)
    at /home/me/public_html/moleculer-channels-amqp-test/node_modules/moleculer/src/transporters/base.js:262:14

If i change disableBalancer:false the error-message went away.

Expected Behavior

The client should exit without error message, even with disableBalancer:true

Failure Information

Steps to Reproduce

I've created a minimal-repo here: https://github.com/me23/moleculer-channels-amqp-test.git

  1. clone repo and change path to it

  2. if you don't have an Rabbitmq running on localhost you could start one with docker:
    docker-compose up

  3. start the service: node source/service.js

  4. start the client: node source/client.js

  5. you get the error

  6. start the client with disableBalancer:false: node source/clientOk.js

  7. you get no error message


### Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

* Moleculer version: 0.14.26
* NodeJS version: 17.9.0
* Operating System: Ubuntu 22.10

@AndreMaz
Copy link
Member

This is not related to channels as I can repro the issue even without it. Here's a repro code

"use strict";

const { ServiceBroker } = require("moleculer");

// Create broker
const broker = new ServiceBroker({
  disableBalancer: true,
  transporter: "amqp://localhost:5672",
});

broker.start().then(async () => {
  // broker.repl();
  console.log("Broker started");

  // await broker.Promise.delay(1000); 

  await broker.stop();
});

Note: With added delay(1000) the issue disappears.

I also managed to repro the issue with amqplib ^0.8.0, ^0.9.0, ^0.10.0

@AndreMaz AndreMaz transferred this issue from moleculerjs/moleculer-channels Dec 17, 2022
AndreMaz added a commit that referenced this issue Dec 17, 2022
@AndreMaz AndreMaz mentioned this issue Dec 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants