Skip to content
New issue

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

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

Already on GitHub? # to your account

NATS consumers not pulling messages from Jetstream even though consumer status shows active. Restart of client application required as workaround to resolve the issue. [v2.10.18] #5839

Open
mohamedsaleem18 opened this issue Aug 28, 2024 · 4 comments
Labels
defect Suspected defect such as a bug or regression stale This issue has had no activity in a while

Comments

@mohamedsaleem18
Copy link

mohamedsaleem18 commented Aug 28, 2024

Observed behavior

NATS cluster :

  • 3 Nodes
  • NATS version: 2.10.18

There are pending messages in the stream. Though consumers are connected to NATS, consumers are becoming stale. The workaround consists of purging the stream, deleting the affected consumers, and restarting the service they originate from. This recreates them in a healthy state to resolve the issue. This issue occurs at least once every day.
Client side NATS configuration:

nats {
  enabled = true
  address = "localhost:4222"
  bufferSize = 8
  timeout = 5000
  errorListener = "io.nats.client.impl.ErrorListenerLoggerImpl"
  streams {
    xxxStream {
      name = "lpsn32"
      subject = "xxx-response-details"
      consumerName = "xxxResponseHandler"
      handler = "xxxResponseHandler"
      batchSize = 1
      # pollingDuration is in ms
      pollingDuration = 100
    }
  }
  protocol = "stream"
}

Expected behavior

Consumer should not go stale. In case if Consumer is stale then NATS should automatically modify the consumer status as inactive or drop the consumer.

Server and client version

NATS cluster :

  • 3 Nodes.
  • NATS version :- 2.10.18

Host environment

VM - OS details
NAME="Oracle Linux Server"
VERSION="8.10"

Steps to reproduce

  1. Publish message to stream when consumer is connected.
  2. Consumer will consume the messages without any issue.
  3. If there is idle time or after long time, consumer goes stale. Messages are pending in the stream but consumer are not consuming the message. NATS shows consumer as active.

Please refer description section for workaround to resolve this issue.

@mohamedsaleem18 mohamedsaleem18 added the defect Suspected defect such as a bug or regression label Aug 28, 2024
@derekcollison
Copy link
Member

derekcollison commented Aug 28, 2024

Could you share additional information..

  1. Push or Pull consumer?
  2. What client lib and version?
  3. What does consumer info (NATS cli) report?
  4. What does stream info report?

@mohamedsaleem18
Copy link
Author

mohamedsaleem18 commented Aug 28, 2024

Push or Pull consumer? - Pull consumer
What client lib and version? - Java NATS client, jnats 2.18.1
What does consumer info (NATS cli) report? Consumer was active
What does stream info report? Messages were pending in the stream but consumers were connected as well.

@derekcollison
Copy link
Member

Can you share the consumer info? We want to see if there are pull requests waiting or not etc..

@mohamedsaleem18
Copy link
Author

When we encounter the issue again, I will provide the details of consumer info.

@wallyqs wallyqs changed the title NATS consumers not pulling messages from Jetstream even though consumer status shows active. Restart of client application required as workaround to resolve the issue. NATS consumers not pulling messages from Jetstream even though consumer status shows active. Restart of client application required as workaround to resolve the issue. [v2.10.18] Sep 4, 2024
@github-actions github-actions bot added the stale This issue has had no activity in a while label Oct 31, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
defect Suspected defect such as a bug or regression stale This issue has had no activity in a while
Projects
None yet
Development

No branches or pull requests

2 participants