facebook / pyre-check

Performant type-checking for python.
https://pyre-check.org/
MIT License
6.79k stars 432 forks source link

Incremental check hangs on OS X #868

Closed mgorven closed 1 month ago

mgorven commented 3 months ago

Pyre Bug

Bug description Since v0.9.21 incremental check (pyre) hangs on OS X. Incremental check works on Linux on the same codebase. Non-incremental check (pyre check) works on OS X, as does sequential check (pyre --sequential). Output displays ƛ [188.6s] and continues counting.

I built Pyre from source to bisect the problem. Everything works on 219981180. On d7ddc4088 it fails quickly and displays a stacktrace. This continues until 090e07967 where it just hangs.

Reproduction steps Run pyre.

Expected behavior Expect it to work in ~20s.

Logs Stacktrace on d7ddc4088:

ƛ Raised by primitive operation at Exception.get_current_callstack_string in file "exception.ml", line 71, characters 37-61
ƛ Called from Server__ServerError.kind_and_message_from_exception in file "server/serverError.ml", line 76, characters 23-65
ƛ Called from Commands__ServerCommand.start_server_and_wait.(fun) in file "command/serverCommand.ml", line 274, characters 30-84
ƛ Called from Lwt.Sequential_composition.catch.create_result_promise_and_callback_if_deferred. in file "src/core/lwt.ml", line 2030, characters 23-28
ƛ Called from Lwt.Resolution_loop.run_callbacks.run_regular_callbacks.iter_callback_list in file "src/core/lwt.ml", line 1196, characters 10-18
ƛ Called from Lwt.Resolution_loop.run_in_resolution_loop in file "src/core/lwt.ml", line 1262, characters 17-21
ƛ Called from Lwt.Resolution_loop.resolve in file "src/core/lwt.ml", line 1298, characters 4-103
ƛ Called from Lwt.Sequential_composition.bind.create_result_promise_and_callback_if_deferred.c in file "src/core/lwt.ml", line 1863, characters 12-72
ƛ Called from Lwt.Resolution_loop.run_callbacks.run_regular_callbacks.iter_callback_list in file "src/core/lwt.ml", line 1196, characters 10-18
ƛ Called from Lwt.Resolution_loop.leave_resolution_loop in file "src/core/lwt.ml", line 1254, characters 8-38
ƛ Called from Lwt.Resolution_loop.run_in_resolution_loop in file "src/core/lwt.ml", line 1263, characters 4-42
ƛ Called from Lwt.Resolution_loop.resolve in file "src/core/lwt.ml", line 1298, characters 4-103
ƛ Called from Lwt.Resolving.wakeup_general in file "src/core/lwt.ml", line 1372, characters 37-76
ƛ Called from Stdlib__Array.iter in file "array.ml", line 95, characters 31-48
ƛ Called from Lwt_sequence.iter_l.loop in file "src/core/lwt_sequence.ml", line 132, characters 31-47
ƛ Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
ƛ Called from Lwt_engine.select_based#iter in file "src/unix/lwt_engine.ml", line 359, characters 4-63
ƛ Called from Lwt_main.run.run_loop in file "src/unix/lwt_main.ml", line 41, characters 6-49
ƛ Called from Lwt_main.run in file "src/unix/lwt_main.ml", line 118, characters 8-13
ƛ Called from Commands__ServerCommand.run_server in file "command/serverCommand.ml", line 319, characters 8-94
ƛ Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 24, characters 19-24
ƛ Called from Cmdliner_eval.run_parser in file "cmdliner_eval.ml", line 34, characters 37-44
ƛ Called from Cmdliner_eval.eval_value in file "cmdliner_eval.ml", line 202, characters 14-39
ƛ Called from Cmdliner_eval.eval in file "cmdliner_eval.ml", line 252, characters 2-45
ƛ Called from Dune__exe__Main.run in file "main.ml", line 33, characters 2-42
ƛ Called from Dune__exe__Main in file "main.ml", line 40, characters 4-10
ƛ

Rage on d7ddc4088: rage-d7ddc408.txt Rage on 090e07967: rage-090e0796.txt

samwgoldman commented 3 months ago

Hi @mgorven, thanks for the detailed investigation! Sorry for the trouble here. I'll look into this.

samwgoldman commented 2 months ago

This is still on my radar. Since you are able to reproduce and build Pyre locally, could you also try on b247db1890372df6a46f2addc07ac9d710497da5? The revisions leading up to that one improve on the error output when things go wrong.

mgorven commented 2 months ago

rage-b247db1.txt

ryan-ph commented 1 month ago

I think I have been running in to a similar issue though I have not been able to find time to debug as thoroughly as what has already been done. Anecdotally, I have had cases where I could get incremental type checking to work multiple times in a row, but have noticed that as soon as I make changes in the code, incremental checks will begin to hang.

Will try and find time to get some debug logs sometime soon™