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

Do not deadlock when disconnection corner case happens #58

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Annopaolo
Copy link
Collaborator

If a device were to disconnect from the broker before having sent its introspection, the connection lost handler would deadlock trying to acquire the lock on the inflight message queue which is still locked.
Fix this by moving the first lock to the connection handler, and check that another lock attempt is performed when connection is lost only if the device is not allowed to reconnect. This still guarantees that the inflight message queue lock is released only when (eventually) the introspection is sent.

@Annopaolo Annopaolo added the bug Something isn't working label Sep 14, 2023
If a device were to disconnect from the broker before having sent
its introspection, the connection lost handler would deadlock
trying to acquire the lock on the inflight message queue which is
still locked.
Fix this by moving the first lock to the connection handler,
and check that another lock attempt is performed when connection
is lost only if the device is not allowed to reconnect.
This still guarantees that the inflight message queue lock is
released only when (eventually) the introspection is sent.

Signed-off-by: Arnaldo Cesco <arnaldo.cesco@secomind.com>
@Annopaolo Annopaolo force-pushed the prevent-deadlock-introspection-connection-lost branch from e664666 to 8d85b1d Compare September 25, 2023 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant