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

Nest application with RMQ connection may freeze depending on configuration #11641

Closed
3 of 15 tasks
ryoctrl opened this issue May 19, 2023 · 1 comment
Closed
3 of 15 tasks
Labels
needs triage This issue has not been looked into

Comments

@ryoctrl
Copy link
Contributor

ryoctrl commented May 19, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

In the following case, a nest application with the RabbitMQ microservice integration will freeze when the application has received a message which has a pattern that is not registered within the controller.

RabbitMQ Options:

  • prefetchCount: 1
  • noAck: false

The mainly cause is the setting noAck option has being false.
When the application receives unhandle-able message, if noAck is true, the application will continue to receive message since unhandle-able message has been automatically acknowledged.

But noAck is false, the application will keep waiting for unhandle-able message is acknowledged, and this message will consume prefetchCount. Finally if prefetchCount is filled by unhhandle-able messages, the application can't fetch new message, it seems to be freezed.

Background

I tried to build an application to process important heavy job using RabbitMQ with above options.

This application has to change acknowledgement strategy for each job result. For example, if the job has succeeded it should be acknowledged, if the job has failed due to the retry-able cause it should be nack-ed with true retry flag.

So the noAck option should be set as false, then the prefetchCount option should be set as 1 (or enough small value) by mentioned reason.

Minimum reproduction code

https://github.com/ryoctrl/nest-rmq-unack

Steps to reproduce

No response

Expected behavior

When a nest application receives an unknown pattern's message, I want the application to dispose the message then it should handle next message.

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

No response

NestJS version

9.0.0

Packages versions

{
    "@nestjs/common": "^9.0.0",
    "@nestjs/core": "^9.0.0",
    "@nestjs/microservices": "^9.4.1",
    "@nestjs/platform-express": "^9.0.0",
    "amqp-connection-manager": "^4.1.13",
    "amqplib": "^0.10.3",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0"
  }

Node.js version

18.15.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@ryoctrl ryoctrl added the needs triage This issue has not been looked into label May 19, 2023
@kamilmysliwiec
Copy link
Member

Let's track this here #11642

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

2 participants