Skip to content

Commit e1f93ff

Browse files
authored
gh-132097: skip tests raising an explicit SIGSEV when UB sanitizer is on (#132398)
1 parent 05d27a8 commit e1f93ff

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

Lib/test/test_concurrent_futures/test_deadlock.py

+19-15
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,8 @@ def _fail_on_deadlock(self, executor):
111111
print(f"\nTraceback:\n {tb}", file=sys.__stderr__)
112112
self.fail(f"Executor deadlock:\n\n{tb}")
113113

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
117116
self.executor.shutdown(wait=True)
118117

119118
executor = self.executor_type(
@@ -138,65 +137,69 @@ def _check_crash(self, error, func, *args, ignore_stderr=False):
138137
def test_error_at_task_pickle(self):
139138
# Check problem occurring while pickling a task in
140139
# the task_handler thread
141-
self._check_crash(PicklingError, id, ErrorAtPickle())
140+
self._check_error(PicklingError, id, ErrorAtPickle())
142141

143142
def test_exit_at_task_unpickle(self):
144143
# Check problem occurring while unpickling a task on workers
145-
self._check_crash(BrokenProcessPool, id, ExitAtUnpickle())
144+
self._check_error(BrokenProcessPool, id, ExitAtUnpickle())
146145

147146
def test_error_at_task_unpickle(self):
148147
# gh-109832: Restore stderr overridden by _raise_error_ignore_stderr()
149148
self.addCleanup(setattr, sys, 'stderr', sys.stderr)
150149

151150
# Check problem occurring while unpickling a task on workers
152-
self._check_crash(BrokenProcessPool, id, ErrorAtUnpickle())
151+
self._check_error(BrokenProcessPool, id, ErrorAtUnpickle())
153152

153+
@support.skip_if_sanitizer("UBSan: explicit SIGSEV not allowed", ub=True)
154154
def test_crash_at_task_unpickle(self):
155155
# Check problem occurring while unpickling a task on workers
156-
self._check_crash(BrokenProcessPool, id, CrashAtUnpickle())
156+
self._check_error(BrokenProcessPool, id, CrashAtUnpickle())
157157

158+
@support.skip_if_sanitizer("UBSan: explicit SIGSEV not allowed", ub=True)
158159
def test_crash_during_func_exec_on_worker(self):
159160
# Check problem occurring during func execution on workers
160-
self._check_crash(BrokenProcessPool, _crash)
161+
self._check_error(BrokenProcessPool, _crash)
161162

162163
def test_exit_during_func_exec_on_worker(self):
163164
# Check problem occurring during func execution on workers
164-
self._check_crash(SystemExit, _exit)
165+
self._check_error(SystemExit, _exit)
165166

166167
def test_error_during_func_exec_on_worker(self):
167168
# Check problem occurring during func execution on workers
168-
self._check_crash(RuntimeError, _raise_error, RuntimeError)
169+
self._check_error(RuntimeError, _raise_error, RuntimeError)
169170

171+
@support.skip_if_sanitizer("UBSan: explicit SIGSEV not allowed", ub=True)
170172
def test_crash_during_result_pickle_on_worker(self):
171173
# Check problem occurring while pickling a task result
172174
# on workers
173-
self._check_crash(BrokenProcessPool, _return_instance, CrashAtPickle)
175+
self._check_error(BrokenProcessPool, _return_instance, CrashAtPickle)
174176

175177
def test_exit_during_result_pickle_on_worker(self):
176178
# Check problem occurring while pickling a task result
177179
# on workers
178-
self._check_crash(SystemExit, _return_instance, ExitAtPickle)
180+
self._check_error(SystemExit, _return_instance, ExitAtPickle)
179181

180182
def test_error_during_result_pickle_on_worker(self):
181183
# Check problem occurring while pickling a task result
182184
# on workers
183-
self._check_crash(PicklingError, _return_instance, ErrorAtPickle)
185+
self._check_error(PicklingError, _return_instance, ErrorAtPickle)
184186

185187
def test_error_during_result_unpickle_in_result_handler(self):
186188
# gh-109832: Restore stderr overridden by _raise_error_ignore_stderr()
187189
self.addCleanup(setattr, sys, 'stderr', sys.stderr)
188190

189191
# Check problem occurring while unpickling a task in
190192
# the result_handler thread
191-
self._check_crash(BrokenProcessPool,
193+
self._check_error(BrokenProcessPool,
192194
_return_instance, ErrorAtUnpickle,
193195
ignore_stderr=True)
194196

195197
def test_exit_during_result_unpickle_in_result_handler(self):
196198
# Check problem occurring while unpickling a task in
197199
# the result_handler thread
198-
self._check_crash(BrokenProcessPool, _return_instance, ExitAtUnpickle)
200+
self._check_error(BrokenProcessPool, _return_instance, ExitAtUnpickle)
199201

202+
@support.skip_if_sanitizer("UBSan: explicit SIGSEV not allowed", ub=True)
200203
def test_shutdown_deadlock(self):
201204
# Test that the pool calling shutdown do not cause deadlock
202205
# if a worker fails after the shutdown call.
@@ -235,6 +238,7 @@ def test_shutdown_deadlock_pickle(self):
235238
# dangling threads
236239
executor_manager.join()
237240

241+
@support.skip_if_sanitizer("UBSan: explicit SIGSEV not allowed", ub=True)
238242
def test_crash_big_data(self):
239243
# Test that there is a clean exception instead of a deadlock when a
240244
# child process crashes while some data is being written into the

0 commit comments

Comments
 (0)