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

Server keeps crashing with latest 4.5 release. #418

Closed
ADmad opened this issue Jun 17, 2017 · 24 comments
Closed

Server keeps crashing with latest 4.5 release. #418

ADmad opened this issue Jun 17, 2017 · 24 comments
Labels

Comments

@ADmad
Copy link
Contributor

ADmad commented Jun 17, 2017

Here's the output in VSCode using intellisense extension 1.4.1

project1

[Info  - 8:16:48 PM] 2878 files total
[Info  - 8:16:48 PM] Indexing project for definitions and static references
Parsing file:///path/to/project/bin/cake.php
[Error - 8:16:48 PM] Error parsing file:///path/to/project/bin/cake.php: ErrorException: Undefined offset: 17 in /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/PhpTokenizer.php:33
Stack trace:
#0 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/PhpTokenizer.php(33): {closure}(8, 'Undefined offse...', '/home/admad/.vs...', 33, Array)
#1 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1260): Microsoft\PhpParser\PhpTokenizer->scanNextToken()
#2 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1169): Microsoft\PhpParser\Parser->lookahead(255)
#3 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1106): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Token))
#4 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1179): Microsoft\PhpParser\Parser->parseDelimitedList('Microsoft\\PhpPa...', 255, Object(Closure), Object(Closure), Object(Microsoft\PhpParser\Node\QualifiedName))
#5 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1145): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(NULL)
#6 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(892): Microsoft\PhpParser\Parser->parseQualifiedName(NULL)
#7 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1501): Microsoft\PhpParser\Parser->parsePrimaryExpression(NULL)
#8 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1506): Microsoft\PhpParser\Parser->parseUnaryExpressionOrHigher(NULL)
#9 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1586): Microsoft\PhpParser\Parser->parseBinaryExpressionOrHigher(9, NULL)
#10 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1416): Microsoft\PhpParser\Parser->parseBinaryExpressionOrHigher(0, Object(Microsoft\PhpParser\Node\Statement\ExpressionStatement))
#11 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1405): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\Statement\ExpressionStatement))
#12 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(527): Microsoft\PhpParser\Parser->parseExpression(Object(Microsoft\PhpParser\Node\Statement\ExpressionStatement), true)
#13 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(192): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\Statement\CompoundStatementNode))
#14 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(635): Microsoft\PhpParser\Parser->parseList(Object(Microsoft\PhpParser\Node\Statement\CompoundStatementNode), 1)
#15 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(420): Microsoft\PhpParser\Parser->parseCompoundStatement(Object(Microsoft\PhpParser\Node\Statement\IfStatementNode))
#16 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(411): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\Statement\IfStatementNode))
#17 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1298): Microsoft\PhpParser\Parser->parseStatement(Object(Microsoft\PhpParser\Node\Statement\IfStatementNode))
#18 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(431): Microsoft\PhpParser\Parser->parseIfStatement(Object(Microsoft\PhpParser\Node\SourceFileNode))
#19 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(192): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\SourceFileNode))
#20 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(158): Microsoft\PhpParser\Parser->parseList(Object(Microsoft\PhpParser\Node\SourceFileNode), 0)
#21 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/TreeAnalyzer.php(48): Microsoft\PhpParser\Parser->parseSourceFile('#!/usr/bin/php ...', 'file:///opt/www...')
#22 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/PhpDocument.php(147): LanguageServer\TreeAnalyzer->__construct(Object(Microsoft\PhpParser\Parser), '#!/usr/bin/php ...', Object(phpDocumentor\Reflection\DocBlockFactory), Object(LanguageServer\DefinitionResolver), 'file:///opt/www...')
#23 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/PhpDocument.php(105): LanguageServer\PhpDocument->updateContent('#!/usr/bin/php ...')
#24 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/PhpDocumentLoader.php(141): LanguageServer\PhpDocument->__construct('file:///opt/www...', '#!/usr/bin/php ...', Object(LanguageServer\Index\Index), Object(Microsoft\PhpParser\Parser), Object(phpDocumentor\Reflection\DocBlockFactory), Object(LanguageServer\DefinitionResolver))
#25 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/PhpDocumentLoader.php(120): LanguageServer\PhpDocumentLoader->create('file:///opt/www...', '#!/usr/bin/php ...')
#26 [internal function]: LanguageServer\PhpDocumentLoader->LanguageServer\{closure}()
#27 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/coroutine.php(70): Generator->send('#!/usr/bin/php ...')
#28 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Promise.php(242): Sabre\Event\{closure}('#!/usr/bin/php ...')
#29 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Loop/Loop.php(261): Sabre\Event\Promise->Sabre\Event\{closure}()
#30 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Loop/Loop.php(215): Sabre\Event\Loop\Loop->runNextTicks()
#31 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Loop/Loop.php(194): Sabre\Event\Loop\Loop->tick(true)
#32 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Loop/functions.php(122): Sabre\Event\Loop\Loop->run()
#33 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/bin/php-language-server.php(102): Sabre\Event\Loop\run()
#34 {main}
Parsing file:///path/to/project/data/fix-content-saved-as-latin-in-utf8-fields.php
[Info  - 8:16:48 PM] Connection to server got closed. Server will restart.

The files in question are https://github.com/cakephp/app/blob/master/bin/cake.php and https://gist.github.com/ADmad/f531707db2cb70f1bc69c35e1f581b9b

@ADmad
Copy link
Contributor Author

ADmad commented Jun 17, 2017

Here's the output from another project

project2

[Info  - 8:22:53 PM] 4292 files total
[Info  - 8:22:53 PM] Indexing project for definitions and static references
Parsing file:///path/index.php
Parsing file:///path/src/Enum/RecreationalFacilities.php
Parsing file:///path/src/Enum/Enum.php
[Info  - 8:22:54 PM] Connection to server got closed. Server will restart.

Files in question are
https://github.com/cakephp/app/blob/master/index.php
https://gist.github.com/ADmad/b230fd5b550e3564dab2dffd16079bf9
https://gist.github.com/ADmad/fdc1a0bb6190f042f602deb673795b60

@felixfbecker
Copy link
Owner

Seems to be a parser bug and related to #368 (comment) (require with expression)
@roblourens

@ADmad
Copy link
Contributor Author

ADmad commented Jun 17, 2017

@felixfbecker Even using the intellisense extension 1.3.0 the server crashes for both projects. Exact same out for project 2, slightly different for project 1 with exception.

[Info  - 10:13:03 PM] 2878 files total
[Info  - 10:13:03 PM] Indexing project for definitions and static references
Parsing file:///project/bin/cake.php
[Error - 10:13:03 PM] Error parsing file:///project/bin/cake.php: ErrorException: Undefined variable: OPERATOR_PRECEDENCE_AND_ASSOCIATIVITY in /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php:1508
Stack trace:
#0 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(1508): {closure}(8, 'Undefined varia...', '/home/admad/.vs...', 1508, Array)
#1 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(1416): Microsoft\PhpParser\Parser->parseBinaryExpressionOrHigher(0, Object(Microsoft\PhpParser\Node\Expression\ArgumentExpression))
#2 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(1405): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\Expression\ArgumentExpression))
#3 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(2314): Microsoft\PhpParser\Parser->parseExpression(Object(Microsoft\PhpParser\Node\Expression\ArgumentExpression))
#4 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(1107): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\DelimitedList\ArgumentExpressionList))
#5 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(2432): Microsoft\PhpParser\Parser->parseDelimitedList('Microsoft\\PhpPa...', 251, Object(Closure), Object(Closure), Object(Microsoft\PhpParser\Node\Expression\CallExpression))
#6 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(2326): Microsoft\PhpParser\Parser->parseArgumentExpressionList(Object(Microsoft\PhpParser\Node\Expression\CallExpression))
#7 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(2267): Microsoft\PhpParser\Parser->parseCallExpressionRest(Object(Microsoft\PhpParser\Node\QualifiedName))
#8 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(1502): Microsoft\PhpParser\Parser->parsePostfixExpressionRest(Object(Microsoft\PhpParser\Node\QualifiedName))
#9 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(1506): Microsoft\PhpParser\Parser->parseUnaryExpressionOrHigher(Object(Microsoft\PhpParser\Node\Statement\IfStatementNode))
#10 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(1416): Microsoft\PhpParser\Parser->parseBinaryExpressionOrHigher(0, Object(Microsoft\PhpParser\Node\Statement\IfStatementNode))
#11 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(1405): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\Statement\IfStatementNode))
#12 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(1292): Microsoft\PhpParser\Parser->parseExpression(Object(Microsoft\PhpParser\Node\Statement\IfStatementNode))
#13 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(431): Microsoft\PhpParser\Parser->parseIfStatement(Object(Microsoft\PhpParser\Node\SourceFileNode))
#14 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(192): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\SourceFileNode))
#15 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/microsoft/tolerant-php-parser/src/Parser.php(158): Microsoft\PhpParser\Parser->parseList(Object(Microsoft\PhpParser\Node\SourceFileNode), 0)
#16 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/felixfbecker/language-server/src/TreeAnalyzer.php(48): Microsoft\PhpParser\Parser->parseSourceFile('#!/usr/bin/php ...', 'file:///opt/www...')
#17 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/felixfbecker/language-server/src/PhpDocument.php(147): LanguageServer\TreeAnalyzer->__construct(Object(Microsoft\PhpParser\Parser), '#!/usr/bin/php ...', Object(phpDocumentor\Reflection\DocBlockFactory), Object(LanguageServer\DefinitionResolver), 'file:///opt/www...')
#18 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/felixfbecker/language-server/src/PhpDocument.php(105): LanguageServer\PhpDocument->updateContent('#!/usr/bin/php ...')
#19 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/felixfbecker/language-server/src/PhpDocumentLoader.php(141): LanguageServer\PhpDocument->__construct('file:///opt/www...', '#!/usr/bin/php ...', Object(LanguageServer\Index\Index), Object(Microsoft\PhpParser\Parser), Object(phpDocumentor\Reflection\DocBlockFactory), Object(LanguageServer\DefinitionResolver))
#20 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/felixfbecker/language-server/src/PhpDocumentLoader.php(120): LanguageServer\PhpDocumentLoader->create('file:///opt/www...', '#!/usr/bin/php ...')
#21 [internal function]: LanguageServer\PhpDocumentLoader->LanguageServer\{closure}()
#22 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/sabre/event/lib/coroutine.php(70): Generator->send('#!/usr/bin/php ...')
#23 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/sabre/event/lib/Promise.php(242): Sabre\Event\{closure}('#!/usr/bin/php ...')
#24 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/sabre/event/lib/Loop/Loop.php(261): Sabre\Event\Promise->Sabre\Event\{closure}()
#25 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/sabre/event/lib/Loop/Loop.php(215): Sabre\Event\Loop\Loop->runNextTicks()
#26 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/sabre/event/lib/Loop/Loop.php(194): Sabre\Event\Loop\Loop->tick(true)
#27 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/sabre/event/lib/Loop/functions.php(122): Sabre\Event\Loop\Loop->run()
#28 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.3.0/vendor/felixfbecker/language-server/bin/php-language-server.php(102): Sabre\Event\Loop\run()
#29 {main}

