Open RoadRunnr opened 1 month ago
Have reproduced in a server unit test.
Appears to be because (*Sublist).registerNotification()
does equal matching of the subjects for interest updates rather than using Match()
, so for a split second at creation, the consumer has interest on the wildcard subscriber, but then the sublist interest notification comes along and resets it.
Trying to figure out if it's that way for a specific reason.
I think this behaviour is intentional and dates back to nats-io/nats-server#1705.
In short, if you had wildcard matching of subscribers on the DeliverSubject
, then a single client that subscribes to >
for example would:
AckNone
or limit redeliveries;
Observed behavior
A user of a (push) consumer with
deliver_subject
must first create a subscription for thedeliver_subject
before creating the consumer to receive message for that consumer. When that subscription uses a wildcard, then messages from the consumer are not delivered.In the sample trace the client subscribes to
_MY_KV_SUB.25rsjW3I9BlkBDBvtcdMhW.*
and creates the consumer with"deliver_subject": "_MY_KV_SUB.25rsjW3I9BlkBDBvtcdMhW.1Hz9dd0khEFwXrqEJ8XjEK"
. The subscription clearly covers thedeliver_subject
. However, there is nothing delivered to that subject.Sample trace:
There is nothing in the wire protocol or consumer documentation that suggest that wildcarded subscription can not be used on the
deliver_subject
Expected behavior
consumer message are delivered to
deliver_subject
when a wild card subscription for that subject exists.Server and client version
Host environment
Linux, server in docker container from hub.docker.com, started with
sudo podman run --network=host nats -js -DVV
Steps to reproduce
I'm sure the effect can be recreated with plain PUB/SUB messages in any client.
However, the problem was discovered with a new client for Erlang. The reproducer therefore needs Erlang/OTP 27.1 and rebar3.
If you already have a working Erlang/OTP 27.1 and rebar3 installation, run a local nats server, checkout and run the test:
The test run stall/block due to the missing messages from the consumer.
If you need a working Erlang/OTP 27.1 and rebar3 installation, you can use the
erlang:27
docker container or install it on a recent Linux manually with something like this: