From cf4d16c9eab052034f01b69e85f4cb6e25c77a87 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 13 Aug 2025 16:09:41 +0200 Subject: [PATCH 1/2] Add _acquire_restore() to ignored methods This is an internal function used during cleanup, and we can't really do anything about it. Even when correctly using the Python library (e.g. acquiring the semaphore with timeout=0), in some rare cases the something to avoid this call. --- blockbuster/blockbuster.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blockbuster/blockbuster.py b/blockbuster/blockbuster.py index 72f39ff..a749d91 100644 --- a/blockbuster/blockbuster.py +++ b/blockbuster/blockbuster.py @@ -586,7 +586,7 @@ def lock_acquire_exclude( "acquire", can_block_predicate=lock_acquire_exclude, can_block_functions=[ - ("threading.py", {"start"}), + ("threading.py", {"start", "_acquire_restore"}), ("/pydevd.py", {"_do_wait_suspend"}), ("asyncio/base_events.py", {"shutdown_default_executor"}), ], @@ -597,7 +597,7 @@ def lock_acquire_exclude( _thread.LockType, "acquire_lock", can_block_predicate=lock_acquire_exclude, - can_block_functions=[("threading.py", {"start"})], + can_block_functions=[("threading.py", {"start", "_acquire_restore"})], scanned_modules=modules, excluded_modules=excluded_modules, ), From 3c02b43cec2571078c2e865bd65ccba6715cc419 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 21 Aug 2025 19:21:00 +0200 Subject: [PATCH 2/2] Target submit() instead of _acquire_restore() --- blockbuster/blockbuster.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/blockbuster/blockbuster.py b/blockbuster/blockbuster.py index a749d91..93aeac0 100644 --- a/blockbuster/blockbuster.py +++ b/blockbuster/blockbuster.py @@ -586,9 +586,10 @@ def lock_acquire_exclude( "acquire", can_block_predicate=lock_acquire_exclude, can_block_functions=[ - ("threading.py", {"start", "_acquire_restore"}), + ("threading.py", {"start"}), ("/pydevd.py", {"_do_wait_suspend"}), ("asyncio/base_events.py", {"shutdown_default_executor"}), + ("concurrent/futures/thread.py", {"submit"}), ], scanned_modules=modules, excluded_modules=excluded_modules, @@ -597,7 +598,10 @@ def lock_acquire_exclude( _thread.LockType, "acquire_lock", can_block_predicate=lock_acquire_exclude, - can_block_functions=[("threading.py", {"start", "_acquire_restore"})], + can_block_functions=[ + ("threading.py", {"start"}), + ("concurrent/futures/thread.py", {"submit"}), + ], scanned_modules=modules, excluded_modules=excluded_modules, ),