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

A dot in consumer name causes error "nats: timeout". #641

Open
rstoye opened this issue Dec 11, 2024 · 0 comments
Open

A dot in consumer name causes error "nats: timeout". #641

rstoye opened this issue Dec 11, 2024 · 0 comments
Labels
defect Suspected defect such as a bug or regression

Comments

@rstoye
Copy link

rstoye commented Dec 11, 2024

Observed behavior

This is pretty much the same as #471, just for consumer / durable names.

import nats
import pytest

async def my_cool_function():
    nats = await nats.connect("localhost")
    jetstream = nats.jetstream()
    await self.jetstream.add_stream(
        name="cool_stream",
        subjects=["cool_service.*"],
    )

    # subjects can have dots in them, queue, durable, consumer names can't
    jetstream.subscribe("cool_service.my_subject", "name.with.a.dot.in.it", my_callback)

    await nc.close()

def my_callback():
    print("I'm a callback")

Running this code will trigger a "nats: timeout" error on the server side with no further information, not even when running the server in debug / trace mode.

Expected behavior

Arguably this should be handled properly on the server side and return a descriptive error message instead of running in a timeout. I might open up a ticket on the nats-server github later.

The official nats terminal cli throws the following

https://github.com/nats-io/natscli/blob/234eda9cb376add9f1fba4ddffe4ee9cbdb4ed33/cli/consumer_command.go#L1483

fisk.Fatalf("durable name can not contain '.', '*', '>'")

I expected nats.py to validate durable names before sending them to the server and throwing a similar exception.

Server and client version

server: 2.10.23
client: 0.1.5
nats.py: 2.9.0

Host environment

No response

Steps to reproduce

No response

@rstoye rstoye added the defect Suspected defect such as a bug or regression label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

1 participant