nats-io / nats-server

High-Performance server for NATS.io, the cloud and edge native messaging system.
https://nats.io
Apache License 2.0
15.27k stars 1.37k forks source link

`server_name` with Space characters breaks reply routing for leaf nodes. #5633

Closed codegangsta closed 1 week ago

codegangsta commented 2 weeks ago

Observed behavior

When setting server_name to a string with a " " in it, like "My Server", results in replies not being delivered to a requestor, when the requestor lives on the hub and the replier living on a leaf node.

Expected behavior

I would expect it to work as intended or throw a validation error/warning when trying to connect as a leaf node.

Server and client version

nats-server - 2.10.17 nats-cli - (devel) main

Host environment

MacOS on M1 Mac studio for leaf node, Synadia Cloud for hub.

Steps to reproduce

  1. Create a leaf node that connects into a hub (any sort of auth works fine here)
  2. Set the server_name of the leaf node to "My Server" (or anything with a space on it)
  3. Add a replier to the leaf node nats reply hello.world --echo --context leaf
  4. Make a request from the hub nats req hello.world hihi --context hub
  5. Observe that the request is received by the leaf node client, but the reply is never sent.

When the server_name has no spaces, I don't encounter this issue

Jarema commented 2 weeks ago

I think throwing validation error would be a better solution here, as spaces are troublesome, especially in NATS context. Such validation could be considered technically breaking, but at the system that already does not properly work, so not sure if that can break any proper systems.