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

Language server process not stopped on VSCode exit. #56

Closed
dengorp opened this issue Jan 26, 2017 · 8 comments
Closed

Language server process not stopped on VSCode exit. #56

dengorp opened this issue Jan 26, 2017 · 8 comments

Comments

@dengorp
Copy link

dengorp commented Jan 26, 2017

On OSX 10.12.3 with VSCode 1.8.1 the language server sometimes keeps running in the background, eating CPU resources at 80-99%.
Judging by the older issues and the performance mention in the readme its still indexing projects
I'll try to find out more when I have a bit more time to experiment.

@felixfbecker
Copy link
Owner

What are you suggesting it to do? It is a child process of VS Code, it should die automatically

@dengorp
Copy link
Author

dengorp commented Jan 26, 2017

I can confirm now that the language server processes in some weird cases are not closed with VSCode, after opening multiple projects sometimes it spawns multiple processes which stay up after the VSCode process exits.

While VSCode runs the php processes look normal but after a couple of minutes of closing code, the CPU usage ramps up and start to impact system performance.

I'll try to take some time to further investigate this and figure out a way to reliably reproduce the issue.

@felixfbecker
Copy link
Owner

I am worried that even when you find a way to reproduce, I cannot think about a way to fix this.

@jmcbee
Copy link

jmcbee commented Feb 2, 2017

I just noticed this as well. When I quit VS code, the spawned process doesn't exit at all!

@lokken
Copy link
Contributor

lokken commented Apr 11, 2017

screen shot 2017-04-11 at 10 39 28 am

These processes have been collecting since last evening. I let it run overnight to see if they would eventually die but they haven't. I think my computer went to sleep at one point but once I opened it again this morning, they resumed their torture. I have shut down and reopened VSCode several times since last evening. Ah, it seems that a new one is spawned each time I reopen VSCode because after restarting again I now have 6 php processes :)

I'm on a MacBook Air with VSCode 1.11.1 but this issue has been occurring over the course of the last year through each upgrade of VSCode and this extension.

For this case, I was simply in the middle of writing code when things started to get sluggish and the fan starting whirring. How does the indexer decide to start indexing? Does it randomly start up? I don't see anything interesting in devtool console log.

@felixfbecker
Copy link
Owner

I would accept a PR that implements a poll of the pid passed to initialize at a regular (not too small) interval.

@felixfbecker
Copy link
Owner

How does the indexer decide to start indexing? Does it randomly start up?

It starts indexing on startup, once. Then it's just parsing of files you change.

I don't see anything interesting in devtool console log.

Look at the output panel instead.

@lokken
Copy link
Contributor

lokken commented Apr 12, 2017

Thanks for the help. I tracked down my particular issue with the code pasted below. The code came from the PHPUnit website but is missing require __DIR__.'/../vendor/phpunit/dbunit/PHPUnit/Extensions/Database/TestCase';, which is what seems to be causing the issue. I do have the DbUnit php extension installed (via composer require --dev phpunit/dbunit). The question is why would this cause the indexer to hang and run indefinitely, even after VSCode is shut down?

Adding the require line and then saving does not fix the issue, so maybe the indexer is too busy in its infinite loop at that point to pick up the change. What does fix the issue is to add the require, shut down VSCode, kill the orphaned php process, and then start VSCode again. At the point, I can see it and everything else get indexed in the output panel.

Hopefully posting this can help with debugging the issue.

<?php

class IntegrationTestCase extends PHPUnit_Extensions_Database_TestCase
{
	private static $pdo = null;
	private $conn = null;

	public function getConnection()
	{
		if ($this->conn === null) {
			if (self::$pdo == null) {
				self::$pdo = new PDO('sqlite::memory:');
			}
			$this->conn = $this->createDefaultDBConnection(self::$pdo, ':memory:');
		}

		return $this->conn;
	}

	public function getDataSet()
	{
		return new PHPUnit_Extensions_Database_DataSet_YamlDataSet(dirname(__FILE__)."/files/integration/integration.yml");
	}
}

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

4 participants