@@ -568,19 +568,6 @@ def test_shutdown_no_wait(self):
568
568
# shutdown.
569
569
assert all ([r == abs (v ) for r , v in zip (res , range (- 5 , 5 ))])
570
570
571
- def test_hang_issue45021 (self ):
572
- """https://bugs.python.org/issue45021"""
573
- def submit (pool ):
574
- pool .submit (submit , pool )
575
-
576
- if hasattr (os , 'register_at_fork' ):
577
- with futures .ThreadPoolExecutor (1 ) as pool :
578
- pool .submit (submit , pool )
579
-
580
- for _ in range (50 ):
581
- with futures .ProcessPoolExecutor (1 , mp_context = get_context ('fork' )) as workers :
582
- workers .submit (tuple )
583
-
584
571
585
572
create_executor_tests (ProcessPoolShutdownTest ,
586
573
executor_mixins = (ProcessPoolForkMixin ,
@@ -918,6 +905,20 @@ def test_idle_thread_reuse(self):
918
905
self .assertEqual (len (executor ._threads ), 1 )
919
906
executor .shutdown (wait = True )
920
907
908
+ @unittest .skipUnless (hasattr (os , 'register_at_fork' ), 'need os.register_at_fork' )
909
+ def test_hang_global_shutdown_lock (self ):
910
+ # bpo-45021: _global_shutdown_lock should be reinitialized in the child
911
+ # process, otherwise it will never exit
912
+ def submit (pool ):
913
+ pool .submit (submit , pool )
914
+
915
+ with futures .ThreadPoolExecutor (1 ) as pool :
916
+ pool .submit (submit , pool )
917
+
918
+ for _ in range (50 ):
919
+ with futures .ProcessPoolExecutor (1 , mp_context = get_context ('fork' )) as workers :
920
+ workers .submit (tuple )
921
+
921
922
922
923
class ProcessPoolExecutorTest (ExecutorTest ):
923
924
0 commit comments