Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpactor.WARNING: Killed process "3356912" because it lived longer than 5s #2655

Open
overrider opened this issue May 14, 2024 · 5 comments
Open

Comments

@overrider
Copy link

overrider commented May 14, 2024

Hello friends,

i am using neovim 0.95 with the lazy plugin, native LSP + phpactor (via mason) for my laravel project. On smaller files, things run smoothly. On larger files, lets say 1000 Lines, i don't get any annotations / linting and instead get an error message in the log file that reads like this:

[2024-05-14 07:12:16] phpactor.WARNING: Killed process "3356912" ('/usr/bin/php8.1' '/root/.local/share/nvim/mason/bin/phpactor' 'language-server:diagnostics' '--uri=file:///srv/www/test/app/Http/Controllers/MessageController.php' '--config-extra={"worse_reflection.enable_context_location": false}') because it lived longer than 5s {"channel":"LSP"} []

How to start troubleshooting this? My project isn't that large/complex i think, how can i help phpactor understand the project more easily so it doesn't choke? phpactor index:build -vvv will finish in ~2 seconds and report no errors, all green.

Box Requirements Checker
========================

> Using PHP 8.1.28
> PHP is using the following php.ini file:
  /etc/php/8.1/cli/php.ini

> Checking Box requirements:
  ✔ The application requires a version matching "^8.1".
  ✔ The application requires the extension "zlib".
  ✔ The package "amphp/dns" requires the extension "filter".
  ✔ The package "amphp/dns" requires the extension "json".
  ✔ The package "ramsey/uuid" requires the extension "json".
  ✔ The package "amphp/socket" requires the extension "openssl".
  ✔ The package "kelunik/certificate" requires the extension "openssl".
  ✔ The package "symfony/service-contracts" conflicts with the extension "psr".


 [OK] Your system is ready to run the application.


[FPR    ][DEBU][671148.096499] Resolved path "%cache%/index/%project_id%" to "/root/.cache/phpactor/index/backpack-10fbba"
[FPR    ][DEBU][671148.097614] Resolved path "%project_root%" to "/srv/www/test"
[FPR    ][DEBU][671148.098658] Resolved path "%project_root%" to "/srv/www/test"
[FPR    ][DEBU][671148.119067] Resolved path "%application_root%/vendor/jetbrains/phpstorm-stubs" to "phar:///usr/local/bin/phpactor/vendor/jetbrains/phpstorm-stubs"
[FPR    ][DEBU][671148.119168] Resolved path "%cache%/worse-reflection" to "/root/.cache/phpactor/worse-reflection"
[FPR    ][DEBU][671148.119999] Resolved path "%project_root%/vendor/autoload.php" to "/srv/www/test/vendor/autoload.php"
[FPR    ][DEBU][671148.192049] Resolved path "%project_root%" to "/srv/www/test"
Building job...done
Building index:

 518/518 [============================] 100% < 1 sec/< 1 sec 37/∞ mb

Done in 1.76 seconds using 36,560,896b of memory
@mamazu
Copy link
Contributor

mamazu commented May 14, 2024

Well, since you already know what command is failing from your log message you could run this command with Xdebug enabled and see where it spends most of it's time.

@overrider
Copy link
Author

php_actor.log

I enabled xdebug, set the log level to xdebug, and then opened one of the larger files. There is nothing that seems to take a particularly long time, but there are a lot, hundreds, of messages "...Could not find internal stub for xxx", and those then may add up i assume. The log is attached. Any idea how to teach phpactor about the structure of this laravel project?

@mamazu
Copy link
Contributor

mamazu commented May 14, 2024

I mean that's interesting to see. Looks like it takes a long time to resolve classes. Are you using composer in this project?

What does the profile from XDebug say?

@overrider
Copy link
Author

overrider commented May 14, 2024

Yes its using composer; i installed xdebug and enabled it, but i am not sure how to find out what xdebug profile says. I feel like i just need to teach phpactor where the code is. bullet point 'ide_helper' or something like this. Or some configuration issue. For example in the logfile on line 35 it says

Class "App\Http\Controllers\App\Http\Controllers" is indexed but it does not exist at path".

Well it should not be Class "App\Http\Controllers\App\Http\Controllers", jut App\Http\Controllers. Its somehow doubling up the path.

@mamazu
Copy link
Contributor

mamazu commented May 14, 2024

So there are a few things that you can try. (I don't have an idea what specifically could be the problem):

  • Setting up xdebug for profiling to see what functions are slow (but we already know that).
  • If composer doesn't have autoloading configured properly: composer autoloading
  • However if phpactor is trying to find a class that doesn't exist this sounds like a namespace issue. With that long of a file, do you have multiple classes in one file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants