Your message dated Fri, 12 Nov 2021 14:36:17 +0000 with message-id <[email protected]> and subject line Bug#998912: fixed in python-hbmqtt 0.9.6-1.2 has caused the Debian Bug report #998912, regarding python3-hbmqtt: MQTTClient fails connecting to any broker: TypeError: 'Lock' object is not iterable to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected] immediately.) -- 998912: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=998912 Debian Bug Tracking System Contact [email protected] with problems
--- Begin Message ---Package: python3-hbmqtt Version: 0.9.6-1.1 Severity: grave Justification: hbmqtt.client.MQTTClient.connect never works Tags: patch upstream The MQTTClient is not useable at all at present. Trying to connect to any broker results in the following: | Unhandled exception: 'Lock' object is not iterable | Connection failed: TypeError("'Lock' object is not iterable") | Unhandled exception: 'Lock' object is not iterable | Reconnection attempt failed: TypeError("'Lock' object is not iterable") | Unhandled exception: 'Lock' object is not iterable | Reconnection attempt failed: TypeError("'Lock' object is not iterable") | Unhandled exception: 'Lock' object is not iterable | Reconnection attempt failed: TypeError("'Lock' object is not iterable") | Maximum number of connection attempts reached. Reconnection aborted | Traceback (most recent call last): | File "/usr/lib/python3/dist-packages/hbmqtt/client.py", line 149, in connect | return (yield from self._do_connect()) | File "/usr/lib/python3/dist-packages/hbmqtt/client.py", line 234, in _do_connect | return_code = yield from self._connect_coro() | File "/usr/lib/python3/dist-packages/hbmqtt/client.py", line 423, in _connect_coro | return_code = yield from self._handler.mqtt_connect() | File "/usr/lib/python3/dist-packages/hbmqtt/mqtt/protocol/client_handler.py", line 83, in mqtt_connect | yield from self._send_packet(connect_packet) | File "/usr/lib/python3/dist-packages/hbmqtt/mqtt/protocol/handler.py", line 445, in _send_packet | with (yield from self._write_lock): | TypeError: 'Lock' object is not iterable | | During handling of the above exception, another exception occurred: | | Traceback (most recent call last): | File "/usr/lib/python3/dist-packages/hbmqtt/client.py", line 220, in reconnect | return (yield from self._do_connect()) | File "/usr/lib/python3/dist-packages/hbmqtt/client.py", line 234, in _do_connect | return_code = yield from self._connect_coro() | File "/usr/lib/python3/dist-packages/hbmqtt/client.py", line 423, in _connect_coro | return_code = yield from self._handler.mqtt_connect() | File "/usr/lib/python3/dist-packages/hbmqtt/mqtt/protocol/client_handler.py", line 83, in mqtt_connect | yield from self._send_packet(connect_packet) | File "/usr/lib/python3/dist-packages/hbmqtt/mqtt/protocol/handler.py", line 445, in _send_packet | with (yield from self._write_lock): | TypeError: 'Lock' object is not iterable | | During handling of the above exception, another exception occurred: | | Traceback (most recent call last): | File "<string>", line 1, in <module> | File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete | return future.result() | File "/usr/lib/python3/dist-packages/hbmqtt/client.py", line 156, in connect | return (yield from self.reconnect()) | File "/usr/lib/python3/dist-packages/hbmqtt/client.py", line 225, in reconnect | raise ConnectException("Too many connection attempts failed") | hbmqtt.client.ConnectException: Too many connection attempts failed The cause for this is a change in how asyncio Locks work. Their support for the pre-async API based on iterators has ceased, but hbmqtt attempts to do so. Avoiding the context manager does the trick here. Please find a minimal patch fixing the problem attached. In any case, hbmqtt looks quite dead upstream. Maybe replacing it with https://github.com/sbtinstruments/asyncio-mqtt would be better. Helmut--- a/hbmqtt/mqtt/protocol/handler.py +++ b/hbmqtt/mqtt/protocol/handler.py @@ -442,8 +442,11 @@ class ProtocolHandler: @asyncio.coroutine def _send_packet(self, packet): try: - with (yield from self._write_lock): + yield from self._write_lock.acquire() + try: yield from packet.to_stream(self.writer) + finally: + self._write_lock.release() if self._keepalive_task: self._keepalive_task.cancel() self._keepalive_task = self._loop.call_later(self.keepalive_timeout, self.handle_write_timeout)
--- End Message ---
--- Begin Message ---Source: python-hbmqtt Source-Version: 0.9.6-1.2 Done: Helmut Grohne <[email protected]> We believe that the bug you reported is fixed in the latest version of python-hbmqtt, which is due to be installed in the Debian FTP archive. A summary of the changes between this version and the previous one is attached. Thank you for reporting the bug, which will now be closed. If you have further comments please address them to [email protected], and the maintainer will reopen the bug report if appropriate. Debian distribution maintenance software pp. Helmut Grohne <[email protected]> (supplier of updated python-hbmqtt package) (This message was generated automatically at their request; if you believe that there is a problem with it please contact the archive administrators by mailing [email protected]) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Format: 1.8 Date: Fri, 12 Nov 2021 15:10:02 +0100 Source: python-hbmqtt Architecture: source Version: 0.9.6-1.2 Distribution: unstable Urgency: medium Maintainer: Debian Python Team <[email protected]> Changed-By: Helmut Grohne <[email protected]> Closes: 998912 Changes: python-hbmqtt (0.9.6-1.2) unstable; urgency=medium . * Non-maintainer upload with 0-delay: Effectively orphaned inside DPT. * Fix MQTTClient.connect. (Closes: #998912) * Declare compliance with policy 4.6. * Run more of the test suite as autopkgtest. Checksums-Sha1: d9cd202ad2bd6144cdf804b4737c74ff533a87a9 2153 python-hbmqtt_0.9.6-1.2.dsc 93c0ceca8b27778fce8e1f15ba3d7a6e10a488bf 7708 python-hbmqtt_0.9.6-1.2.debian.tar.xz 23cb0a445008995711417b354bead139462d977c 6305 python-hbmqtt_0.9.6-1.2_amd64.buildinfo Checksums-Sha256: 7722e35b692a5d4a16af6e297537824686d3dbf995d4b2d7441fb204664f6798 2153 python-hbmqtt_0.9.6-1.2.dsc bc37b30091cda20dbd82500ac7d49c3b4a9153cbd0afe39deeac670e64b209d3 7708 python-hbmqtt_0.9.6-1.2.debian.tar.xz 312421dacb36307d01459fb08d9ca6ca4ea1787c7e350b9d3e516a97842dc226 6305 python-hbmqtt_0.9.6-1.2_amd64.buildinfo Files: 5a63d35b4452ab808b214e71859cc96c 2153 python optional python-hbmqtt_0.9.6-1.2.dsc 475dc9d40f57fe3fbd568b475f756893 7708 python optional python-hbmqtt_0.9.6-1.2.debian.tar.xz 79858db4aede289962dc0a9f07db2353 6305 python optional python-hbmqtt_0.9.6-1.2_amd64.buildinfo -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEETMLS2QqNFlTb+HOqLRqqzyREREIFAmGOd44ACgkQLRqqzyRE REKJIg//SMnvad7c/rp3v+J64p5wuaMgTEhizrSsSBKZ9ZoIb3fd3BPduxfbtK3d X0VChJ4YGykhlJj9SlZU4SWAmU7tSdYno4AmXeK7s9BbjSU0ZBASDlg3TpF6+13u gJuwtoMynM6IaU2pNQ4/4OvWaEJM33eGzRUYqIVsXJc9fbNoZsQTWnCeYP7eplt9 zcC1ObJ5JeQlrrFUseAM5tgFg+WbTF2Q/V0pyb/dvyYobDjH+CowDqR+Ygx9Og9L A0+2/YzL2RlksXeEapgHz3L/oqOmvtFOK0ijSMArJTO4d/kAkZy/KQT7zfwEnc2i EBiXigLqX1wJkPAv5eIb97P2NtZNML6X+s8MrtPdJ+Pncq8T9h36/fHJO1HFJNc1 r7LhpaJPKyRQhx3a/c6wLGklvi3d1siG4lmqEnOTBZyaYCbcy/9nnqNFp8Vpvp/x dfSpt7ZIZAoC4qcNoKoh2prWfzWHtNn4ZTyLynKtdbjgndOgPAoLHbrr5b5sZg5g KpfHZo3FQQ2Mp5ziRrpevAT6UND06dP4W49RbTAF/wIP0hIgbjqNn1NigXZLrWPE S2vSL+QjwTEd3Af4TwE7xe8KGBXjNpeSQRPYUxY6KnviTDuoUBcPu7NKRmotivdH z5h940ZQWuo+v+Hzy3HXiAOuSo3eoqLJP117L4L8m1mq7HXuqNw= =6OMi -----END PGP SIGNATURE-----
--- End Message ---

