nats-io / nats-streaming-server

NATS Streaming System Server
https://nats.io
Apache License 2.0
2.51k stars 284 forks source link

Durable queue-group subscriptions display empty string as client_id in monitoring endpoints #1188

Closed PBug90 closed 3 years ago

PBug90 commented 3 years ago

I have to clean up some old durable subscriptions with uuid-based client_ids. The monitoring endpoint is displaying an empty string as client_id, making it impossible for me to remove that subscription with a client that subscribes as that client_id and immediately unsubscribes.

{
      "name": "some-channel",
      "msgs": 30,
      "bytes": 15556,
      "first_seq": 135,
      "last_seq": 164,
      "subs_count": 4,
      "subscriptions": [
        {
          "client_id": "",
          "inbox": "_INBOX.ZZ1LR3X0SRBJNQLLQMIW9N",
          "ack_inbox": "_INBOX.7UUQGWD2rtoNlxu21WpSaz",
          "queue_name": "some-durable:some-queue-group",
          "is_durable": true,
          "is_offline": true,
          "max_inflight": 3,
          "ack_wait": 30,
          "last_sent": 12,
          "pending_count": 0,
          "is_stalled": false
        },
}
kozlovic commented 3 years ago

Not sure what's going on here. It used to be like that but LONG time ago (back to pre 0.9.0 version: https://github.com/nats-io/nats-streaming-server/pull/475). What version are you using?

kozlovic commented 3 years ago

I think I can reproduce. Are you running in cluster, standalone or FT mode?

kozlovic commented 3 years ago

I am sorry it took me so long to understand what's going on. For durable queue groups, the client ID does not matter. The report that you see here is to say that there is no currently running member for this queue group. The fact that you don't see the client ID is because there really isn't and the server has probably been restarted since then. To delete this old durable queue subscription, you can use any client ID currently not in use. As long as you create a queue durable on that channel, with the same durable name and queue group, the server will associate your client with this durable queue subscriber. You can then Unsubscribe() it and it will disappear. Let me know if this is clear and if you are able to delete this unwanted durable queue subscription.

PBug90 commented 3 years ago

Thank you for investigating. I am going to try this on Monday and report back.

PBug90 commented 3 years ago

You are correct, simply using an arbitrary client_id and unsubscribing worked. Thank you!