-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
mosquitto_sub hits deadlock when using the -W (timeout) options #3175
Labels
Status: Available
No one has claimed responsibility for resolving this issue.
Comments
github-actions
bot
added
the
Status: Available
No one has claimed responsibility for resolving this issue.
label
Nov 29, 2024
Another case this time occurring in the packet__queue function: On a Linux target, using mosquitto 2.0.18:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The mosquitto_sub client can end in a deadlock in certain scenarios when the timeout option (`-W) is set.
The client utilizes alarm() to set a signal handler that triggers once the timeout expires. However, this can result in a deadlock condition in the following case:
&mosq->log_callback_mutex
is taken in log__printflog__printf
will try to acquire the lock on the same mutex from step 1: deadlock.This is somewhat difficult to reproduce, but I've found the issue will investigating what we think is #2887 and a variation of #2887 (comment) seems to be the best bet to end up in the same case.
So:
for i in {0..20000}; do echo $i; mosquitto_pub -t "retained/$i" -m $i -r -q 0 ; done
mosquitto_sub --retained-only --remove-retained -W 1 -F %t -t "retained/+" -d
Environment and version
Backtrace from GDB:
The text was updated successfully, but these errors were encountered: