-
Notifications
You must be signed in to change notification settings - Fork 727
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
AttributeError: 'NoneType' object has no attribute 'recv' #345
Comments
Dropping back to 1.3.1 and this problem does not happen. Seems like a bug introduced in 1.4 |
I can confirm, the same's happening here. |
With some more debugging I worked around this. The issue was caused by the fact that I was using the multi-threaded loop_forever. What happens is that the socket connection is dropped and then my main thread called reconnect. This causes the socket object to be set to None (null) and then you see this error. I changed my code to use the single threaded loop and it no longer happens. That being said, this is a bug in the paho mqtt code. Also, my previous statement about 1.3.1 fixing it was false. It also happens with that version. |
loop_forever could not and should not be run in multiple thread. We should either add some note in the documentation and/or some kind of assert in the code that reject running loop_forever twice. |
You misread my comment. I did and would not run loop_forever twice. |
What do you mean by the multi-threaded loop_forever ? |
Any ideas on what is causing this? |
This seems to be caused if the client.loop(n>1), and if the client.loop() is not used immediately after client.publish(). |
I had this error when using |
Got the same issue here, sometimes it works sometimes not... After a bit of research I found that I had I've searched a bit in the library, I don't understand how
|
I fixed the problem by switching to use client.loop_start() instead of client.loop_forever() |
I'm running version 1.4 (latest). Code is running on Ubuntu 18.04 in a VirtualBox VM.
I'm seeing the following exception and it happens very reliably. The app does not run very long before this throws.
The text was updated successfully, but these errors were encountered: