felixfbecker / php-language-server

PHP Implementation of the VS Code Language Server Protocol 🆚↔🖥
ISC License
1.15k stars 185 forks source link

memory leak #344

Open jens1o opened 7 years ago

jens1o commented 7 years ago

Project: http://github.com/jens1o/hitbox-api-php (I'd granted you access) (you need to execute composer install) Log: https://hastebin.com/esaximiped.tex

image

Can I help you with something else? I just coded normal(the things from the last php commit) and finally, it freezed.

felixfbecker commented 7 years ago

Are you sure it's a leak and not just the limit too low? No idea what could leak here tbh

jens1o commented 7 years ago

I don't know either. I'm pretty sure it's a leak, because it's just less than 100 files. Also, I saw in the task manager I'd openend(because that happened earlier this day too, this is the second time) and I saw how it rose. In the panic I'd forgot to look after a screenshot. The parsing of the files was more than a hour ago... I don't expect reparsing anything. At the start, it were 64 MiB. I don't know why it allocates more than four gigabytes... But I saw that it's the "CLI" process, so I also think that this language server is the cause.

jens1o commented 7 years ago

I can reproduce it! (I'd maked a detailed look at the RAM usage.) Everytime the server crashes(and boots up again) it won't flush all of the memory, just around 10 MB. So everytime it crashes, it will allocate more it flushed previous. Infinite loop => out of memory.

The reason why you don't see this in the logs is also simply explained: Code will only buffer the last start and won't buffer the rest. So the output I added was just from the last start.

hazzlewis commented 7 years ago

Mine was occurring yesterday on a small project, although with one fairly large file (about 4000 lines of code) but it was allocating 1.8gb which is far more than I'd expect. Also my dev console did mention a memory leak a long with the errors that followed

hazzlewis commented 7 years ago

Occurred again just now whilst i was working on a file which i'd SCPed into the project directory after already having VSCode open for a while. This time, just a handful of small files in this directory. Do you need any more info for debugging?

jens1o commented 7 years ago

Could we get the file? @hazzlewis

hazzlewis commented 7 years ago

If you think it would be helpful, sure. But I've made changes and restarted vscode since the extension host stopped.

Kind Regards Harry Lewis

-------- Original message -------- From: Jens Hausdorf notifications@github.com Date: 19/04/2017 13:58 (GMT+00:00) To: felixfbecker/php-language-server php-language-server@noreply.github.com Cc: Harry Lewis Harry.Lewis@paragon.net.uk, Mention mention@noreply.github.com Subject: Re: [felixfbecker/php-language-server] memory leak (#344)

Could we get the file? @hazzlewishttps://github.com/hazzlewis

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/felixfbecker/php-language-server/issues/344#issuecomment-295260828, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ATSpMUQNREmAl--WLGmUDOoqI-bqMYOgks5rxgUGgaJpZM4M3_Nx.

twinklebob commented 7 years ago

I'm getting the same issue on Code v1.11.2 on Linux. I'm getting it on my Windows machine too, but don't have access to that at the moment. It seems to crash the Extension host as soon as I save the file. Right before the errors in the dev console it seems to be dumping the entire content of the page, not sure if this is related: {"result":[{"range":{"start":{"line":0,"character":0},"end":{"line":341,"character":2}},"newText":"---Entire page content---"}],"id":54,"jsonrpc":"2.0"}

twinklebob commented 7 years ago

Update, just turned off format on save and the problem has gone. I assume that the php-language-server isn't used for that, so isn't the cause of my problem. I'll just leave format on save off.

felixfbecker commented 7 years ago

@twinklebob That is a super helpful tip! Formatting is delegated to PHP CodeSniffer, so either there's a memory leak in there or we don't dispose correctly somewhere. I would recommend to not format on save because PHP CodeSniffer doesn't reuse any of our ASTs (thus is slow) and from my own experience not always does the best thing. With #357 we will be able to do a losless formatting from our own ASTs.

felixfbecker commented 7 years ago

@jens1o @hazzlewis is the issue caused by that setting for you as well?

hazzlewis commented 7 years ago

I don’t have formatOnSave enabled, and im 99% sure I haven’t used the format document operation on any occasion when mine has crashed. ☹

From: Felix Becker [mailto:notifications@github.com] Sent: 25 April 2017 11:33 To: felixfbecker/php-language-server php-language-server@noreply.github.com Cc: Harry Lewis Harry.Lewis@paragon.net.uk; Mention mention@noreply.github.com Subject: Re: [felixfbecker/php-language-server] memory leak (#344)

@jens1ohttps://github.com/jens1o @hazzlewishttps://github.com/hazzlewis is the issue caused by that setting for you as well?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/felixfbecker/php-language-server/issues/344#issuecomment-296989577, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ATSpMZWOEWUuL5cex4RHNhdMoeKVx8Dsks5rzcvNgaJpZM4M3_Nx.

twinklebob commented 7 years ago

It also occurs when I format a document manually, but at least I can work now with formatOnSave turned off. It's been working ok up until a few days ago. I wonder what changed? There have been updates to VSCode and the extension since I last remember it working.

jens1o commented 7 years ago

I have disabled this option and used it only once, shortly before using the format document option(I wanted to try it out). This seems to make sense.

shaneparsons commented 7 years ago

I've also been experiencing some form of memory leak.

Here's the workflow leading up to the leak / crash:

Here's a screenshot from the developer tools panel: screen shot 2017-04-25 at 3 28 29 pm

I'll create a replica of the project to pass along, but it's basically just a simple Laravel (Lumen) api.

EDIT

I also tried disabled all vscode php stuff, but it didn't help:

"php.executablePath": "/usr/local/bin/php",
"php.suggest.basic": false,
"php.validate.enable": false,

I'm running php 7.0.18. I was at 7.1.14 until I thought downgrading might make a difference.

shaneparsons commented 7 years ago

Here's a repo that demonstrates my problem described above. The instructions are in the readme.

hazzlewis commented 7 years ago

This has been occurring even more frequently since the last VSCode update. It's almost unbearable.

extensionHost.ts:285[Extension Host] (node:14040) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 deploy.config.reloaded listeners added. Use emitter.setMaxListeners() to increase limit
d.logExtensionHostMessage @ extensionHost.ts:285
extensionHost.ts:285[Extension Host] PHP process connected
extensionHost.ts:285[Extension Host] 
VirtualAlloc() failed: [0x00000008] Not enough storage is available to process this command.

VirtualFree() failed: [0x000001e7] Attempt to access invalid address.

VirtualAlloc() failed: [0x00000008] Not enough storage is available to process this command.

VirtualFree() failed: [0x000001e7] Attempt to access invalid address.

PHP Fatal error:  Out of memory (allocated 1853882368) (tried to allocate 262144 bytes) in C:\Users\harry\.vscode\extensions\felixfbecker.php-intellisense-1.2.1\vendor\phpdocumentor\type-resolver\src\Types\Compound.php on line 54
felixfbecker commented 7 years ago

I will look into this after #357

robclancy commented 7 years ago

I get all memory used in like 30 seconds and then system needs a hard reset. Was hoping the new parser was the issue but seems not. Happens when indexing from what I can tell but I don't have time to do anything but disable it and continue working. When this issue is solved I'll try again to see if it was the same one and if not put time into debugging.

EDIT: setting php.memoryLimit might be enough for me to keep it enabled actually, I thought it would just hit the limit and error out. Using -1 for the default is very bad practice and on arch linux meant my machine wasn't recoverable after it used all RAM and swap in less than 30 seconds.

EDIT 2: nvm it does hit the limit and crash the server once I actually use a PHP file.

jens1o commented 7 years ago

@robclancy But working on a real real large project would fail as soon as we change the default limit. :/

EDIT 2: nvm it does hit the limit and crash the server once I actually use a PHP file.

Can we get access to it? Since 1.3, we're indexing ahead of editing a file, so our index is a little bit larger and we can provide better performance.

robclancy commented 7 years ago

So instead of a large project needing to change the default itself (you can add a note to the error that happens) you would rather lock ups peoples systems on linux and do whatever happens on osx/windows?

Idea: in https://github.com/felixfbecker/php-language-server/blob/master/bin/php-language-server.php#L9 instead of setting to -1 simply check the systems memory and make an educated guess for a default, setting it to like 70% of the system or something. Then set the default to false in the extension. If it is false use the 70% or whatever you choose otherwise use whatever is sent in.

What is needing so much memory anyway? Apparently our project is big enough to mean I need a lot to the point I don't have enough? I have 6 gigs free I think when I froze up last time and then 11gigs of swap on top of that. This project is reasonably large I guess but not to a point I would expect to have so much free to index etc.

You can't get access to the project but I'm sure when I get time to properly look into this I could just download a framework and come to the same issue if memory is needed so badly.

Also I feel this issue is unrelated to what I am talking about so will just come back when I can and make a new one with findings etc.

jens1o commented 7 years ago

I suggest you create a pr which changes this default: https://github.com/felixfbecker/vscode-php-intellisense/blob/master/package.json#L66

What is needing so much memory anyway?

This is not supposed to be in any way, but without something to work with we can't do our work. Please calm down. But thanks that you're looking into this. Can we get exact system stats, for example which operating system, which arch and so on?

robclancy commented 7 years ago

memory: 11.6 GiB, swap: 11.0GiB, Intel® Core™ i7-5600U Processor (4M Cache, up to 3.20 GHz) Arch Linux

I am calm.

The reason I ask what needs so much memory is because you said if you change the default php memory_limit it will break big projects. This implies you know a lot of memory is needed. And "big project" isn't something I can refer to either since I don't know what big means to you. I'm pretty sure vendor isn't being indexed but that is under the assumption you use the same excluders that come with vscode. And what if someone wanted to include vendor? Would they be in "big project" territory and not be able to do that due to memory usage?

If vendor isn't ignored can I ignore it to see if that helps?

I have a lot of work to do and can't spare time on this this week. I will come back to properly access things next week or the weekend.

felixfbecker commented 7 years ago

@robclancy no offence taken from my side :) Changing the default limit would not break large projects, setting the default to a fraction of the total RAM is a great idea, would appreciate a PR! vendor is indexed (as its definitions are needed). Nothing should ever use 10GB. Every file is indexed one at a time (with a reasonable size limit) and the index is really just string-to-object associative array. If anything uses that much RAM, it is more likely an infinite loop. Do you have XDebug installed and infinite recursion protection on?

jens1o commented 7 years ago

I'm pretty sure vendor isn't being indexed but that is under the assumption you use the same excluders that come with vscode. And what if someone wanted to include vendor? Would they be in "big project" territory and not be able to do that due to memory usage?

vendor (or to be exact the vendor-dir if found in composer.json) is being looked up for packages and then it will check the cache. When it hits the cache, the complete cache will be unserialized and used instead(same ram usage as before). Otherwise, it will index them and load them into the memory and insert them into the cache. So there are no changes in terms of memory, but in performance, because unserialization is faster than indexing... hi felix. I think I don't need to elelaborate further...

Arch Linux

which distro and what version? I want to reproduce that. :/

robclancy commented 7 years ago

Arch is the distro and it's rolling release.

I tried the xdebug thing in another issue to make sure it is run since it is off by default but it was a quick test because I have no time.

I'll debug myself before making a new issue next week.

jens1o commented 7 years ago

Oh, sorry. :( I thought you're talking about the architecture(x64 or x32).

shaneparsons commented 7 years ago

I see #357 has been merged, is there any further progress on this bug? I generally keep my activity monitor open when working with php, but every once in a while I miss the chance to intervene.

Let me know if you need any more information from my end, or if you'd like me to test!

jens1o commented 7 years ago

since the new parser, I don't have any problems anymore.

hazzlewis commented 7 years ago

Likewise, this issue hasn't cropped up for me in a while now.

-------- Original message -------- From: Jens Hausdorf notifications@github.com Date: 02/08/2017 15:36 (GMT+00:00) To: felixfbecker/php-language-server php-language-server@noreply.github.com Cc: Harry Lewis Harry.Lewis@paragon.net.uk, Mention mention@noreply.github.com Subject: Re: [felixfbecker/php-language-server] memory leak (#344)

since the new parser, I don't have any problems anymore.

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/felixfbecker/php-language-server/issues/344#issuecomment-319692020, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ATSpMfm1mLfFfHOmBVsKoCGr-wWXOYEfks5sUIltgaJpZM4M3_Nx.

jens1o commented 7 years ago

Closing for now.

shaneparsons commented 7 years ago

Strange... it happened to me just yesterday, crashing my computer.

I'm not seeing any updates available, do I have to manually download / update php-language-server?

felixfbecker commented 7 years ago

To everyone claiming it crashed their computer, note that you can specify a memory limit

shaneparsons commented 7 years ago

Ah okay... What's a healthy amount to allot to it?

jens1o commented 7 years ago

2GB should be fine.

staabm commented 7 years ago

(depends on project size, available ram, php version,...)

shaneparsons commented 7 years ago

Ah okay, thanks. I set it to 4GB to be safe.

I just tried running my example repo (above) and couldn't trigger the crash this time... So I'm not exactly sure what happened yesterday. I'll let you guys know if it happens again.

shaneparsons commented 7 years ago

I may have spoken too soon... this output comes up every time I go through the steps in that repo:

[Info  - 11:14:58 AM] Connection to server got closed. Server will restart.
[Error - 11:14:58 AM] Request textDocument/completion failed.
Error: Connection got disposed.
    at Object.dispose (/Users/30ptdesign/.vscode-insiders/extensions/felixfbecker.php-intellisense-1.5.0/node_modules/vscode-jsonrpc/lib/main.js:816:25)
    at Object.dispose (/Users/30ptdesign/.vscode-insiders/extensions/felixfbecker.php-intellisense-1.5.0/node_modules/vscode-languageclient/lib/client.js:66:35)
    at LanguageClient.handleConnectionClosed (/Users/30ptdesign/.vscode-insiders/extensions/felixfbecker.php-intellisense-1.5.0/node_modules/vscode-languageclient/lib/client.js:1071:38)
    at LanguageClient.handleConnectionClosed (/Users/30ptdesign/.vscode-insiders/extensions/felixfbecker.php-intellisense-1.5.0/node_modules/vscode-languageclient/lib/main.js:86:15)
    at closeHandler (/Users/30ptdesign/.vscode-insiders/extensions/felixfbecker.php-intellisense-1.5.0/node_modules/vscode-languageclient/lib/client.js:1059:18)
    at CallbackList.invoke (/Users/30ptdesign/.vscode-insiders/extensions/felixfbecker.php-intellisense-1.5.0/node_modules/vscode-jsonrpc/lib/events.js:114:39)
    at Emitter.fire (/Users/30ptdesign/.vscode-insiders/extensions/felixfbecker.php-intellisense-1.5.0/node_modules/vscode-jsonrpc/lib/events.js:178:36)
    at closeHandler (/Users/30ptdesign/.vscode-insiders/extensions/felixfbecker.php-intellisense-1.5.0/node_modules/vscode-jsonrpc/lib/main.js:212:26)
    at CallbackList.invoke (/Users/30ptdesign/.vscode-insiders/extensions/felixfbecker.php-intellisense-1.5.0/node_modules/vscode-jsonrpc/lib/events.js:114:39)
    at Emitter.fire (/Users/30ptdesign/.vscode-insiders/extensions/felixfbecker.php-intellisense-1.5.0/node_modules/vscode-jsonrpc/lib/events.js:178:36)
[Info  - 11:14:59 AM] 3268 files total
[Info  - 11:14:59 AM] Indexing project for definitions and static references
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Console/Kernel.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Events/Event.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Events/ExampleEvent.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Exceptions/Handler.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Http/Controllers/Controller.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Http/Controllers/ExampleController.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Http/Middleware/Authenticate.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Http/Middleware/ExampleMiddleware.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Jobs/ExampleJob.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Jobs/Job.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Listeners/ExampleListener.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Providers/AppServiceProvider.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Providers/AuthServiceProvider.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Providers/EventServiceProvider.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/User.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/bootstrap/app.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/database/factories/ModelFactory.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/database/seeds/DatabaseSeeder.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/public/index.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/tests/ExampleTest.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/tests/TestCase.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/autoload.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/autoload_classmap.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/autoload_files.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/autoload_namespaces.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/autoload_psr4.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/autoload_real.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/autoload_static.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/ClassLoader.php
[Info  - 11:14:59 AM] Indexing project for dynamic references
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Console/Kernel.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Events/Event.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Events/ExampleEvent.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Exceptions/Handler.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Http/Controllers/Controller.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Http/Controllers/ExampleController.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Http/Middleware/Authenticate.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Http/Middleware/ExampleMiddleware.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Jobs/ExampleJob.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Jobs/Job.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Listeners/ExampleListener.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Providers/AppServiceProvider.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Providers/AuthServiceProvider.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/Providers/EventServiceProvider.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/app/User.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/bootstrap/app.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/database/factories/ModelFactory.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/database/seeds/DatabaseSeeder.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/public/index.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/tests/ExampleTest.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/tests/TestCase.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/autoload.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/autoload_classmap.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/autoload_files.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/autoload_namespaces.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/autoload_psr4.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/autoload_real.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/autoload_static.php
Parsing file:///Users/30ptdesign/Downloads/temp-master/vendor/composer/ClassLoader.php
[Info  - 11:15:00 AM] 68 Packages
[Info  - 11:15:00 AM] Restored doctrine/inflector:1.1.0 from cache
[Info  - 11:15:00 AM] Restored doctrine/instantiator:1.0.5 from cache
[Info  - 11:15:00 AM] Restored fzaninotto/faker:1.6.0 from cache
[Info  - 11:15:00 AM] Restored hamcrest/hamcrest-php:1.2.2 from cache
[Info  - 11:15:00 AM] Restored illuminate/auth:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/broadcasting:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/bus:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/cache:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/config:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/console:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/container:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/contracts:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/database:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/encryption:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/events:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/filesystem:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/hashing:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/http:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/pagination:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/pipeline:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/queue:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/session:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/support:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/translation:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/validation:5.4.19 from cache
[Info  - 11:15:00 AM] Restored illuminate/view:5.4.19 from cache
[Info  - 11:15:00 AM] Restored laravel/lumen-framework:5.4.6 from cache
[Info  - 11:15:00 AM] Restored mockery/mockery:0.9.9 from cache
[Info  - 11:15:00 AM] Restored monolog/monolog:1.22.1 from cache
[Info  - 11:15:00 AM] Restored mtdowling/cron-expression:1.2.0 from cache
[Info  - 11:15:00 AM] Restored myclabs/deep-copy:1.6.1 from cache
[Info  - 11:15:00 AM] Restored nesbot/carbon:1.22.1 from cache
[Info  - 11:15:00 AM] Restored nikic/fast-route:1.2.0 from cache
[Info  - 11:15:00 AM] Restored paragonie/random_compat:2.0.10 from cache
[Info  - 11:15:00 AM] Restored phpdocumentor/reflection-common:1.0 from cache
[Info  - 11:15:00 AM] Restored phpdocumentor/reflection-docblock:3.1.1 from cache
[Info  - 11:15:00 AM] Restored phpdocumentor/type-resolver:0.2.1 from cache
[Info  - 11:15:00 AM] Restored phpspec/prophecy:1.7.0 from cache
[Info  - 11:15:00 AM] Restored phpunit/php-code-coverage:4.0.8 from cache
[Info  - 11:15:00 AM] Restored phpunit/php-file-iterator:1.4.2 from cache
[Info  - 11:15:00 AM] Restored phpunit/php-text-template:1.2.1 from cache
[Info  - 11:15:00 AM] Restored phpunit/php-timer:1.0.9 from cache
[Info  - 11:15:01 AM] Restored phpunit/php-token-stream:1.4.11 from cache
[Info  - 11:15:01 AM] Restored phpunit/phpunit:5.7.19 from cache
[Info  - 11:15:01 AM] Restored phpunit/phpunit-mock-objects:3.4.3 from cache
[Info  - 11:15:01 AM] Restored psr/log:1.0.2 from cache
[Info  - 11:15:01 AM] Restored sebastian/code-unit-reverse-lookup:1.0.1 from cache
[Info  - 11:15:01 AM] Restored sebastian/comparator:1.2.4 from cache
[Info  - 11:15:01 AM] Restored sebastian/diff:1.4.1 from cache
[Info  - 11:15:01 AM] Restored sebastian/environment:2.0.0 from cache
[Info  - 11:15:01 AM] Restored sebastian/exporter:2.0.0 from cache
[Info  - 11:15:01 AM] Restored sebastian/global-state:1.1.1 from cache
[Info  - 11:15:01 AM] Restored sebastian/object-enumerator:2.0.1 from cache
[Info  - 11:15:01 AM] Restored sebastian/recursion-context:2.0.0 from cache
[Info  - 11:15:01 AM] Restored sebastian/resource-operations:1.0.0 from cache
[Info  - 11:15:01 AM] Restored sebastian/version:2.0.1 from cache
[Info  - 11:15:01 AM] Restored symfony/console:3.2.7 from cache
[Info  - 11:15:01 AM] Restored symfony/debug:3.2.7 from cache
[Info  - 11:15:01 AM] Restored symfony/event-dispatcher:3.2.7 from cache
[Info  - 11:15:01 AM] Restored symfony/finder:3.2.7 from cache
[Info  - 11:15:01 AM] Restored symfony/http-foundation:3.2.7 from cache
[Info  - 11:15:01 AM] Restored symfony/http-kernel:3.2.7 from cache
[Info  - 11:15:01 AM] Restored symfony/polyfill-mbstring:1.3.0 from cache
[Info  - 11:15:01 AM] Restored symfony/process:3.2.7 from cache
[Info  - 11:15:01 AM] Restored symfony/translation:3.2.7 from cache
[Info  - 11:15:01 AM] Restored symfony/yaml:3.2.7 from cache
[Info  - 11:15:01 AM] Restored vlucas/phpdotenv:2.4.0 from cache
[Info  - 11:15:01 AM] Restored webmozart/assert:1.2.0 from cache
[Info  - 11:15:01 AM] All 3268 PHP files parsed in 2 seconds. 242 MiB allocated.

Since I now have the 4GB limit, it no longer crashes the computer... but there's still something strange going on.

twinklebob commented 7 years ago

To everyone claiming it crashed their computer, note that you can specify a memory limit

Can you clarify how we do this? I'm not 100% sure what I'm actually allocating memory to, so I can't be sure where to allocate it.

staabm commented 7 years ago

Adjust the memory_limit setting in your php.ini of the php-binary which executes the language server

robclancy commented 7 years ago

There is a setting for the addon to do the memory limit, just search in your vscode settings for memory. The default was changed to not be unlimited.

I'm going to look into this issue again since I have a bit of time today and see if I can still break it etc and try debugging it.

robclancy commented 7 years ago

TL/DR no memory issues for me anymore. My issue was when you type -> to get a list of methods/vars it would use all my memory until there was none left and then crash.

[Info - 7:59:23 pm] All 8944 PHP files parsed in 19 seconds. 454 MiB allocated. A bunch of this was from cache which is why it was so fast.

Next project... [Info - 8:06:40 pm] All 8556 PHP files parsed in 277 seconds. 576 MiB allocated. Don't think this one had caches.

I have noticed it indexing test files in my vendor directory meaning some packages aren't in my system as "dist" from composer so this will show extra files and use extra memory.


My issues with memory leaks in this task were related to using the intelli not indexing. I don't have issues with memory anymore however it takes seconds to show an objects methods which I am guessing is due to the size of these indexes.

I think a new option to ignore test files might help in general for my case at least where you can optionally ignore vendor folder called "tests" and files that end in "Test.php".

EDIT: using https://github.com/felixfbecker/php-language-server/pull/451 the auto completes are now fast.