python / python/mypy

Concurrent parallel invocations can lose worker-options files

Open
#21,974 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug parallel checking
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Crash

On Ubuntu 24.04 with Python 3.12 and Mypy 2.3.1, four concurrent Mypy
invocations using --num-workers=4 intermittently failed to start their build
workers. Several workers reported:

FileNotFoundError: [Errno 2] No such file or directory: '.mypy_cache/.worker_options.<id>.data'
Failed to establish connection with worker: No status file found

Full GitHub Actions log:
https://github.com/adamtheturtle/literalizer/actions/runs/34489393511/job/102911865600

The four commands shared the working directory and default .mypy_cache, but
each checked a different temporary Python file. The failure is intermittent;
an unchanged rerun passed. Serializing the invocations and using one Mypy
worker avoids it.

This resembles #21393, but that report is specifically a macOS test failure;
this occurrence was on Linux with concurrent consumer invocations.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test path is named in the report. First reproduce four concurrent Mypy invocations with --num-workers=4 sharing the working directory and default .mypy_cache on Ubuntu 24.04 with Python 3.12, then trace the worker-options files involved; done means concurrent runs no longer raise FileNotFoundError or report a missing status file.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.