-
Notifications
You must be signed in to change notification settings - Fork 285
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
Durable subscription cleanup #759
Comments
You would need to unsubscribe those durables. For instance, using the examples provided in the go-nats-streaming repo, you could do:
then control+C and this will unsubscribe the given durable. Basically you need to call |
Does it possible to get list of all subscribers to durable queue group? |
@vtolstov You could with monitoring: https://github.com/nats-io/nats-streaming-server#channelsz |
I'm prefer some api call, but if this is only one solution, ok. Thank you. |
@kozlovic Thanks for the fast response. I think I have not formulated my question clear enough. Is there any automated cleanup mechanism on the side of nats streaming server that would remove dead durable subscription after some inactivity timeout. I absolutely understand the part of documentation related to closing durable subscription and unsubscribing (including queue group case) from the durable subscription. |
@OleksandrBerezianskyi No, there is no automated way: the point of a durable subscription is that user wants server to keep state while it is offline. You will need to explicitly unsubscribe. |
@kozlovic thanks for confirming that. Just a few final thoughts:
Having that said I think it would be nice to create automated cleanup mechanism for "dead" durable subscriptions that would trigger after some period of inactivity (maybe 1 hour or 1 day depending on the solution). If that sounds logical please let me know. |
The reason of creating a durable subscription is so that the state is maintained while the subscriber is offline. With NATS Streaming, messages are stored regardless of interest, so one can start a non durable subscription after messages have been sent and still receive them (you set the start position in the channel when creating the subscription). |
@kozlovic does this relate to a channel's max inactivity or a message's max age? Suppose we have a channel where no publisher has published in a week and no subscriber has consumed in over a week, and the max inactivity is a week, but there are some durable subscriptions that have not been cleaned up. Would the channel (and its messages) been cleaned up? Suppose the channel has a message over a week old and the message age is 1 week? Would the message be cleaned up? |
max_age will remove messages which timestamp is older than that, but does not mean that when all messages are gone the channel is removed. |
@kozlovic I see, that makes sense. And the message's max age is non negotiable-- that is if a message is over its max age then it will be destroyed no matter what, right? |
Right. max_age will remove a message which timestamp is older than the defined value, regardless if there are subscriptions, etc.. Actually, even if that message was sent to a subscription and not ack'ed, it will still be removed and server will stop trying to redeliver it obviously. |
Awesome. One last question going back to the channels: so if there is a channel whose sole subscription is a durable that IS offline, then the max inactivity will still be enforced, right? For example:
Gotten from the http://localhost:8222/streaming/channelsz?subs=1 endpoint |
Yes, it will be removed. I just ran a quick test with latest release. Note that there was a fix back in 0.12.0:
|
@kozlovic huh, then I think I'm seeing something weird. Running the server on cluster mode w/ debug logs enabled, I see a message like nats-streaming-server/server/server.go Line 2716 in 2e8a792
yet the monitoring url http://localhost:8222/streaming/channelsz still lists channel X in its list. Is that expected? |
Which version are you running? There were quite a bit of issues related to clustering and channel deletion in 0.12.2. If issue persists, please open a new issue in GH. Thanks! |
@kozlovic we are running 0.12.2. Will updating to 0.14 fix it? |
I can't tell since I don't know what the problem is. Could you try to have a reproducible test case that shows the behavior and open an issue? Thanks! |
I tried with a cluster of 3 nodes and max inactivity of 10s. Again, no issue found. In debug mode, here is the type of tracing that you should see:
I have all nodes exposing the monitoring endpoint and channel has disappeared from all 3. |
@kozlovic that is odd. We're in a middle of a deployment release and at 30% message capacity (over 1 week), so we have a bit of a runway. I'll investigate further next week and file an issue accordingly. |
And just to make sure, the channel should NOT be appearing in http://localhost:8222/streaming/channelsz if it's successfully deleted, right? |
Do you see the DBG and INF about that channel being deleted? If not, there may be some issue preventing the deletion. |
@kozlovic does this help? I'm not sure what exactly to be looking for. nats-io nats-streaming-file-nats-streaming-cluster-2 should be master |
Well, which channel you think should have been deleted but was not? Is it in that log? |
I think you should open a new issue really.. :-) |
will do |
(but to answer your question, the one I was grepping for) |
Hi,
I have a question. Let say we have an AWS autoscale group. Every server has a subscription with a unique durable name (for example private IP like "10.10.0.3") for a single channel "events". So every server would receive every message in the channel.
Situation: one of servers fails and is unrecoverable. New server with a new durable subscription is started automatically.
Question: is there any cleanup mechanism that would remove dead "10.10.0.3" subscription from the nats streaming server after some inactivity timeout?
The text was updated successfully, but these errors were encountered: