eclipse / paho.mqtt.python

paho.mqtt.python
Other
2.17k stars 723 forks source link

socket.error exception handling removed due to deprecation, but it breaks support for python2.7 #661

Closed Urikiller closed 8 months ago

Urikiller commented 2 years ago

In mqtt/client.py:loop_forever(), the exception handling for self.reconnect() only handles OSError and WebsocketConnectionError, but not socket.error, which causes the thread to crash on timeout for example. This only affects python2.7, since in python3 socket.error is OSError. This issue was fixed some years ago, but on 8/19/2021 in commit 4910b78("Don't use deprecated socker.error exceptions.") the change was reverted back, along with a few other similar patches. Since paho-mqtt still claims to support python2.7 then I believe these patches should be reinstated.

MattBrittan commented 8 months ago

Since paho-mqtt still claims to support python2.7 then I believe these patches should be reinstated.

Sorry for the delay in responding. Unfortunately during that delay support for 2.7 has been dropped meaning it's very unlikely that this issue will be addressed (unless someone is willing to make another 1.6.x release). As a result I'm going to close the issue (please do reopen it if you wish to take this further).

Note: This is part of an exercise to clean up old issues so that the project can move forwards. Due to the number of issues being worked through mistakes will be made; please feel free to reopen this issue (or comment) if you believe it's been closed in error.