From 8b75942077af01342f32bd62e3c22463549a7ee8 Mon Sep 17 00:00:00 2001 From: Ievgen Popovych Date: Wed, 10 Nov 2021 14:02:55 +0200 Subject: [PATCH] NO-JIRA: [Python] Fix exception in IOHandler.on_selectable_expired/update This occasionally happens after my laptop wakes up from overnight sleep. IOHandler.on_selectable_expired() is invoked with `selectable` that has `_terminated=True` and `_transport=None` so when `IOHandler.update()` is called it crashes when trying to handle the exception (since transport is None). Fix this by checking if transport attribute is set and that selectable is not terminated before invoking `IOHandler.update()`. Signed-off-by: Ievgen Popovych --- python/proton/_handlers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/proton/_handlers.py b/python/proton/_handlers.py index c9d1ec21fe..28c3db7a79 100644 --- a/python/proton/_handlers.py +++ b/python/proton/_handlers.py @@ -1234,7 +1234,8 @@ def on_selectable_expired(self, event: Event) -> None: t = s._transport r = s._reactor - self.update(t, s, r.now) + if not s.is_terminal and t: + self.update(t, s, r.now) def on_connection_local_open(self, event: Event) -> None: c = event.connection