erlang-ls / erlang_ls

The Erlang Language Server
https://erlang-ls.github.io/
Apache License 2.0
633 stars 137 forks source link

els_server deadlocks/hangs in filelib:wildcard #1569

Open rlipscombe opened 1 month ago

rlipscombe commented 1 month ago

Describe the bug

Since upgrading to the current version of ErlangLS, I've noticed it just ... stop working after a while.

To Reproduce

Dunno. Run it. Wait for a bit.

Actual behavior

Attaching observer to the erlang_ls node reveals that the els_server process has a huge number of reductions, is stuck in gen:do_call and has ~3300 messages (mostly process_requests casts) in its queue. This would explain why it's not responding to VS Code. Looking at the stack trace, it appears to be stuck in filelib:wildcard/1.

The file_server_2 process seems to be thrashing around in prim_file:list_dir_nif/1 and associated dirty_nif_finalizer calls.

Context

Reverting to an earlier version (v0.0.43) of the VS Code plugin and ErlangLS fixes the problem (but breaks elvis, so I can't do that).

rlipscombe commented 1 month ago

Gotcha. I've got a circular symlink chain in my _checkouts directory. myapp/examples/whatever/_checkouts/myapp points back to myapp, which contains examples/whatever/..., and so on.

This would be a bug in Erlang/OTP, then, I guess...

rlipscombe commented 1 month ago

This would be a bug in Erlang/OTP, then, I guess...

Maybe not. With a minimal repro, filelib:wildcard("**"). stops after ~130 entries. Is it that erlang-ls keeps refreshing?