Skip to content

Commit a24b9d4

Browse files
committed
Mitigate Python 3.12 shutdown RuntimeError
Python 3.12 introduced a bug during the interpreter shutdown, see: - issue python/cpython#104826 - bugfix python/cpython#117029 With Python 3.12.3, this change could potentially be reverted (after testing).
1 parent c59a834 commit a24b9d4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

server/fishtest/rundb.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,16 @@ def get_run(self, r_id):
361361
return None
362362

363363
def start_timer(self):
364-
self.timer = threading.Timer(1.0, self.flush_buffers)
365-
self.timer.start()
364+
try:
365+
self.timer = threading.Timer(1.0, self.flush_buffers)
366+
self.timer.start()
367+
except RuntimeError as e:
368+
# Mitigation for a 3.12 bug during the interpreter shutdown, see:
369+
# - issue https://github.com/python/cpython/pull/104826
370+
# - bugfix https://github.com/python/cpython/pull/117029
371+
# With python 3.12.3 the try except block could be potentially removed.
372+
if "interpreter shutdown" not in str(e):
373+
raise
366374

367375
def buffer(self, run, flush):
368376
with self.run_cache_lock:

0 commit comments

Comments
 (0)