Skip to content

Syntax error triggers crash in parallel mode #21195

@JukkaL

Description

@JukkaL

Type checking a trivial file t.py with a syntax error seems to trigger a crash if using --num-workers=2:

1 2

Here's what happens:

$ mypy --num-workers=2 --show-traceback t.py
t.py:1: error: Simple statements must be separated by newlines or semicolons  [syntax]
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.0.0+dev.dada3385e78ca558d49e2f6d60f88643847e19c5
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.0.0+dev.dada3385e78ca558d49e2f6d60f88643847e19c5
Traceback (most recent call last):
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/jukka/src/mypy/mypy/build_worker/__main__.py", line 6, in <module>
    console_entry()
  File "/Users/jukka/src/mypy/mypy/build_worker/worker.py", line 273, in console_entry
    main(sys.argv[1:])
  File "/Users/jukka/src/mypy/mypy/build_worker/worker.py", line 105, in main
    serve(server, ctx)
  File "/Users/jukka/src/mypy/mypy/build_worker/worker.py", line 133, in serve
    graph_data = GraphMessage.read(receive(server), manager)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jukka/src/mypy/mypy/build.py", line 5006, in read
    assert read_tag(buf) == GRAPH_MESSAGE
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError:
note: use --pdb to drop into pdb
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/jukka/src/mypy/mypy/build_worker/__main__.py", line 6, in <module>
    console_entry()
  File "/Users/jukka/src/mypy/mypy/build_worker/worker.py", line 273, in console_entry
    main(sys.argv[1:])
  File "/Users/jukka/src/mypy/mypy/build_worker/worker.py", line 105, in main
    serve(server, ctx)
  File "/Users/jukka/src/mypy/mypy/build_worker/worker.py", line 133, in serve
    graph_data = GraphMessage.read(receive(server), manager)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jukka/src/mypy/mypy/build.py", line 5006, in read
    assert read_tag(buf) == GRAPH_MESSAGE
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError:
note: use --pdb to drop into pdb
Found 1 error in 1 file (errors prevented further checking)

cc @ilevkivskyi

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions