python / python/mypy

Mypy 2.X periodically and inconsistently throws an error

Aperta
#21,484 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

crash
Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia leggendo in mypy/ipc.py intorno a read_bytes e write_bytes, quindi segui mypy/build.py attraverso receive_worker_message e wait_ack. Esegui il comando segnalato con --num-workers=6 su Windows e con la configurazione Python 3.14.5 fornita; il lavoro è completato quando la disconnessione intermittente del worker e l'IPCException possono essere riprodotte e non si verificano più, con una copertura del problema se viene identificata una posizione per il test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.