-
Notifications
You must be signed in to change notification settings - Fork 72
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
Reconnection example throws "Does not support reentrant" #244
Comments
@westbywest Hi, I can't reproduce it. I use the same code. After restarting the mqtt service. It can still be reconnected normally. |
Hi Ben, Thanks for the minimal example, I can reproduce it on my side 👍 Moving the For reference, we want the client to be reusable, but not reentrant, the corresponding PR is #216 (by @vvanglro, thanks again! 🚀). This is an interesting one! I tested this a bit more thouroughly with a local Docker mosquitto broker that I shut down. With some logging on the exact exception types and on the relevant lock, this gives:
What we see here is that the lock is released when an If I got it right the reason for the lock not being released is that the code already fails inside @vvanglro, are you able to reproduce the error with this extra information? |
I just pushed a script to spin up a local Mosquitto broker via Docker to make it easier to reproduce these steps. After calling the script you should be able to connect to the broker via |
The emqx image I use. Maybe we should catch the exception of connect method and release the lock. |
Sounds good, do you want to make a PR with a fix and a test? 💯 |
next monday i'll take the time to do it. |
Hello, and thank you for the great library. Can you consider tagging a release with the fix? I am running into this exact issue (the |
Done 🙂 Happy to hear that you like aiomqtt! |
Adapting the reconnection example to throw exceptions verbosely:
Subsequent reconnection attempts actually will always fail on "Does not support reentrant," even if the target host becomes available.
For reconnection to succeed, I have to move
client = ...
statement to within the while loop. Is this intended usage, and the example happens to be incorrect?Observed under python 3.10.7, asyncio 3.4.3, aiomqtt 1.1.0.
The text was updated successfully, but these errors were encountered: