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

Bug: Cancellation of MQTT publish in _broadcast_loop leaves the broker non functional #133

Closed
not-f-elsner opened this issue Feb 2, 2023 · 0 comments · Fixed by #134
Closed

Comments

@not-f-elsner
Copy link
Collaborator

not-f-elsner commented Feb 2, 2023

If a running task in the _broadcast_loop gets cancelled, the whole loop is terminated and the broker left in a non functional state. No more messages will be broadcasted until the broker is shut down and restarted.

It seems there is no additional logic in the broker which would handle the _broadcast_loop terminating (or raising an exception).

Not sure how to replicate this in a unit test, but I can successfully replicate it locally with unclean client disconnect/reconnects.

How to fix
Easiest fix would be to never exit the loop, e.g. simply discard any single tasks that have been cancelled without terminating the whole loop. It is currently cancelled when shutting down the broker.

If we need this logic, we might need more complex waiter logic too (like is done for client connections) to restart the loop after it was cancelled when not shut down intentionally.

Will provide a PR as soon as I'm sure how to adapt the code.

@not-f-elsner not-f-elsner changed the title Bug: Cancellation in _broadcast_loop leaves the broker non functional Bug: Cancellation of MQTT publish in _broadcast_loop leaves the broker non functional Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant