richterger / Perl-LanguageServer

Language Server for Perl
Other
219 stars 53 forks source link

Deep recursion during file parsing #186

Closed bmeneg closed 11 months ago

bmeneg commented 11 months ago

Calling :CocCommand workspace.showOutput perl, we get the following information:

Deep recursion on subroutine "Perl::LanguageServer::Parser::_parse_dir" at /home/bmeneg/git/Perl-LanguageServer/lib/Perl/LanguageServer/Parser.pm line 544

Checking the logs (and adding some prints within the server code), it's possible to note that the parser is running into really, but really deep recursion, due to the .vscode/ dir creation. The following test.log file contains the path of the first parsing _parse_dir() does:

$ cat test.log | perl -lne "@_ = split /\//; print scalar @_ -1;"
332

And it goes back parsing over and over, one by one, until it reaches level 1, when it stops. The most important part is that on every level the files are there and are re-parsed.

EDIT: each time a perl file is opened at that dir, a new dir structure is created, ie: .vscode/perl-lang/home/bmeneg/test/perl, instead of using the same.

bmeneg commented 11 months ago

Ok, that's not an actual error on the server. It was me setting perl.ignoreDirs without .vscode in it. I think the infinite creation could be avoided, but that's an bug itself. Sorry for the noise.