Skip to content

The PHP Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. #381

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

Closed
alex-pex opened this issue Jun 2, 2017 · 14 comments

Comments

@alex-pex
Copy link

alex-pex commented Jun 2, 2017

The PHP Language Server doesn't work anymore, I'm getting this error :

PHP Fatal error: Method AdvancedJsonRpc\ErrorResponse::__toString() must not throw an exception, caught TypeError: Return value of AdvancedJsonRpc\Message::__toString() must be of the type string, boolean returned in C:\Users\Alexandre.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\felixfbecker\language-server\src\Protocol\Message.php on line 0

@felixfbecker
Copy link
Owner

Could you give steps how to reproduce?

@alex-pex
Copy link
Author

alex-pex commented Jun 2, 2017

I'm on a Symfony 3 project (api-platform based) on Windows, with PHP 7.0.16
It crashes as soon as I open the project

[Info - 17:57:09] Connection to server got closed. Server will restart.
[Info - 17:57:11] Connection to server got closed. Server will restart.
[Info - 17:57:13] Connection to server got closed. Server will restart.
[Info - 17:57:15] Connection to server got closed. Server will restart.
[Error - 17:57:16] Connection to server got closed. Server will not be restarted.

With a new api-platform project it is working fine. I don't know if I have a bad php-language cache. How can I clear it ?
Maybe I can var_dump the message directly in php-language extension code, to get more details ?

@felixfbecker
Copy link
Owner

I would attach a debugger, but I can't debug it without having the code that causes this.

@alex-pex
Copy link
Author

alex-pex commented Jun 2, 2017

UnexpectedValueException: RecursiveDirectoryIterator::__construct(c:/Users/Alexandre/Sources/neoness/api\node_modules\drakov\node_modules\yargs\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\normalize-package-data\node_modules\validate-npm-package-license\node_modules\spdx-correct\node_modules\spdx-license-ids,c:/Users/Alexandre/Sources/neoness/api\node_modules\drakov\node_modules\yargs\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\normalize-package-data\node_modules\validate-npm-package-license\node_modules\spdx-correct\node_modules\spdx-license-ids): Le chemin d�acc�s sp�cifi� est introuvable. (code: 3) in C:\Users\Alexandre\.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\webmozart\glob\src\Iterator\RecursiveDirectoryIterator.php:43
Stack trace:
#0 C:\Users\Alexandre\.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\webmozart\glob\src\Iterator\RecursiveDirectoryIterator.php(43): RecursiveDirectoryIterator->__construct('c:/Users/Alexan...', 4128)
#1 C:\Users\Alexandre\.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\webmozart\glob\src\Iterator\RecursiveDirectoryIterator.php(55): Webmozart\Glob\Iterator\RecursiveDirectoryIterator->__construct('c:/Users/Alexan...', 4128)
#2 [internal function]: Webmozart\Glob\Iterator\RecursiveDirectoryIterator->getChildren()
#3 C:\Users\Alexandre\.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\webmozart\glob\src\Iterator\RegexFilterIterator.php(130): FilterIterator->next()
#4 [internal function]: Webmozart\Glob\Iterator\RegexFilterIterator->next()
#5 C:\Users\Alexandre\.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\felixfbecker\language-server\src\FilesFinder\FileSystemFilesFinder.php(24): IteratorIterator->next()
#6 [internal function]: LanguageServer\FilesFinder\FileSystemFilesFinder->LanguageServer\FilesFinder\{closure}()
#7 C:\Users\Alexandre\.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\sabre\event\lib\coroutine.php(70): Generator->send(NULL)
#8 C:\Users\Alexandre\.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\sabre\event\lib\Promise.php(242): Sabre\Event\{closure}(NULL)
#9 C:\Users\Alexandre\.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\sabre\event\lib\Loop\Loop.php(261): Sabre\Event\Promise->Sabre\Event\{closure}()
#10 C:\Users\Alexandre\.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\sabre\event\lib\Loop\Loop.php(215): Sabre\Event\Loop\Loop->runNextTicks()
#11 C:\Users\Alexandre\.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\sabre\event\lib\Loop\Loop.php(194): Sabre\Event\Loop\Loop->tick(true)
#12 C:\Users\Alexandre\.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\sabre\event\lib\Loop\functions.php(122): Sabre\Event\Loop\Loop->run()
#13 C:\Users\Alexandre\.vscode\extensions\felixfbecker.php-intellisense-1.3.0\vendor\felixfbecker\language-server\bin\php-language-server.php(50): Sabre\Event\Loop\run()
#14 {main}

I'm getting the error because php-language server try to parse my node modules. The server starts if I remove my node_modules folder.

@jens1o
Copy link
Contributor

jens1o commented Jun 2, 2017

Could we get the repository, or at least what node modules you have installed in that workspace?

@alex-pex
Copy link
Author

alex-pex commented Jun 2, 2017

I can't give you the repository (private sources) but I can give you the package.json :

{
  "name": "api",
  "private": true,
  "dependencies": {
    "aglio": "^2.3.0"
  },
  "devDependencies": {
    "drakov": "^1.0.1",
    "dredd": "^2.2.5"
  }
}

@felixfbecker
Copy link
Owner

@alex-pex
Copy link
Author

alex-pex commented Jun 5, 2017

#159 could fix my problem, given php intellisense should read files.exclude setting + php.excludeFiles (with {"**/node_modules": true"} by default). I'll post a comment on the related issue.

@felixfbecker
Copy link
Owner

Does this still happen with the newest version?

@alex-pex
Copy link
Author

Yes it does

@felixfbecker
Copy link
Owner

So this thread actually contains two errors, one is related to too long node_modules path and can be fixed by upgrading npm to >=3. Your original error not. Which one are you getting? I need code that I can reproduce the problem with (even if it's a set of dependencies), otherwise I am afraid I cannot look into this

@alex-pex
Copy link
Author

You're right : it's a different error now. I tried the same package.json on a vanilla api-platform project and the server runs.

I'll try to build a fake project to show the error.

@alex-pex
Copy link
Author

I've found the issue : I was using a npm-shrinkwrap generated from an old npm version. With a new one (generated from npm@4) I don't have the issue.

Do you still want project sources to see the previous issue, or do you consider this as SOLVED?

@felixfbecker
Copy link
Owner

Solved

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

No branches or pull requests

3 participants