Skip to content

LanguageServerProcessNodesTest.testADisposedLanguageServerExpiresItsCannotStartNotification fails at times: it disposes the language server before the server keeps its notification #2330

Done

Description

@lagergren

LanguageServerProcessNodesTest.testADisposedLanguageServerExpiresItsCannotStartNotification failed once on Linux, in the first CI run of #2328, which doesn't touch the LSP console. It passed on Windows, 2025.3 and 2026.3 in the same run.

junit.framework.AssertionFailedError
    at com.redhat.devtools.lsp4ij.console.LanguageServerProcessNodesTest.testADisposedLanguageServerExpiresItsCannotStartNotification(LanguageServerProcessNodesTest.java:597)

Line 597 asserts that disposing the language server whose start failed expired its "Cannot start server" notification.

Cause: the test

LanguageServerWrapper.showNotificationStartServerError shows the notification (CancellationSupport.showNotificationError, which notifies the bus) and only then keeps it in errorNotification. It does so on the thread of the failed start. The test waits until the notification is shown, so it can dispose the language server in between. Its dispose then finds no notification to expire. The thread of the start expires it right after, when it sees that the language server was disposed, but the test has asserted by then.

The product handles this: a dispose expires the notification it keeps, and a notification shown during a dispose is expired once it is kept. testACannotStartNotificationShownWhileItsLanguageServerIsDisposedExpires covers that second case, and waits for the expiry.

Proof

With a temporary pause of one second between the notification and errorNotification = notification, the test fails every time at line 597, as on CI.

Fix

The test waits until the failed start reports its error (LanguageServerLifecycleListener.handleError), which it does after it kept the notification, before it disposes the language server. It still asserts that the dispose expires the notification at once.

Activity

  1. added this to the 0.30.2 milestone on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions