@@ -111,9 +111,8 @@ def _fail_on_deadlock(self, executor):
111
111
print (f"\n Traceback:\n { tb } " , file = sys .__stderr__ )
112
112
self .fail (f"Executor deadlock:\n \n { tb } " )
113
113
114
-
115
- def _check_crash (self , error , func , * args , ignore_stderr = False ):
116
- # test for deadlock caused by crashes in a pool
114
+ def _check_error (self , error , func , * args , ignore_stderr = False ):
115
+ # test for deadlock caused by crashes or exiting in a pool
117
116
self .executor .shutdown (wait = True )
118
117
119
118
executor = self .executor_type (
@@ -138,65 +137,69 @@ def _check_crash(self, error, func, *args, ignore_stderr=False):
138
137
def test_error_at_task_pickle (self ):
139
138
# Check problem occurring while pickling a task in
140
139
# the task_handler thread
141
- self ._check_crash (PicklingError , id , ErrorAtPickle ())
140
+ self ._check_error (PicklingError , id , ErrorAtPickle ())
142
141
143
142
def test_exit_at_task_unpickle (self ):
144
143
# Check problem occurring while unpickling a task on workers
145
- self ._check_crash (BrokenProcessPool , id , ExitAtUnpickle ())
144
+ self ._check_error (BrokenProcessPool , id , ExitAtUnpickle ())
146
145
147
146
def test_error_at_task_unpickle (self ):
148
147
# gh-109832: Restore stderr overridden by _raise_error_ignore_stderr()
149
148
self .addCleanup (setattr , sys , 'stderr' , sys .stderr )
150
149
151
150
# Check problem occurring while unpickling a task on workers
152
- self ._check_crash (BrokenProcessPool , id , ErrorAtUnpickle ())
151
+ self ._check_error (BrokenProcessPool , id , ErrorAtUnpickle ())
153
152
153
+ @support .skip_if_sanitizer ("UBSan: explicit SIGSEV not allowed" , ub = True )
154
154
def test_crash_at_task_unpickle (self ):
155
155
# Check problem occurring while unpickling a task on workers
156
- self ._check_crash (BrokenProcessPool , id , CrashAtUnpickle ())
156
+ self ._check_error (BrokenProcessPool , id , CrashAtUnpickle ())
157
157
158
+ @support .skip_if_sanitizer ("UBSan: explicit SIGSEV not allowed" , ub = True )
158
159
def test_crash_during_func_exec_on_worker (self ):
159
160
# Check problem occurring during func execution on workers
160
- self ._check_crash (BrokenProcessPool , _crash )
161
+ self ._check_error (BrokenProcessPool , _crash )
161
162
162
163
def test_exit_during_func_exec_on_worker (self ):
163
164
# Check problem occurring during func execution on workers
164
- self ._check_crash (SystemExit , _exit )
165
+ self ._check_error (SystemExit , _exit )
165
166
166
167
def test_error_during_func_exec_on_worker (self ):
167
168
# Check problem occurring during func execution on workers
168
- self ._check_crash (RuntimeError , _raise_error , RuntimeError )
169
+ self ._check_error (RuntimeError , _raise_error , RuntimeError )
169
170
171
+ @support .skip_if_sanitizer ("UBSan: explicit SIGSEV not allowed" , ub = True )
170
172
def test_crash_during_result_pickle_on_worker (self ):
171
173
# Check problem occurring while pickling a task result
172
174
# on workers
173
- self ._check_crash (BrokenProcessPool , _return_instance , CrashAtPickle )
175
+ self ._check_error (BrokenProcessPool , _return_instance , CrashAtPickle )
174
176
175
177
def test_exit_during_result_pickle_on_worker (self ):
176
178
# Check problem occurring while pickling a task result
177
179
# on workers
178
- self ._check_crash (SystemExit , _return_instance , ExitAtPickle )
180
+ self ._check_error (SystemExit , _return_instance , ExitAtPickle )
179
181
180
182
def test_error_during_result_pickle_on_worker (self ):
181
183
# Check problem occurring while pickling a task result
182
184
# on workers
183
- self ._check_crash (PicklingError , _return_instance , ErrorAtPickle )
185
+ self ._check_error (PicklingError , _return_instance , ErrorAtPickle )
184
186
185
187
def test_error_during_result_unpickle_in_result_handler (self ):
186
188
# gh-109832: Restore stderr overridden by _raise_error_ignore_stderr()
187
189
self .addCleanup (setattr , sys , 'stderr' , sys .stderr )
188
190
189
191
# Check problem occurring while unpickling a task in
190
192
# the result_handler thread
191
- self ._check_crash (BrokenProcessPool ,
193
+ self ._check_error (BrokenProcessPool ,
192
194
_return_instance , ErrorAtUnpickle ,
193
195
ignore_stderr = True )
194
196
195
197
def test_exit_during_result_unpickle_in_result_handler (self ):
196
198
# Check problem occurring while unpickling a task in
197
199
# the result_handler thread
198
- self ._check_crash (BrokenProcessPool , _return_instance , ExitAtUnpickle )
200
+ self ._check_error (BrokenProcessPool , _return_instance , ExitAtUnpickle )
199
201
202
+ @support .skip_if_sanitizer ("UBSan: explicit SIGSEV not allowed" , ub = True )
200
203
def test_shutdown_deadlock (self ):
201
204
# Test that the pool calling shutdown do not cause deadlock
202
205
# if a worker fails after the shutdown call.
@@ -235,6 +238,7 @@ def test_shutdown_deadlock_pickle(self):
235
238
# dangling threads
236
239
executor_manager .join ()
237
240
241
+ @support .skip_if_sanitizer ("UBSan: explicit SIGSEV not allowed" , ub = True )
238
242
def test_crash_big_data (self ):
239
243
# Test that there is a clean exception instead of a deadlock when a
240
244
# child process crashes while some data is being written into the
0 commit comments