-
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
Publishing message will in callback #1175
Comments
Could you share some example code that demonstrates the lockup? There's "quite a few" people publishing in callbacks without problems, so I'm curious what's different in your setup. |
First of it normally works sending the message from the callback as i do not try to force the message out, This is a cut out but it shows the scenario.
|
I had a similar issue with mosquittopp (c++) |
right, so it's not just that you're calling mosuqitto_publish, it's that you're trying to call the loop() handlers as well I can't personally even imagine why you thought that would work at all :) I'll leave someone else to decide what they think should be done, but I'd suggest having a better managed main loop if you need to do "high priority" instant returns. |
Is there any other way to get a message sent ? I am not interested in doing anything else then pushing the message out. |
Not at the moment. The intention is very much that you spend as short a time as possible in the callback. |
Hi I am trying to publish messages directly when I am in a callback as I do not want the process to be interrupted but I want status messages to be sent during the progress.
Found that the mosquitto_loop_write deadlocks in the packet__write function as it tires to lock the
mosq->callback_mutex that is already locked.
One solution is to add a check to se if we already is in a callback and skip this section, don't know enouth about mosquittos internals to know if this is the right way to goo. but it seams to work.
packet_mosq.c
The text was updated successfully, but these errors were encountered: