File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1027,6 +1027,32 @@ def test_shutdown_deadlock(self):
1027
1027
with self .assertRaises (BrokenProcessPool ):
1028
1028
f .result ()
1029
1029
1030
+ def test_shutdown_deadlock_pickle (self ):
1031
+ # Test that the pool calling shutdown with wait=False does not cause
1032
+ # a deadlock if a task fails at pickle after the shutdown call.
1033
+ # Reported in GH#6034.
1034
+ self .executor .shutdown (wait = True )
1035
+ with self .executor_type (max_workers = 2 ,
1036
+ mp_context = get_context (self .ctx )) as executor :
1037
+ self .executor = executor # Allow clean up in fail_on_deadlock
1038
+
1039
+ # Start the executor and get the queue_management_thread to collect
1040
+ # the threads and avoid dangling thread that should be cleaned up
1041
+ # asynchronously.
1042
+ executor .submit (id , 42 ).result ()
1043
+ queue_manager = executor ._queue_management_thread
1044
+
1045
+ # Submit a task that fails at pickle and shutdown the executor
1046
+ # without waiting
1047
+ f = executor .submit (id , ErrorAtPickle ())
1048
+ executor .shutdown (wait = False )
1049
+ with self .assertRaises (PicklingError ):
1050
+ f .result ()
1051
+
1052
+ # Make sure the executor is eventually shutdown and do not leave
1053
+ # dangling threads
1054
+ queue_manager .join ()
1055
+
1030
1056
1031
1057
create_executor_tests (ExecutorDeadlockTest ,
1032
1058
executor_mixins = (ProcessPoolForkMixin ,
You can’t perform that action at this time.
0 commit comments