-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I've been investigating home-assistant/core#130548 for well over a year now and have a theory for why it might be happening. I suspect flush is hanging, causing ZHA to hang indefinitely during integration shutdown: it gets stuck in a zombie state where the integration is no longer running but is not shut down yet, since shutdown() has been called but connection_lost has not yet fired. This is catastrophic.
I've found a few hints pointing to to flush() being the culprit: pyserial/pyserial#625 (tcdrain hanging, there are tons of questions online about tcdrain)
We should investigate whether pyserial's handling of this is valid: should we be calling tcdrain? tcflush? Neither? Should they be allowed to time out?
Pyserial development is dead so I think if this is indeed a bug that we cannot fix from this package, we need to consider investing minimal resources in switching to something else. (While development is put on the backburner for now, https://github.com/puddly/serialpy is mostly feature complete, features async APIs for interacting with modem lines for pin signaling, and works on all POSIX platforms π)