@jens1o
Copy link
Contributor

jens1o commented Jun 17, 2017

wait. How in the world you have the tolerant parser in v1.3.0

// cc @felixfbecker Did you changed something in the re-release progress?

@ADmad
Copy link
Contributor Author

ADmad commented Jun 17, 2017

wait. How in the world you have the tolerant parser in v1.3.0

Due to @felixfbecker's boo boo :). Fixed now.

@roblourens
Copy link
Contributor

roblourens commented Jun 18, 2017

I can't repro those issues. Does it happen with those files alone or maybe only part of a project?

I don't think it was related to the require/include issue from earlier, that would have been fixed in 1.4.1 and wasn't a crash.

Can you tell me which version of PHP you're running with?

@ADmad
Copy link
Contributor Author

ADmad commented Jun 18, 2017

Does it happen with those files alone or maybe only part of a project?

Not sure what you mean. I always get the same errors for those 2 project folders.

Can you tell me which version of PHP you're running with?

PHP 7.1.2-4+deb.sury.org~xenial+1

@felixfbecker
Copy link
Owner

felixfbecker commented Jun 18, 2017

@ADmad Are you sure the language server is crashing and this is the STDERR output? Exceptions that happen during indexing of a single file will be logged, but indexing should continue with the next file. The error you see matches the message here: https://sourcegraph.com/github.com/felixfbecker/php-language-server/-/blob/src/Indexer.php#L228-229, which speaks against this being the reason of a crash (if there was any)

