CLI hangs on BLE connected keyboard interrupt
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 22/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- python
- Bereich
- cli, networking
Rechercherichtung
The hang sits between BLEClient.disconnect and async_await in meshtastic/ble_interface.py, with the disconnect path running through client.py (disconnect, _cleanup_all, on_connected_changed). Reproducing it needs a BLE radio and a Linux host with BlueZ, so start by reading how the blocking .result(timeout) call interacts with the KeyboardInterrupt. Done means a single Ctrl-C exits a --listen session on a BLE-connected device without the atexit traceback.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
I'm looking at integrating Bluetooth connectivity into the TC2-BBS software. I created a simple Python script that connects, waits, and disconnects from a RAK 4631 radio. It connected fine, but when I issue a keyboard interrupt it hung requiring a second Ctrl-C to be entered. I thought that maybe it was my script so I decided to run a listen command from the meshtastic CLI script and it does the same thing:
# meshtastic --ble xx:xx:xx:xx:xx:xx --listen --debug
[... all kinds of good debug connection information displayed ...]
DEBUG file:client.py read_gatt_char line:763 Read Characteristic 2c55e69e-4993-11ed-b878-0242ac120002 | /org/bluez/hci0/dev_F5_1B_B9_6D_B9_81/service0025/char0029: bytearray(b'')
DEBUG file:manager.py _parse_msg line:872 received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F5_1B_B9_6D_B9_81/service0025/char0029): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', b'')>}, []]
DEBUG file:client.py read_gatt_char line:763 Read Characteristic 2c55e69e-4993-11ed-b878-0242ac120002 | /org/bluez/hci0/dev_F5_1B_B9_6D_B9_81/service0025/char0029: bytearray(b'')
I then hit Ctrl-C after a few seconds with the following result:
^CINFO file:__main__.py common line:1323 Exiting due to keyboard interrupt
DEBUG file:client.py disconnect line:391 Disconnecting ({/org/bluez/hci0/dev_F5_1B_B9_6D_B9_81})
DEBUG file:manager.py _parse_msg line:872 received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_F5_1B_B9_6D_B9_81', ['org.bluez.Battery1']]
DEBUG file:manager.py _parse_msg line:872 received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F5_1B_B9_6D_B9_81): ['org.bluez.Device1', {'ServicesResolved': <dbus_fast.signature.Variant ('b', False)>}, []]
DEBUG file:manager.py _parse_msg line:872 received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F5_1B_B9_6D_B9_81): ['org.bluez.Device1', {'Connected': <dbus_fast.signature.Variant ('b', False)>}, []]
DEBUG file:client.py on_connected_changed line:163 Device disconnected (/org/bluez/hci0/dev_F5_1B_B9_6D_B9_81)
DEBUG file:client.py _cleanup_all line:353 _cleanup_all(/org/bluez/hci0/dev_F5_1B_B9_6D_B9_81)
DEBUG file:ble_interface.py _sendToRadioImpl line:208 TORADIO write: 2001
It hung here with not further output. Hitting Ctrl-C again after 10 minutes or so I get:
^CException ignored in atexit callback: <bound method BLEClient.disconnect of <meshtastic.ble_interface.BLEClient object at 0x7f9ba41f10>>
Traceback (most recent call last):
File "/home/brian/TC2-BBS-mesh/venv/lib/python3.11/site-packages/meshtastic/ble_interface.py", line 270, in disconnect
self.async_await(self.bleak_client.disconnect(**kwargs))
File "/home/brian/TC2-BBS-mesh/venv/lib/python3.11/site-packages/meshtastic/ble_interface.py", line 296, in async_await
return self.async_run(coro).result(timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/_base.py", line 451, in result
self._condition.wait(timeout)
File "/usr/lib/python3.11/threading.py", line 320, in wait
waiter.acquire()
KeyboardInterrupt:
#
I'm not sure why the software is writing TORADIO 2001 after the connection has been close, but then again I'm not 100% sure how to read these logs with threading and async stuff thrown in there.
Normally if I were just dealing with this on the CLI I would not care, but it adds an undesired complication when I want to run the TC2-BBS as a service and desire to stop it.
I'm running this software on Raspberry Pi OS "Debian GNU/Linux 12 (bookworm)", on a 2 W device, Python version 3.11.2, meshtastic firmware firmware-rak4631-2.6.10.9ce4455, and the Python meshtastic library version 2.6.3.
I will keep digging into this, but quite frankly I suck at reading/figuring out someone else's code...
Thanks in advance
- Vorherrschende Sprache
- Python
- Sterne
- 855
- Forks
- 355
- Ø Merge
- 3 T. 3 Std.
- Gemergte PRs (30 T.)
- 12
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus meshtastic/python
-
BLE: node unreachable on Linux after pairing — bluez auto-reconnect holds the single connectionOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
meshtastic/python#972 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Bug: Can't run on TermuxEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
meshtastic/python#969 ·
Maintainer antworten meist innerhalb von 1 Tag
-
good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
meshtastic/python#506 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
meshtastic/python#985 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Undocumented `--set` choicesEvtl. vergeben @Cryptoteep hat das vor 54 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 35/100
meshtastic/python#978 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in meshtastic/python
Ähnliche Issues
-
[Bug]: test_remote_realpath_uses_argument_vector fails on Windows with Python 3.13+ (ntpath.isabs)Evtl. vergeben @gouyu-hou hat das heute übernommen. Offentriage/confirmed
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
agentscope-ai/agentscope#4397 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
area/profiles area/sessions comp/desktop desktop/chat desktop/sessions P2 type/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
NousResearch/hermes-agent#161712 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[New Check]: postgresql_flexible_server_public_network_access_disabledEvtl. vergeben @pouria-l hat das heute übernommen. Offenfeature-request status/needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
prowler-cloud/prowler#13615 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
SACGF/variantgrid#2941 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
linkedin/Liger-Kernel#1730 ·
Maintainer antworten meist innerhalb von 3 Tagen