-
Notifications
You must be signed in to change notification settings - Fork 220
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
Stale inflight messages #86
Comments
Are you using persistence? This sounds similar to #76 - typically inflights shouldn't really occur in normal use case. They certainly shouldn't be increasing indefinitely in this way. Currently inflight messages are only resent when the client reconnects. It would be nice to have a periodic retry, however it needs a bit of thought to avoid creating unnecessary overhead. |
Im not using any persistence storage. Any my clients wasnt disconnected, so those inflight messages will stay there forever ;) For now i will implement periodic ResendClientInflight on my end. |
That's very unusual... Can you provide some more information about your client library, use (qos, etc)? It would be good to determine the issue in case it's something which can be fixed. |
I didnt do much debuging yet, and not sure which messages are inflight. Will investigate further. And to be precise, i observe couple (4-10) of inflights per week or two - so im almost sure that this is issue with consumers/networking and not |
So i have some funny findings regarding that one. As a PoC i added:
Just to check that running But today, Prometheus start complaining that i have some in-flight messages. I build prometheus metric by reading And from I see that potentialy it can happend somewhere here https://github.com/mochi-co/mqtt/blob/27f3c484ad65bb34cd4c1de12cbb91b8be16dabd/server/server.go#L885 when packet is not Publish packet. In my case publishDropped is not increased (still showing 0). Any idea what im missing? My code: https://github.com/bkupidura/broker-ha/blob/debug-inflight/server/server.go |
@mochi-co possibly i found root cause for those in-flight messages. When new client subscribes with QoS 2, looks like its remembered by This will not work, as clients are identified by Moreover in my case, client can reconnect to different For debugging i enabled bolt store to check what is there.
Message in store
I believe that when client is disconnected, we should have possibility to remove his subscriptions - even if QoS 2 was set, as this client can never reconnect. |
@bkupidura This looks very interestin and I suspect you are correct. Apologies I have been very busy lately. I will do my best to look into this as a priority in depth soon 👍🏻 |
Fixed in v1.3.0 with new TTL/period resend support for inflight messages. @bkupidura Please give it a test and close the issue if it solves the problem :) |
@mochi-co thanks! I just deployed new version and looks good. Inflights are indeed cleared. There is just small thing, after |
@bkupidura Ahhh yes I knew I'd forgotten something. I'll add it to the list! |
@mochi-co if you dont mind, i can prepare PR for that. My idea is that |
@bkupidura That would be wonderful! :) I think that's the most effective approach too. |
I start observing increased number of inflight messages which are almost never going down. In same time i didnt notice any disconnects from clients - so looks like clients just didnt received message and they will never send ACK (network issue on client side?)
I see that there is
ResendClientInflight
(https://github.com/mochi-co/mqtt/blob/master/server/server.go#L878), but looks like its executed only on new client connection (send messages from persistence store to reconnecting clients?).Is there any internal mechanism which will try to deliver inflight messages or
mochi-co/mqtt
user should implement this on his own?The text was updated successfully, but these errors were encountered: