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

Stop language server on shutdown (#681) #688

Closed
wants to merge 8 commits into from

Conversation

basilevs
Copy link
Contributor

@basilevs basilevs commented Jun 6, 2023

The problem (#681):
Language server is not stopped on Eclipse shutdown, as LanguageServerWrapper does not call stop() before stopping its thread pools.

Solution:

  • make stop() observable
  • wait for stop() to complete on Eclipse shutdown
  • fix synchronization in background threads
  • use owned dispatcher when applicable
  • move LanguageWrapperTest to be able to call package private method

Concerns:
Test is slow locally - shutdown command times out for no apparent reason
Synchronization fixes may lead to deadlocks.

@basilevs
Copy link
Contributor Author

basilevs commented Jun 6, 2023

I now understand, why there is LanguageServiceAcessor.shutdownAllDispatchers().
This method shuts down the dispatchers in a non-recoverable manner, without removing them from the registry. This prevents their accidental recreation during shutdown process.
Unfortunately this means, that tests testing shutdown log a bunch of exceptions.
Further work is required to reconcile the requirement of immutable termination and test cleanup.

UPDATE: done by preventing repeating calls to stopDispatchers() from calling stop().

Note the use of Plafotm.getLog() - ILog can't be received from plug-in
activator during platform shutdown.
@basilevs
Copy link
Contributor Author

basilevs commented Jun 7, 2023

The failing Junit test seems to be unstable in master.

basilevs added a commit to basilevs/lsp4e that referenced this pull request Jun 7, 2023
@rubenporras
Copy link
Contributor

Hi @basilevs,

I have realized that this PR has been waiting for 9 months for my review. Sorry for that.

Would you still like to merge the PR after resolving the conflicts? I did not look at the conflicts, but might any of the conflicts have resolved the problem you wanted to fix?

Regards

@basilevs basilevs marked this pull request as draft March 19, 2024 17:10
@basilevs
Copy link
Contributor Author

Failed to execute goal org.eclipse.tycho.extras:tycho-p2-extras-plugin:4.0.6:compare-version-with-baselines (compare-version-with-baseline) on project org.eclipse.lsp4e.tests.mock: Only qualifier changed for (org.eclipse.lsp4e.tests.mock/0.16.8.202403191733). Expected to have bigger x.y.z than what is available in baseline (0.16.8.202402141138) -> [Help 1]

@rubenporras
Copy link
Contributor

Hi @basilevs , you should do the bump as part of this PR, not as a new PR. Regarding the error that you got in the build of #948 , I will ask for help, I do not know what causes it yet.

@basilevs
Copy link
Contributor Author

basilevs commented Mar 20, 2024

Hi @basilevs , you should do the bump as part of this PR, not as a new PR.

But this PR would have tens of version bumps this way? Surely that is impractical?
Also, this PR has nothing to do with release management.

@rubenporras
Copy link
Contributor

Yes, it is not very practical, but it is also not a big deal, and it is so far how the project has handled it. I think the reason is not to bump plugin versions unless there is a code change.
You could create also a PR with two commits, if you want to not mix all in one commit.

@basilevs
Copy link
Contributor Author

basilevs commented Mar 20, 2024

Yes, it is not very practical, but it is also not a big deal, and it is so far how the project has handled it. I think the reason is not to bump plugin versions unless there is a code change. You could create also a PR with two commits, if you want to not mix all in one commit.

Well, anyway, a separate PR in this case is important, as it demonstrates, that builds are broken and meaningful changes in other PRs are not the cause.

@basilevs
Copy link
Contributor Author

Tests are failing. Probably due to merge side-effects. Further work is required.

java.lang.AssertionError
	at org.junit.Assert.fail(Assert.java:87)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertTrue(Assert.java:53)
	at org.eclipse.lsp4e.LanguageServerWrapperTest.testConnect(LanguageServerWrapperTest.java:73)
java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
	at java.base/java.lang.Thread.start0(Native Method)
	at java.base/java.lang.Thread.start(Thread.java:802)
	at java.base/java.util.Timer.<init>(Timer.java:188)
	at java.base/java.util.Timer.<init>(Timer.java:170)
	at org.eclipse.lsp4e.LanguageServerWrapper.<init>(LanguageServerWrapper.java:164)
	at org.eclipse.lsp4e.LanguageServerWrapper.<init>(LanguageServerWrapper.java:181)
	at org.eclipse.lsp4e.LanguageServiceAccessor.getLSWrapper(LanguageServiceAccessor.java:378)
	at org.eclipse.lsp4e.LanguageServiceAccessor.getLSWrappers(LanguageServiceAccessor.java:253)
	at org.eclipse.lsp4e.LanguageServerWrapperTest.doNotStopBusyDispatchers(LanguageServerWrapperTest.java:149)

@basilevs
Copy link
Contributor Author

My project using LSP4E is suspended, so I'm dropping this work.

@basilevs basilevs closed this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants