python / python/mypy

Mypy 2.X periodically and inconsistently throws an error

Open
#21,484 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

crash
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Crash Report

Mypy 2.X periodically and inconsistently throws an error

Traceback

Exception in thread Thread-7 (write_bytes):
Exception in thread Thread-8 (write_bytes):
Exception in thread Thread-9 (write_bytes):
Exception in thread Thread-10 (write_bytes):
Exception in thread Thread-11 (write_bytes):
Exception in thread Thread-12 (write_bytes):
Traceback (most recent call last):
Traceback (most recent call last):
  File "mypy\ipc.py", line 158, in write_bytes
Traceback (most recent call last):
Traceback (most recent call last):
OSError: [WinError 233] С обоих концов канала отсутствуют процессы
  File "mypy\ipc.py", line 158, in write_bytes
Traceback (most recent call last):
  File "mypy\ipc.py", line 158, in write_bytes
Traceback (most recent call last):
  File "mypy\ipc.py", line 158, in write_bytes

During handling of the above exception, another exception occurred:

OSError: [WinError 233] С обоих концов канала отсутствуют процессы
  File "mypy\ipc.py", line 158, in write_bytes
    ov, err = _winapi.WriteFile(self.connection, encoded_data, overlapped=True)
OSError: [WinError 233] С обоих концов канала отсутствуют процессы
  File "mypy\ipc.py", line 158, in write_bytes
    ov, err = _winapi.WriteFile(self.connection, encoded_data, overlapped=True)
OSError: [WinError 233] С обоих концов канала отсутствуют процессы
Traceback (most recent call last):

During handling of the above exception, another exception occurred:

OSError: [WinError 233] С обоих концов канала отсутствуют процессы

During handling of the above exception, another exception occurred:

OSError: [WinError 233] С обоих концов канала отсутствуют процессы

During handling of the above exception, another exception occurred:

  File "C:\Users\user\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1082, in _bootstrap_inner
    self._context.run(self.run)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
Traceback (most recent call last):

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1024, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1082, in _bootstrap_inner
    self._context.run(self.run)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1082, in _bootstrap_inner
    self._context.run(self.run)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1082, in _bootstrap_inner
    self._context.run(self.run)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "mypy\ipc.py", line 174, in write_bytes
  File "C:\Users\user\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1024, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1082, in _bootstrap_inner
    self._context.run(self.run)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1024, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1082, in _bootstrap_inner
    self._context.run(self.run)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1024, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mypy.ipc.IPCException: Failed to write with error: 233
  File "mypy\ipc.py", line 174, in write_bytes
  File "C:\Users\user\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1024, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "mypy\ipc.py", line 174, in write_bytes
  File "C:\Users\user\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1024, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "mypy\ipc.py", line 174, in write_bytes
mypy.ipc.IPCException: Failed to write with error: 233
  File "mypy\ipc.py", line 174, in write_bytes
    raise IPCException(f"Failed to write with error: {e.winerror}") from e
mypy.ipc.IPCException: Failed to write with error: 233
mypy.ipc.IPCException: Failed to write with error: 233
mypy.ipc.IPCException: Failed to write with error: 233
  File "mypy\ipc.py", line 174, in write_bytes
    raise IPCException(f"Failed to write with error: {e.winerror}") from e
mypy.ipc.IPCException: Failed to write with error: 233
error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 2.1.0
Traceback (most recent call last):
  File "mypy\build.py", line 1392, in receive_worker_message
    return receive(self.workers[idx].conn)
  File "mypy\ipc.py", line 479, in receive
    bdata = connection.read_bytes()
  File "mypy\ipc.py", line 101, in read_bytes
    ov, err = _winapi.ReadFile(self.connection, size, overlapped=True)
OSError: [WinError 233] С обоих концов канала отсутствуют процессы

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 203, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\Dev\strana\contracts-backend\.venv\Lib\site-packages\mypy\__main__.py", line 16, in console_entry
    main()
    ~~~~^^
  File "mypy\main.py", line 154, in main
  File "mypy\main.py", line 244, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "mypy\build.py", line 422, in build
  File "mypy\build.py", line 537, in build_inner
    graph = dispatch(sources, manager, stdout, connect_threads)
  File "mypy\build.py", line 4150, in dispatch
    process_graph(graph, manager)
  File "mypy\build.py", line 4587, in process_graph
    manager.wait_ack()
  File "mypy\build.py", line 1386, in wait_ack
    buf = self.receive_worker_message(idx)
  File "mypy\build.py", line 1400, in receive_worker_message
    raise OSError(
OSError: Worker 0 disconnected before sending data (exit code 0)

note: use --pdb to drop into pdb

To Reproduce
Idk how reproduce it :( It's random

Your Environment

  • Mypy version used: 2.1.0
  • Mypy command-line flags: mypy src tests main.py --num-workers=6 --show-traceback
  • Mypy configuration options from mypy.ini (and other config files): pyproject.toml
[tool.mypy]
allow_redefinition = false
disallow_any_explicit = false
exclude = "(alembic)|(src/ignored)|src/t.py|(_entrypoints)|(tests/factories)|src/core/docx_templating/docx_templating.py"
follow_imports = "silent"
ignore_errors = false
ignore_missing_imports = true
local_partial_types = true
mypy_path = "src ."
no_implicit_optional = true
plugins = [
  "pydantic.mypy",
]
python_version = 3.14
strict = true
strict_optional = true
warn_no_return = true
warn_return_any = true
warn_unreachable = false

pretty = true
show_column_numbers = true
show_error_codes = true

[[tool.mypy.overrides]]
disable_error_code = ["name-defined", "misc", "var-annotated", "attr-defined", "no-untyped-call"]
module = "tests.factories.*"

[[tool.mypy.overrides]]
disable_error_code = ["assignment", "misc", "var-annotated", "attr-defined", "arg-type"]
ignore_errors = true
module = [
  "core.docx_templating.*",
]
  • Python version used: 3.14.5
  • Operating system and version: Windows 10 Pro, build 19043

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

Start by reading mypy/ipc.py around read_bytes and write_bytes, then follow mypy/build.py through receive_worker_message and wait_ack. Run the reported command with --num-workers=6 on Windows and the provided Python 3.14.5 configuration; done means the intermittent worker disconnect and IPCException can be reproduced and no longer occurs, with coverage for the failure if a test location is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.