angr / angr/angr-management

pytest-xdist worker segfaults in join_all_jobs during ProjectOpenTestCase.setUp

オープン
#1,729 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
1.2k
フォーク
131
平均マージ
1日 11時間
マージ済み PR(30日)
14

説明

THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS

### Description

A pytest-xdist worker segfaults during `ProjectOpenTestCase.setUp`, and the run
reports it against whichever test the worker had just picked up. In every
occurrence so far that is
`tests/test_comments.py::TestInlineComments::test_semicolon_key_uses_selected_instruction`,
but the crash is not in that test's body — it is in the shared setUp, before the
test method runs.

The crashing thread:

```
Fatal Python error: Segmentation fault

Thread 0x0000ff8d666df180 (most recent call first):
File ".../tests/conftest.py", line 37 in run_with_trace

... (18 more threads, all logging QueueListener monitors) ...

Current thread 0x0000ff8d6efcb020 (most recent call first):
File ".../angrmanagement/logic/jobmanager.py", line 165 in join_all_jobs
File ".../tests/common.py", line 58 in setUp
File ".../tests/test_comments.py", line 27 in setUp
File ".../unittest/case.py", line 586 in _callSetUp
...
File ".../xdist/remote.py", line 227 in run_one_test
```

`jobmanager.py:165` is the `QApplication.processEvents()` inside
`join_all_jobs`, and the other live thread is the job worker `QThread`. So Qt
dispatches an event to something that is no longer there, left over from an
earlier test in the same worker process.

**This is the same pair of frames as #1648**, closed on 2026-04-27 by #1649. That fix stopped the `HexGraphicsObject` cursor-blink
`QTimer` in `HexGraphicsObjectTestCase.tearDown` (`tests/test_hex_view.py:52`).
It fixed one instance; the class is still open. Two test cases still build a
full `HexView`, whose inner `HexGraphicsObject` owns the same
`cursor_blink_timer`, and neither stops it: `TestHexViewBase`
(`tests/test_hex_view.py:1015`) and `TestHexViewFindBar`
(`tests/test_hex_view.py:2843`). I have not proved that is the leftover object
in this crash — see "what I could not establish" below.

### Steps to reproduce the bug

Run the suite the way CI does and repeat it. It is intermittent.

```
QT_QPA_PLATFORM=offscreen CI=1 pytest tests -q -n 4
```

Locally (x86_64, Python 3.12.13, PySide6 / Qt 6.11.1, offscreen platform) this
crashed on the 2nd of the first 2 full-suite iterations, with the same node id,
the same worker-crash line and the same two frames. `CI=1` only matters because
`MainWindow._init_url_scheme_handler` otherwise blocks on a modal dialog.

Running `tests/test_comments.py` on its own, in one process, did not crash in
2 attempts, so the leftover state appears to come from earlier tests in the
same worker rather than from `test_comments.py` itself.

### How often it fires

Counted over CI job logs, not from memory.

| repo | run | attempt | job | date (UTC) | branch | runner / py | worker |
|---|---|---|---|---|---|---|---|
| angr/angr-management | 33742911297 | 2 | 100681473833 | 2026-09-03T14:15:58Z | `fix/preferences-sidebar-collapse` | ubuntu-24.04-arm / 3.12.3 | gw2 |
| angr/mono | 33998126499 | 1 | 101392148926 | 2026-09-05T23:24:41Z | `ci/typecheck-error-count` | ubuntu-24.04 / 3.12 | gw1 |
| angr/mono | 34029509673 | 1 | 101476386097 | 2026-09-06T11:18:57Z | `rollup/2026-09-06` | ubuntu-24.04 / 3.12 | gw1 |
| angr/mono | 34034508086 | 1 | 101490064067 | 2026-09-06T13:02:06Z | `nix/z3-solver-5` | ubuntu-24.04-arm / 3.12 | gw2 |

All four carry `Fatal Python error: Segmentation fault` and both frames.

Denominators:

- `angr/angr-management`: 4,219 unit-test jobs (`ci / Test (N)`, `Test (N)`,
`Test `) across 702 runs created between 2026-05-02 and 2026-09-06;
155 failed. 54 of those failure logs are still readable — the rest have
expired, and all of the expired ones predate the test file — and **1 of the
54 was this crash**.
- `angr/mono`: 587 angr-management pytest jobs, the whole history of that
repository; 52 failed and **3 were this crash**. The 458 successes were
grepped as well, because `--reruns 2 --only-rerun crashed` can absorb a crash
on some platforms there — none did.

`tests/test_comments.py` was added on 2026-09-02 in 95248d0d (#1718), and
nothing before that date shows the crash. Since then there have been **279**
angr-management pytest jobs — 216 in `angr/angr-management` and 63 in
`angr/mono` — and 4 of them crashed this way. All four are Linux and py3.12;
none on macOS or Windows.

The node id is the same every time because `unittest` sorts test methods
alphabetically, so `test_multiline_comment_falls_back_to_dialog` always runs
immediately before it in that class. Job 100681473833 ran with `-vv`, and the
gw2 lines are:

```
14:15:55.8 [gw2] [ 20%] PASSED tests/test_comments.py::TestInlineComments::test_multiline_comment_falls_back_to_dialog
14:15:58.6 Fatal Python error: Segmentation fault
14:16:02.1 [gw2] node down: Not properly terminated
```

with no other gw2 line in between. The same worker ran the same two tests in
the same order in job 100297035545 on master and both passed, so the ordering
is necessary and not sufficient.

### What I could not establish

Which destroyed object Qt is dispatching into. The `HexView` timer above is a
hypothesis from reading the code and from #1649, not a measurement — I have not
yet got a C-level backtrace out of a crashed worker. Reporting it here rather
than sitting on it, because the reproduction recipe and the run ids are useful
on their own.

### Environment

CI runners as tabulated. Locally reproduced on Linux x86_64, Python 3.12.13,
PySide6 6.11.1 / Qt 6.11.1, `QT_QPA_PLATFORM=offscreen`, angr-management at
68f73135 ("Migrate to clarirs", #1700).

### Additional context

`.github/workflows/ci.yml` runs `uv run pytest -vv -n auto tests` with no
`--forked` and no reruns, so a crashed worker always fails the job.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

session: sharpen

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。