[PATCH b4 03/27] review: close the messages database when auto-marking fails
Christian Brauner <[email protected]> Fri, 31 Jul 2026 11:21:02 +0200
| Newsgroups | org.kernel.linux.tools |
|---|---|
| Message-ID | <20260731-work-b4-editor-branch-guard-v1-3-de68a7c8e4cb@kernel.org> |
The auto-mark block opens the messages database and closes it in its last statement, inside the same try that swallows every failure. If anything raises before that we never reach the close and the connection leaks. An unreadable thread blob, a locked database or a message without a parseable date will all do it. The tracking UI updates every tracked series on each refresh, so this leaks once per series per refresh in a process that stays around. Close it in a finally instead. Signed-off-by: Christian Brauner (Amutable) <[email protected]> --- src/b4/review/_review.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/b4/review/_review.py b/src/b4/review/_review.py index cba3a0f..da20fc4 100644 --- a/src/b4/review/_review.py +++ b/src/b4/review/_review.py @@ -2596,6 +2596,7 @@ def update_series_tracking( # so the unread badge below never lights up for them. seen_bump = 0 if thread_msgs and change_id: + mconn = None try: from b4.review import messages @@ -2619,9 +2620,11 @@ def update_series_tracking( for mid in new_msgids if 'Seen' in flags_map.get(mid, '').split() ) - mconn.close() except Exception as ex: logger.debug('Could not auto-mark own messages as read: %s', ex) + finally: + if mconn is not None: + mconn.close() # Update message count and thread blob from the already-fetched # thread messages. No status filtering here: the thread is already -- 2.53.0