nats-io / nats-io/nats.java

Ordered consumer create failures throw unrelated exception

Open
#1,596 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

defect
Dominant language
Java
Stars
679
Forks
198
Avg merge
3h 39m
Merged PRs (30d)
9

Description

Observed behavior
java.lang.IllegalStateException: This subscription is inactive.
	at io.nats.client.impl.NatsSubscription.unsubscribe(NatsSubscription.java:183)
	at io.nats.client.impl.NatsJetStreamSubscription.unsubscribe(NatsJetStreamSubscription.java:30)
	at io.nats.client.impl.NatsJetStreamImpl._createConsumerUnsubscribeOnException(NatsJetStreamImpl.java:142)
	at io.nats.client.impl.NatsJetStream.createSubscription(NatsJetStream.java:507)
	at io.nats.client.impl.NatsConsumerContext.subscribe(NatsConsumerContext.java:126)
	at io.nats.client.impl.NatsMessageConsumer.doSub(NatsMessageConsumer.java:158)
	at io.nats.client.impl.NatsMessageConsumer.<init>(NatsMessageConsumer.java:59)
	at io.nats.client.impl.NatsConsumerContext.consume(NatsConsumerContext.java:342)
	at io.nats.client.impl.NatsConsumerContext.consume(NatsConsumerContext.java:304)
	at io.nats.client.impl.NatsOrderedConsumerContext.consume(NatsOrderedConsumerContext.java:133)
Expected behavior

Actual create failure exception is thrown

Server and client version

nats.java 2.26.0

Host environment

No response

Steps to reproduce

Create an ordered consumer that times out.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack-trace path through NatsOrderedConsumerContext.consume, NatsMessageConsumer.doSub, NatsJetStream.createSubscription, and NatsJetStreamImpl._createConsumerUnsubscribeOnException. Reproduce the issue by creating an ordered consumer that times out, then trace why unsubscribe reports an inactive subscription instead of preserving the create failure. Done means the original create failure is thrown and the regression is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.