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

devsense.php.ls consumes too much RAM #343

Closed
zarulizham opened this issue Jun 12, 2023 · 21 comments
Closed

devsense.php.ls consumes too much RAM #343

zarulizham opened this issue Jun 12, 2023 · 21 comments
Assignees
Projects

Comments

@zarulizham
Copy link

zarulizham commented Jun 12, 2023

There are two processes with devsense.php.ls consume 10GB+ RAM.

I have quit VS Code, but the processes still there. I have to Force Quit from Activity Monitor. Normal Quit did not release the processes.

image

Thank you.

@jakubmisek
Copy link
Member

Thank you @zarulizham for reporting the issue.

This is definitely a bug. Is the CPU usage high as well?

(VS Code creates one process for each of your workspaces, so two processes are expected when you open two workspaces).

@jakubmisek
Copy link
Member

jakubmisek commented Jun 14, 2023

@zarulizham May I ask what version you have installed?

We have a pre-release, which fixes several memory issues if you want to try it (https://docs.devsense.com/en/vscode/installation#pre-release-installation).

@jakubmisek jakubmisek self-assigned this Jun 14, 2023
@jakubmisek jakubmisek added this to To do in Stability via automation Jun 14, 2023
@jakubmisek
Copy link
Member

There is an update v1.35.13322 which improves that. We'd appreciate any feedback.

We'll keep improving RAM in the next updates.

@jakubmisek
Copy link
Member

The latest release fixes the issue with the process not being terminated.

@jakubmisek
Copy link
Member

jakubmisek commented Jul 1, 2023

Found the real memory leak, preparing an update today.

@chielteuben
Copy link

Tested various versions including pre-release, this issue still exists. It's even worse running multiple instances of VS Code.
I currently have 1 small project trying to eat up 8GB of memory for the php.ls process alone.
It has gotten to the point where a disk monitoring utility (company laptop) has started reporting (incorrect) SMART errors for my drive during VS Code usage with this extension enabled, which is quite hilarious.

If I could provide any information that would help you improve/fix this I'd be happy to help.

@jakubmisek
Copy link
Member

jakubmisek commented Aug 3, 2023

@chielteuben thank you for letting us know! I appreciate your help.

This is definitely a bug. The expected RAM usage for larger projects is about 500MB now (and we're going to cut this to half soon).

  • How soon after opening VSCode does it get to 8GB?
  • Do you use composer.json, so we could take a look on the packages you use?

Thank you!

@chielteuben
Copy link

I can replicate this behaviour instantly after opening the project.
In this specific case I'm hovering a function within a test file:
expect($result)->toBeTrue();

This will properly display any related information instantly, devsense.php.ls being at ~ 350MB.
I then change toBeTrue to toBeFalse (which exists), and hover it again. The "loading..." notification is shown and the devsense.php.ls process spikes to 8GB.
The weird thing is, toBeFalse is already being used elsewhere in the same file and can be properly hovered prior to this without causing the same issue. For the record: this also happens with other functions being hovered after being changed.

I can share the composer.json this monday but I can tell you what's in it from memory because it's a brand new project, it's the base Laravel 10 default composer.json with only "pestphp/pest" added.
And even though I doubt it's relevant: the default namespace for the project was changed using php artisan app:name NewNamespace (in case you want to 1:1 replicate this scenario).

@jakubmisek
Copy link
Member

@chielteuben awesome! I'll try to repro the issue within a day or two - if it happens to me as well, it should be easy to fix.

Thank you!

@jakubmisek
Copy link
Member

@chielteuben thank you again, we've successfully reproduced the issue and fixed this one. Most probably, it's been causing RAM and CPU issues for all the users here.

We'll be preparing update within a few hours.

@jakubmisek
Copy link
Member

Please try the latest 1.37.13534 and let me know. I appreciate your help with this - we've been trying to find the issue for months!

@chielteuben
Copy link

chielteuben commented Aug 4, 2023

I've just tested the latest version and the issue is solved!
I've also tested a larger project which uses the php.workspace.includePath setting to include 3 other large projects and the process sits at a (for me) respectable ~1600MB memory usage, where before VSCode was nearly unusable in that workspace when the extension was enabled.

@jakubmisek
Copy link
Member

@chielteuben thank you very much for testing it so quickly.

I'm happy it works for you. We'll keep improving the RAM usage in the upcoming updates.

If there would be anything else weird, please let me know.

@neriyaco
Copy link

neriyaco commented Aug 24, 2023

I'm using the extension on 2 different projects, one is totally fine, at 95MB but the other one sits on 3.8GB
Linux Ubuntu 22.04
Extension v1.37.13534

Screenshot
image

The bigger project is about 3-4 times bigger than the other one, but the RAM usage is insane, I'll will try to test if it is something specific.
Both use composer packages.

Update: I removed most of the code and it is still sitting on 3.8GB, even after restarting vs code, The only thing left that has a lot of code in it is the vendor and a lot of asset files (js, image, pdf etc.)

@LMachucaORT
Copy link

There is a way to ignore some folders to avoid indexing log folder for example?

@jakubmisek
Copy link
Member

@LMachucaORT yes,
you can use settings:

@LMachucaORT
Copy link

@LMachucaORT yes, you can use settings:

* `files.exclude` - files won't be indexed

* [php.problems.exclude](https://docs.devsense.com/en/vscode/problems#configuration) to only ignore errors in a folder

Thanks help me a lot!.

@jakubmisek
Copy link
Member

@neriyaco Thank you for trying our tools - May I ask if the RAM issue still happens? Most large projects we're testing sit at 1.5GB RAM.

@LMachucaORT
Copy link

May I ask if the RAM issue still happens? Most large projects we're testing sit at 1.5GB RAM.

Yes, I solved the RAM problem, because the project got too big, but by excluding many folders that I will not be working with, the RAM consumption was cut in half.

@jakubmisek
Copy link
Member

@LMachucaORT thank you for the update!

@zarulizham
Copy link
Author

Hi, after exclude some files, I did not face any memory issues anymore.

Stability automation moved this from To do to Done Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Stability
  
Done
Development

No branches or pull requests

5 participants