Skip to content

Do not rerun failed tests in regrtest on worker bug - #162780

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:regrtest_worker_bug2
Nov 30, 2026
Merged

vstinner merged 1 commit into
python:mainfrom
vstinner:regrtest_worker_bug2

Conversation

@vstinner

Copy link
Copy Markdown
Member

When a test fails with "worker bug", no longer reruns failed tests in verbose mode. Previously, re-running tests in verbose mode failed to run a test called "".

When a test fails with "worker bug", no longer reruns failed tests in
verbose mode. Previously, re-running tests in verbose mode failed to
run a test called "<regrtest worker>".
@vstinner

Copy link
Copy Markdown
Member Author

Example of worker bug on AMD64 FreeBSD14 3.x: https://buildbot.python.org/#/builders/1232/builds/9999

The bug:

Exception ignored in the internal traceback machinery:
object type name: OSError
object repr     : OSError(28, 'No space left on device')
lost sys.stderr
Warning -- regrtest worker thread failed: Traceback (most recent call last):
Warning --   File "/home/buildbot/buildarea/3.x.opsec-fbsd14/build/Lib/test/libregrtest/run_workers.py", line 424, in run
Warning --     mp_result = self._runtest(
Warning --         test_name,
Warning --         module_name if single_process_per_case else None)
Warning --   File "/home/buildbot/buildarea/3.x.opsec-fbsd14/build/Lib/test/libregrtest/run_workers.py", line 377, in _runtest
Warning --     retcode, tmp_files = self.run_tmp_files(worker_runtests,
Warning --                          ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
Warning --                                             stdout_file.fileno())
Warning --                                             ^^^^^^^^^^^^^^^^^^^^^
Warning --   File "/home/buildbot/buildarea/3.x.opsec-fbsd14/build/Lib/test/libregrtest/run_workers.py", line 308, in run_tmp_files
Warning --     tmp_dir = tempfile.mkdtemp(prefix="test_python_")
Warning --   File "/home/buildbot/buildarea/3.x.opsec-fbsd14/build/Lib/tempfile.py", line 440, in mkdtemp
Warning --     _os.mkdir(file, 0o700)
Warning --     ~~~~~~~~~^^^^^^^^^^^^^
Warning -- OSError: [Errno 28] No space left on device: '/tmp/test_python_wnh2v9le'
Kill <WorkerThread #1 running test=test.test_multiprocessing_spawn.test_manager pid=29329 time=25.9 sec> process group
Kill <WorkerThread #2 running test=test_operator pid=29532 time=1.1 sec> process group
Kill <WorkerThread #3 running test=test_regrtest pid=28905 time=1 min 30 sec> process group
Kill <WorkerThread #4 running test=test_math pid=28911 time=1 min 29 sec> process group
Kill <WorkerThread #6 running test=test.test_gdb.test_cfunction_full pid=29528 time=2.0 sec> process group
Kill <WorkerThread #7 running test=test_venv pid=29400 time=15.6 sec> process group
Kill <WorkerThread #8 running test=test_code pid=29530 time=1.7 sec> process group

== Tests result: FAILURE, WORKER BUG ==
(...)
474 tests omitted:
    test___all__ test__interpchannels test__interpreters test__locale
    test__opcode test_abc test_abstract_numbers test_android
    ...
    test_zstd

Then regrtest re-run failed tests in verbose mode, but it fails with ModuleNotFoundError: No module named 'test.<regrtest worker>'.

0:01:30 load avg: 7.30 Re-running 3 failed tests in verbose mode in subprocesses
...
0:01:31 load avg: 7.30 mem:   86.7 MiB [2/3/1] <regrtest worker> failed (uncaught exception)
Re-running <regrtest worker> in verbose mode
test <regrtest worker> crashed -- Traceback (most recent call last):
  ...
ModuleNotFoundError: No module named 'test.<regrtest worker>'

Problem: in the final == Tests result: FAILURE, WORKER BUG then FAILURE ==, the 474 tests omitted are no longer listed. Instead, it says "73 tests OK."

This change should avoid these issues.

@vstinner
vstinner merged commit 352cc06 into python:main Nov 30, 2026
68 checks passed
@vstinner
vstinner deleted the regrtest_worker_bug2 branch November 30, 2026 11:06
vstinner added a commit that referenced this pull request Dec 3, 2026
* gh-155981: Store refleak deltas in arrays (gh-55982)

Store per-run deltas in array objects rather than lists of pooled
integers. Large, unique deltas could otherwise grow int_pool and make
the refleak checker report its own retained integers as reference leaks.

(cherry picked from commit b38e073)

* Fix regrtest rerun: reset worker_bug (#162293)

When a test fails with "worker bug" and tests are rerun in verbose
mode, reset worker_bug so that tests are marked as success if the
failed test doesn't fail again when rerun in verbose mode.

TestResult.write_json_into(file) now calls also file.flush().

(cherry picked from commit f84083b)

* Do not rerun failed tests in regrtest on worker bug (#162780)

When a test fails with "worker bug", no longer reruns failed tests in
verbose mode. Previously, re-running tests in verbose mode failed to
run a test called "<regrtest worker>".

(cherry picked from commit 352cc06)

---------

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
vstinner added a commit that referenced this pull request Dec 3, 2026
)

[3.15] Backport regrtest changes from the main branch (#163045)

* gh-155981: Store refleak deltas in arrays (gh-55982)

Store per-run deltas in array objects rather than lists of pooled
integers. Large, unique deltas could otherwise grow int_pool and make
the refleak checker report its own retained integers as reference leaks.

(cherry picked from commit b38e073)

* Fix regrtest rerun: reset worker_bug (#162293)

When a test fails with "worker bug" and tests are rerun in verbose
mode, reset worker_bug so that tests are marked as success if the
failed test doesn't fail again when rerun in verbose mode.

TestResult.write_json_into(file) now calls also file.flush().

(cherry picked from commit f84083b)

* Do not rerun failed tests in regrtest on worker bug (#162780)

When a test fails with "worker bug", no longer reruns failed tests in
verbose mode. Previously, re-running tests in verbose mode failed to
run a test called "<regrtest worker>".

(cherry picked from commit 352cc06)

---------


(cherry picked from commit 8ea5514)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant