--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: bullseye-pu: package python-hbmqtt/0.9.6-1+deb11u1
- From: Helmut Grohne <helmut@subdivi.de>
- Date: Mon, 13 Dec 2021 15:38:57 +0100
- Message-id: <YbdbAf1mV+rhNyg3@alf.mars>
Package: release.debian.org
Severity: normal
Tags: bullseye
User: release.debian.org@packages.debian.org
Usertags: pu
X-Debbugs-Cc: team+python@tracker.debian.org
Control: found 998912 0.9.6-1
Control: forwarded 998912 https://github.com/beerfactory/hbmqtt/issues/223
python3-hbmqtt can be used for connecting to a mqtt broker or for
running a mqtt broker. I guess that the former is more widespread. The
version of python3-hbmqtt cannot connect to a broker at all.
[ Reason ]
In python the way asyncio Lock objects can be used has changed. This
results in a traceback when the hbmqtt client attempts to acquire such a
Lock object. For full details, please refer to 998912.
[ Impact ]
Any attempt to connect to a mqtt broker using the hbmqtt client fails.
This renders hbmqtt mostly unusable. The fact that nobody noticed
suggests that few people use hbmqtt.
[ Tests ]
If the code had been tested, this would likely have been noticed
earlier. The version in unstable now has autopkgtests to cover for this,
but adding such tests in stable does not seem reasonable to me.
If you run a mqtt broker on localhost (e.g. mosquitto), the following
command can be used to test for the issue:
python3 -c 'from hbmqtt.client import MQTTClient as C; __import__("asyncio").get_event_loop().run_until_complete(C().connect("mqtt://localhost"))'
[ Risks ]
The proposed solution is minimally invasive. It changes precisely the
code that currently raises an exception in a relatively obvious way.
[ Checklist ]
[x] *all* changes are documented in the d/changelog
[x] I reviewed all changes and I approve them
[x] attach debdiff against the package in (old)stable
[x] the issue is verified as fixed in unstable
[ Changes ]
In older versions of python, it was possible to do:
with (yield from somelock): ...
That no longer works. The preferred method now is:
async with somelock: ...
However hbmqtt does not yet use the async/await syntax. So the
contextmanager can be emulated:
yield from somelock.acquire()
try:
....
finally:
somelock.release
While this is verbose, it works in all relevant Python versions.
[ Upstreaming ]
While the proposed fix has not been upstreamed, it has been reported
upstream as https://github.com/beerfactory/hbmqtt/issues/223. The
preferred solution there is switching to the async/await syntax. As
such, upstreaming does not seem reasonable.
[ Hats ]
I am not a python-mqtt maintainer. I intend to NMU this fix. The issue
was fixed in unstable using a NMU by me.
Helmut
diff --minimal -Nru python-hbmqtt-0.9.6/debian/changelog python-hbmqtt-0.9.6/debian/changelog
--- python-hbmqtt-0.9.6/debian/changelog 2020-12-04 23:52:25.000000000 +0100
+++ python-hbmqtt-0.9.6/debian/changelog 2021-12-13 15:16:34.000000000 +0100
@@ -1,3 +1,10 @@
+python-hbmqtt (0.9.6-1+deb11u1) bullseye; urgency=medium
+
+ * Non-maintainer upload.
+ * Fix MQTTClient.connect. (Closes: #998912)
+
+ -- Helmut Grohne <helmut@subdivi.de> Mon, 13 Dec 2021 15:16:34 +0100
+
python-hbmqtt (0.9.6-1) unstable; urgency=low
[ Debian Janitor ]
diff --minimal -Nru python-hbmqtt-0.9.6/debian/patches/fix-connect.patch python-hbmqtt-0.9.6/debian/patches/fix-connect.patch
--- python-hbmqtt-0.9.6/debian/patches/fix-connect.patch 1970-01-01 01:00:00.000000000 +0100
+++ python-hbmqtt-0.9.6/debian/patches/fix-connect.patch 2021-12-13 15:16:17.000000000 +0100
@@ -0,0 +1,15 @@
+--- 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)
diff --minimal -Nru python-hbmqtt-0.9.6/debian/patches/series python-hbmqtt-0.9.6/debian/patches/series
--- python-hbmqtt-0.9.6/debian/patches/series 2020-12-04 23:36:55.000000000 +0100
+++ python-hbmqtt-0.9.6/debian/patches/series 2021-12-13 15:16:02.000000000 +0100
@@ -1 +1,2 @@
0001-Move-scripts-module-into-hbmqtt-module.patch
+fix-connect.patch
--- End Message ---
--- Begin Message ---
We believe that the bug you reported is now fixed; the following
package(s) have been removed from stable:
python-hbmqtt | 0.9.6-1 | source
python3-hbmqtt | 0.9.6-1 | all
------------------- Reason -------------------
RoQA; broken; low popcon; unmaintained
----------------------------------------------
Note that the package(s) have simply been removed from the tag
database and may (or may not) still be in the pool; this is not a bug.
The package(s) will be physically removed automatically when no suite
references them (and in the case of source, when no binary references
it). Please also remember that the changes have been done on the
master archive and will not propagate to any mirrors until the next
dinstall run at the earliest.
Packages are usually not removed from testing by hand. Testing tracks
unstable and will automatically remove packages which were removed
from unstable when removing them from testing causes no dependency
problems. The release team can force a removal from testing if it is
really needed, please contact them if this should be the case.
Bugs which have been reported against this package are not automatically
removed from the Bug Tracking System. Please check all open bugs and
close them or re-assign them to another package if the removed package
was superseded by another one.
The version of this package that was in Debian prior to this removal
can still be found using http://snapshot.debian.org/.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 1001639@bugs.debian.org.
The full log for this bug can be viewed at https://bugs.debian.org/1001639
This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@ftp-master.debian.org.
Debian distribution maintenance software
pp.
Archive Administrator (the ftpmaster behind the curtain)
--- End Message ---