@ADmad
Copy link
Contributor Author

ADmad commented Jun 18, 2017

Yes, the errors I have shown are repeated 5 times and then vscode shows notification that the language server has crashed 5 times and won't be restarted.

@felixfbecker
Copy link
Owner

Could you also check the dev console whether STDERR output is logged there? As said, this shouldn't cause a crash, so the error of the actual crash may be not shown in the output panel.

@ADmad
Copy link
Contributor Author

ADmad commented Jun 18, 2017

This is what i see in the dev console

[Extension Host] Segmentation fault

d.logExtensionHostMessage @ extensionHost.ts:293
(anonymous) @ extensionHost.ts:147
emitTwo @ events.js:106
emit @ events.js:191
process.nextTick @ internal/child_process.js:752
_combinedTickCallback @ internal/process/next_tick.js:67
_tickCallback @ internal/process/next_tick.js:98

[Extension Host] Content-Type: application/vscode-jsonrpc; charset=utf8
Content-Length: 651

{"result":{"capabilities":{"textDocumentSync":1,"hoverProvider":true,"completionProvider":{"resolveProvider":false,"triggerCharacters":["$",">"]},"signatureHelpProvider":null,"definitionProvider":true,"referencesProvider":true,"documentHighlightProvider":null,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":null,"codeLensProvider":null,"documentFormattingProvider":true,"documentRangeFormattingProvider":null,"documentOnTypeFormattingProvider":null,"renameProvider":null,"xworkspaceReferencesProvider":true,"xdefinitionProvider":true,"dependenciesProvider":null,"xdependenciesProvider":true}},"id":0,"jsonrpc":"2.0"}

The PHP Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.
e.doShow @ messageService.ts:125
e.show @ messageService.ts:104
(anonymous) @ mainThreadMessageService.ts:64
n.Class.derive._oncancel @ winjs.base.raw.js:1641
t.showMessage @ mainThreadMessageService.ts:34
t.$showMessage @ mainThreadMessageService.ts:28
e.handle @ abstractThreadService.ts:34
s @ ipcRemoteCom.ts:275
f @ ipcRemoteCom.ts:231
_combinedTickCallback @ internal/process/next_tick.js:67
_tickCallback @ internal/process/next_tick.js:98

@felixfbecker
Copy link
Owner

Then the crash reason seems to be a PHP SEGFAULT.

@ADmad
Copy link
Contributor Author

ADmad commented Jun 18, 2017

That doesn't make much sense to me. Where does the problem lie since v1.3 of intellisense plugin works fine?

@ADmad
Copy link
Contributor Author

ADmad commented Jun 18, 2017

This is what i get for project2

[Extension Host] Error: Cannot use object of type Microsoft\PhpParser\Node\Expression\AssignmentExpression as array in /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php:1508
Stack trace:
#0 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1416): Microsoft\PhpParser\Parser->parseBinaryExpressionOrHigher(0, Object(Microsoft\PhpParser\Node\DelimitedList\ExpressionList))
#1 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1107): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\DelimitedList\ExpressionList))
#2 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(2063): Microsoft\PhpParser\Parser->parseDelimitedList('Microsoft\\PhpPa...', 251, Object(Closure), Object(Closure), Object(Microsoft\PhpParser\Node\PropertyDeclaration))
#3 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(2494): Microsoft\PhpParser\Parser->parseExpressionList(Object(Microsoft\PhpParser\Node\PropertyDeclaration))
#4 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(546): Microsoft\PhpParser\Parser->parsePropertyDeclaration(Object(Microsoft\PhpParser\Node\ClassMembersNode), Array)
#5 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(192): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\ClassMembersNode))
#6 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(576): Microsoft\PhpParser\Parser->parseList(Object(Microsoft\PhpParser\Node\ClassMembersNode), 2)
#7 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(569): Microsoft\PhpParser\Parser->parseClassMembers(Object(Microsoft\PhpParser\Node\Statement\ClassDeclaration))
#8 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(480): Microsoft\PhpParser\Parser->parseClassDeclaration(Object(Microsoft\PhpParser\Node\SourceFileNode))
#9 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(192): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\SourceFileNode))
#10 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(158): Microsoft\PhpParser\Parser->parseList(Object(Microsoft\PhpParser\Node\SourceFileNode), 0)
#11 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/TreeAnalyzer.php(48): Microsoft\PhpParser\Parser->parseSourceFile('<?php\nnamespace...', 'file:///srv/sit...')
#12 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/PhpDocument.php(147): LanguageServer\TreeAnalyzer->__construct(Object(Microsoft\PhpParser\Parser), '<?php\nnamespace...', Object(phpDocumentor\Reflection\DocBlockFactory), Object(LanguageServer\DefinitionResolver), 'file:///srv/sit...')
#13 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/PhpDocument.php(105): LanguageServer\PhpDocument->updateContent('<?php\nnamespace...')
#14 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/PhpDocumentLoader.php(141): LanguageServer\PhpDocument->__construct('file:///srv/sit...', '<?php\nnamespace...', Object(LanguageServer\Index\Index), Object(Microsoft\PhpParser\Parser), Object(phpDocumentor\Reflection\DocBlockFactory), Object(LanguageServer\DefinitionResolver))
#15 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/PhpDocumentLoader.php(120): LanguageServer\PhpDocumentLoader->create('file:///srv/sit...', '<?php\nnamespace...')
#16 [internal function]: LanguageServer\PhpDocumentLoader->LanguageServer\{closure}()
#17 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/coroutine.php(70): Generator->send('<?php\nnamespace...')
#18 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Promise.php(242): Sabre\Event\{closure}('<?php\nnamespace...')
#19 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Loop/Loop.php(261): Sabre\Event\Promise->Sabre\Event\{closure}()
#20 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Loop/Loop.php(215): Sabre\Event\Loop\Loop->runNextTicks()
#21 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Loop/Loop.php(194): Sabre\Event\Loop\Loop->tick(true)
#22 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Loop/functions.php(122): Sabre\Event\Loop\Loop->run()
#23 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/bin/php-language-server.php(102): Sabre\Event\Loop\run()
#24 {main}

@jens1o
Copy link
Contributor

jens1o commented Jun 18, 2017

@felixfbecker
Copy link
Owner

But the constant is defined in that class. Maybe it needs to be defined at the top of the file?

Where does the problem lie since v1.3 of intellisense plugin works fine

Anything could cause a SEGFAULT. A SEGFAULT should never happen, it means a bug in PHP.

@ADmad
Copy link
Contributor Author

ADmad commented Jun 18, 2017

Anything could cause a SEGFAULT. A SEGFAULT should never happen, it means a bug in PHP.

True, but it's some code in the new parser that's triggering it. If we can find what maybe it can be circumvented.

@ADmad
Copy link
Contributor Author

ADmad commented Jun 18, 2017

This is the output shown in "Output" window for folder containing CakePHP.

project3 / cakephp

[Info  - 10:20:18 PM] 2719 files total
[Info  - 10:20:18 PM] Indexing project for definitions and static references
Parsing file:///srv/sites//cakephp/src/Validation/RulesProvider.php
[Error - 10:20:18 PM] Error parsing file:///srv/sites/cakephp/src/Validation/RulesProvider.php: ErrorException: Undefined variable: OPERATOR_PRECEDENCE_AND_ASSOCIATIVITY in /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php:1508
Stack trace:
#0 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1508): {closure}(8, 'Undefined varia...', '/home/admad/.vs...', 1508, Array)
#1 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1416): Microsoft\PhpParser\Parser->parseBinaryExpressionOrHigher(0, Object(Microsoft\PhpParser\Node\Expression\ArgumentExpression))
#2 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1405): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\Expression\ArgumentExpression))
#3 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(2314): Microsoft\PhpParser\Parser->parseExpression(Object(Microsoft\PhpParser\Node\Expression\ArgumentExpression))
#4 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1107): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\DelimitedList\ArgumentExpressionList))
#5 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(2432): Microsoft\PhpParser\Parser->parseDelimitedList('Microsoft\\PhpPa...', 251, Object(Closure), Object(Closure), Object(Microsoft\PhpParser\Node\Expression\CallExpression))
#6 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(2326): Microsoft\PhpParser\Parser->parseArgumentExpressionList(Object(Microsoft\PhpParser\Node\Expression\CallExpression))
#7 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(2267): Microsoft\PhpParser\Parser->parseCallExpressionRest(Object(Microsoft\PhpParser\Node\QualifiedName))
#8 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1502): Microsoft\PhpParser\Parser->parsePostfixExpressionRest(Object(Microsoft\PhpParser\Node\QualifiedName))
#9 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1506): Microsoft\PhpParser\Parser->parseUnaryExpressionOrHigher(Object(Microsoft\PhpParser\Node\Statement\IfStatementNode))
#10 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1416): Microsoft\PhpParser\Parser->parseBinaryExpressionOrHigher(0, Object(Microsoft\PhpParser\Node\Statement\IfStatementNode))
#11 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1405): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\Statement\IfStatementNode))
#12 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1292): Microsoft\PhpParser\Parser->parseExpression(Object(Microsoft\PhpParser\Node\Statement\IfStatementNode))
#13 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(431): Microsoft\PhpParser\Parser->parseIfStatement(Object(Microsoft\PhpParser\Node\Statement\CompoundStatementNode))
#14 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(192): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\Statement\CompoundStatementNode))
#15 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(635): Microsoft\PhpParser\Parser->parseList(Object(Microsoft\PhpParser\Node\Statement\CompoundStatementNode), 1)
#16 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(1242): Microsoft\PhpParser\Parser->parseCompoundStatement(Object(Microsoft\PhpParser\Node\MethodDeclaration))
#17 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(592): Microsoft\PhpParser\Parser->parseFunctionType(Object(Microsoft\PhpParser\Node\MethodDeclaration), true)
#18 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(543): Microsoft\PhpParser\Parser->parseMethodDeclaration(Object(Microsoft\PhpParser\Node\ClassMembersNode), Array)
#19 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(192): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\ClassMembersNode))
#20 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(576): Microsoft\PhpParser\Parser->parseList(Object(Microsoft\PhpParser\Node\ClassMembersNode), 2)
#21 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(569): Microsoft\PhpParser\Parser->parseClassMembers(Object(Microsoft\PhpParser\Node\Statement\ClassDeclaration))
#22 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(480): Microsoft\PhpParser\Parser->parseClassDeclaration(Object(Microsoft\PhpParser\Node\SourceFileNode))
#23 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(192): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\SourceFileNode))
#24 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/microsoft/tolerant-php-parser/src/Parser.php(158): Microsoft\PhpParser\Parser->parseList(Object(Microsoft\PhpParser\Node\SourceFileNode), 0)
#25 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/TreeAnalyzer.php(48): Microsoft\PhpParser\Parser->parseSourceFile('<?php\n/**\n * Ca...', 'file:///srv/sit...')
#26 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/PhpDocument.php(147): LanguageServer\TreeAnalyzer->__construct(Object(Microsoft\PhpParser\Parser), '<?php\n/**\n * Ca...', Object(phpDocumentor\Reflection\DocBlockFactory), Object(LanguageServer\DefinitionResolver), 'file:///srv/sit...')
#27 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/PhpDocument.php(105): LanguageServer\PhpDocument->updateContent('<?php\n/**\n * Ca...')
#28 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/PhpDocumentLoader.php(141): LanguageServer\PhpDocument->__construct('file:///srv/sit...', '<?php\n/**\n * Ca...', Object(LanguageServer\Index\Index), Object(Microsoft\PhpParser\Parser), Object(phpDocumentor\Reflection\DocBlockFactory), Object(LanguageServer\DefinitionResolver))
#29 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/src/PhpDocumentLoader.php(120): LanguageServer\PhpDocumentLoader->create('file:///srv/sit...', '<?php\n/**\n * Ca...')
#30 [internal function]: LanguageServer\PhpDocumentLoader->LanguageServer\{closure}()
#31 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/coroutine.php(70): Generator->send('<?php\n/**\n * Ca...')
#32 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Promise.php(242): Sabre\Event\{closure}('<?php\n/**\n * Ca...')
#33 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Loop/Loop.php(261): Sabre\Event\Promise->Sabre\Event\{closure}()
#34 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Loop/Loop.php(215): Sabre\Event\Loop\Loop->runNextTicks()
#35 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Loop/Loop.php(194): Sabre\Event\Loop\Loop->tick(true)
#36 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/sabre/event/lib/Loop/functions.php(122): Sabre\Event\Loop\Loop->run()
#37 /home/admad/.vscode/extensions/felixfbecker.php-intellisense-1.4.1/vendor/felixfbecker/language-server/bin/php-language-server.php(102): Sabre\Event\Loop\run()
#38 {main}

@ADmad
Copy link
Contributor Author

ADmad commented Jun 18, 2017

But the constant is defined in that class. Maybe it needs to be defined at the top of the file?

Worth a try. Could move it before the function definitions start.

@ADmad
Copy link
Contributor Author

ADmad commented Jun 18, 2017

The problem was with the particular PHP version. I upgrade my packages to get PHP 7.1.6-1~ubuntu16.04.1+deb.sury.org+1 and the server has stopped crashing.

Thanks everyone for your patience and sorry for the trouble.

P. S. It might still be a good idea to move the constant definitions to top of class.

@roblourens
Copy link
Contributor

Thanks for trying that @ADmad. Seems like a pretty extreme bug to have in a stable version of PHP... I will move the constant definitions up in case it helps.

@roblourens
Copy link
Contributor

This is probably related to this report: microsoft/tolerant-php-parser#155 (comment)

Filed here on PHP, reported as fixed:
https://bugs.php.net/bug.php?id=74019

@ADmad
Copy link
Contributor Author

ADmad commented Jun 19, 2017

That's a nasty bug indeed. Good that it was fixed quickly enough. Someone did a much better job at debugging the issue than me :)

@roblourens
Copy link
Contributor

I want to find a mitigation for this but I can't repro the segfault. I built 7.1.2 on ubuntu but don't see it.

The minimal repro from the php issue is:

<?php

class A {
    public function seg() {
        list($a, $b) = A::CONSTS;
        var_dump($a, $b);
        return;
    }
    const CONSTS = [1, 2];
}

$a = new A;
$a->seg();

Does anyone know if just avoiding the list($a, $b) syntax with the const would work around it? That's easy enough.

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

No branches or pull requests

4 participants