Title: Parallel mode: 'No status file found' INTERNAL ERROR when loading a plugin holds the GIL for more than 3 s · Issue #22024 · python/mypy · GitHub
Open Graph Title: Parallel mode: 'No status file found' INTERNAL ERROR when loading a plugin holds the GIL for more than 3 s · Issue #22024 · python/mypy
X Title: Parallel mode: 'No status file found' INTERNAL ERROR when loading a plugin holds the GIL for more than 3 s · Issue #22024 · python/mypy
Description: Crash Report With -n 2, mypy fails with "Failed to establish connection with worker: No status file found" although both workers started and wrote their status files in time. build() starts the workers and their connect() threads before ...
Open Graph Description: Crash Report With -n 2, mypy fails with "Failed to establish connection with worker: No status file found" although both workers started and wrote their status files in time. build() starts the wor...
X Description: Crash Report With -n 2, mypy fails with "Failed to establish connection with worker: No status file found" although both workers started and wrote their status files in time. build() star...
Opengraph URL: https://github.com/python/mypy/issues/22024
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Parallel mode: 'No status file found' INTERNAL ERROR when loading a plugin holds the GIL for more than 3 s","articleBody":"**Crash Report**\n\nWith `-n 2`, mypy fails with \"Failed to establish connection with worker: No status file found\" although both workers started and wrote their status files in time. `build()` starts the workers and their `connect()` threads before `build_inner()` loads plugins. If a plugin import holds the GIL past the 3 s `WORKER_START_TIMEOUT`, the threads cannot poll, and when they next run the loop has timed out and exits without reading the status file again.\n\nWe hit this in PyVista, whose plugin imports VTK, on the first run in a new environment. On macOS the first `dlopen()` of a newly installed binary waits for an XProtect scan while holding the GIL, so that import blocks for 12 to 17 s (0.12 s afterwards). In one failing run the workers wrote their status files 1.2 s after spawn, and the coordinator was still in the plugin import 12 s later.\n\nReading the status file once more after the deadline fixes the `ctypes` reproduction below (tested on master):\n\n```diff\n--- a/mypy/build.py\n+++ b/mypy/build.py\n@@ -289,11 +289,13 @@ class WorkerClient:\n def connect(self) -> None:\n end_time = time.time() + WORKER_START_TIMEOUT\n last_exception: Exception | None = None\n- while time.time() \u003c end_time:\n+ while True:\n try:\n data = read_status(self.status_file)\n except BadStatus as exc:\n last_exception = exc\n+ if time.time() >= end_time:\n+ break\n time.sleep(WORKER_START_INTERVAL)\n continue\n try:\n```\n\nIt does not reliably fix the VTK case: when the stall outlasts the worker's own 10 s `WORKER_CONNECTION_TIMEOUT`, the worker has stopped waiting and the run fails with `Failed to establish connection with worker: [Errno 2] No such file or directory` instead. Starting the workers after plugins are loaded may avoid both. It would also help to report this as an ordinary error rather than an INTERNAL ERROR. #21969 and #21974 look similar but have different causes.\n\n**Traceback**\n\n```python-traceback\nerror: INTERNAL ERROR -- Please try using mypy master on GitHub:\nhttps://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build\nPlease report a bug at https://github.com/python/mypy/issues\nversion: 2.3.1\nnote: use --pdb to drop into pdb\nFailed to establish connection with worker: No status file found\nFailed to establish connection with worker: No status file found\nTraceback (most recent call last):\n File \".../venv/lib/python3.14/site-packages/mypy/__main__.py\", line 16, in console_entry\n main()\n ~~~~^^\n File \"mypy/main.py\", line 154, in main\n File \"mypy/main.py\", line 244, in run_build\n File \"mypy/build.py\", line 422, in build\n File \"mypy/build.py\", line 537, in build_inner\n File \"mypy/build.py\", line 4145, in dispatch\nOSError: Cannot connect to build worker(s): 0, 1\n```\n\n**To Reproduce**\n\nA plugin that holds the GIL for 4 s. This fails on every run, with 2.3.1 and with master; `sleep(2)` passes.\n\n```bash\nmkdir pkg && echo 'x: int = 1' > pkg/__init__.py\ncat > gil_plugin.py \u003c\u003c'EOF'\nimport ctypes\n\nfrom mypy.plugin import Plugin\n\n# Hold the GIL for 4 s, as a slow import of a compiled extension can.\nctypes.PyDLL(None).sleep(4)\n\n\ndef plugin(version: str) -> type[Plugin]:\n return Plugin\nEOF\nprintf '[mypy]\\nplugins = gil_plugin.py\\n' > mypy.ini\nmypy -n 2 --show-traceback pkg\n```\n\nOn macOS, `import vtkmodules.vtkRenderingCore` in place of the `ctypes` lines, in a new venv with `mypy==2.3.1 vtk==9.7.0`, fails on the first run and passes on the second. Precompiling bytecode (`UV_COMPILE_BYTECODE=1`) makes no difference.\n\n**Your Environment**\n\n- Mypy version used: 2.3.1 (compiled: yes), and master at b645e069c (from git, not compiled)\n- Mypy command-line flags: `-n 2 --show-traceback`\n- Mypy configuration options from `mypy.ini` (and other config files): `plugins = gil_plugin.py`\n- Python version used: 3.14.0 and 3.14.5\n- Operating system and version: macOS 26.6.2, arm64 (the `ctypes` reproduction should not be macOS-specific, but I only ran it there)\n\nInvestigated and drafted with Claude Code (Claude Opus 5.5).","author":{"url":"https://github.com/user27182","@type":"Person","name":"user27182"},"datePublished":"2026-09-22T21:12:27Z","url":"https://github.com/python/mypy/issues/22024"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3ab1b592-b939-e63e-8351-91f7d9b3f1e7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E76C:120A77:22E11F3:2F80E7F:6B002CFC |
| html-safe-nonce | e09222ab6003b329478b771e6c652aa25eb48567ae6734826f1b546ce3312eb9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzZDOjEyMEE3NzoyMkUxMUYzOjJGODBFN0Y6NkIwMDJDRkMiLCJ2aXNpdG9yX2lkIjoiMzE0MDczMTU0MTc4NTY4NTI0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1647d39d3990f2ffc3bab2a65e58ca26eeed1e39f392d8cae13ad93f6aef8825 |
| hovercard-subject-tag | issue:5545314277 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/22024/issue_layout |
| twitter:image | https://opengraph.githubassets.com/801aebe275b0bfe0ab8c208c4e27104e09b44897c10a8c3f23463ac127551782/python/mypy/issues/22024 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/801aebe275b0bfe0ab8c208c4e27104e09b44897c10a8c3f23463ac127551782/python/mypy/issues/22024 |
| og:image:alt | Crash Report With -n 2, mypy fails with "Failed to establish connection with worker: No status file found" although both workers started and wrote their status files in time. build() starts the wor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | user27182 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width