On an unsolicited disconnect, bleak calls the disconnect callback (set to self.close()) on its own event-loop thread. close() then calls self._eventThread.join(...), i.e. joining the current thread, which raises RuntimeError: cannot join current thread, so cleanup doesn't finish (self.client is left set and _disconnected() never runs).
Pre-existing and separate from the hang fix in #967. A fix probably needs close()/disconnect() to notice when they're running on the event-loop thread and avoid joining/blocking it.
Seen on Linux, Python 3.14, bleak 2.1.1, RAK4631 (platform-independent).
On an unsolicited disconnect, bleak calls the disconnect callback (set to
self.close()) on its own event-loop thread.close()then callsself._eventThread.join(...), i.e. joining the current thread, which raisesRuntimeError: cannot join current thread, so cleanup doesn't finish (self.clientis left set and_disconnected()never runs).Pre-existing and separate from the hang fix in #967. A fix probably needs
close()/disconnect()to notice when they're running on the event-loop thread and avoid joining/blocking it.Seen on Linux, Python 3.14, bleak 2.1.1, RAK4631 (platform-independent).