Skip to content

fix: keep the LSP console from showing a time since 1970 for a language server after an installation - #2061

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/startup-time-after-an-install
Nov 21, 2026
Merged

lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/startup-time-after-an-install

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Fixes #1335.

The time in #1335, 20375 d 15 h 40 m, is the time since 1970: 20375 days after 1970-01-01 is the day of the report. The language server row shows it because it lost a status:

  1. Stop switched the language server off, and its row showed disabled.
  2. Run Installation in the Installer tab first stops and switches off the language server (LanguageServerView's pre-install action). Already stopped, it gives stopping and then stopped at once, from the thread of the installation.
  3. The LSP console compared each status with the status of the row's node, to skip one that hadn't changed. But the node takes a status later, on the EDT, so when stopped came the node still had the status from before stopping. stopped looked unchanged, the console skipped it, and the node stayed stopping.
  4. A status that the node takes while its language server is switched off has no start time (-1).
  5. The end of the installation switches the language server on again. The node, still stopping, then showed the spinner of a stop that had ended long before, and the time since -1.

What looked like a start after the installation was that stopping: nothing starts the language server there.

The LSP console now passes each status on to the node, and compares it with the node's status once the node takes it, on the EDT (LanguageServerExplorerLifecycleListener). A node without a start time shows no time (LanguageServerProcessTreeNode.getElapsedTime).

Not here:

  • Running the installation through the language server instance, with an installing status, as suggested in Strange time calculation after installing a language server that exists on the system #1335. The time comes from the lost status and the missing start time, which this fixes without it.
  • The label of a row is computed when its node takes a status, so it can still say disabled after the end of the installation switches the language server on, until the next status.

Test: LanguageServerProcessNodesTest.testAStatusThatFollowsAnotherAtOnceOnAnotherThreadIsNotLost gives a language server stopping and then stopped from another thread, before the EDT runs, and checks that its node ends stopped. Without the change, it stays stopping. LanguageServerProcessTreeNodeTest.testAStatusTakenWhileSwitchedOffShowsNoTimeOnceSwitchedOn gives a node stopping while its language server is switched off, switches it on, and checks that the node shows no time. Without the change, it shows the time since 1970. They and the console, installer, LanguageServerManager and lifecycle tests pass (142 tests).

…ge server after an installation

The installation of the Installer tab stops and switches off the language
server first. Already stopped, it gives stopping and stopped at once, from
the installation's thread. The console compared each status with the one
of its node, which takes a status on the EDT: the stopped came while the
node still had the status before stopping, looked unchanged and was lost,
so the node stayed stopping. A status taken while the language server is
switched off has no start time, -1. Switched on again at the end of the
installation, the node showed the spinner of stopping and the time since
1970, as 20375 d 15 h 40 m.

The console now gives the node each status, and compares it with the
node's once the node takes it. A node without a start time shows no time.
@lagergren lagergren added this to the 0.30.2 milestone Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Process status updates now remain consistent when multiple updates arrive before the interface refreshes.
    • Elapsed time is no longer displayed when a server has no recorded start time.

The process explorer now applies status comparisons when queued UI updates run. Elapsed-time calculation returns no duration when a process node has no recorded start time. Regression tests cover both behaviors.

Changes: Process status updates

Layer / File(s) Summary
Apply queued status updates
src/main/java/com/redhat/devtools/lsp4ij/console/explorer/LanguageServerExplorerLifecycleListener.java, src/test/java/com/redhat/devtools/lsp4ij/console/LanguageServerProcessNodesTest.java
The listener compares status with the node’s current status when the UI update runs. The test verifies that consecutive background-thread updates leave the node stopped.

Elapsed-time calculation

Layer / File(s) Summary
Guard elapsed-time calculation
src/main/java/com/redhat/devtools/lsp4ij/console/explorer/LanguageServerProcessTreeNode.java, src/test/java/com/redhat/devtools/lsp4ij/console/explorer/LanguageServerProcessTreeNodeTest.java
getElapsedTime() returns null when the start time is negative. The test checks this behavior while the server definition is disabled and after it is re-enabled.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: d-biehl, sohamsakhare76-ai, angelozerr

Merge Risk: Minimal · up to cb090

This fixes the console showing a time since 1970 after a language server is installed and switched back on. No merge-blocking risk was identified, and regression tests cover the new behavior.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the LSP console no longer shows a time since 1970 for a language server after an installation. The changeset passes each status to the node, compares it after the EDT …
Description check Passed The description explains the root cause (a lost status from an unsynchronized comparison, and a missing start time of -1), the fix in LanguageServerExplorerLifecycleListener and LanguageServerProcessT…
Linked Issues check Passed Issue #1335 asks for a fix to the wrong elapsed time shown for a language server after stopping it and running its installer. The head code in LanguageServerExplorerLifecycleListener.updateServerStatu…
Out of Scope Changes check Passed The PR changes four files: LanguageServerExplorerLifecycleListener (status handling in the LSP console), LanguageServerProcessTreeNode (elapsed time for a node without a start time), and two test clas…
Full details: Title check

Explanation

The title names the main change: the LSP console no longer shows a time since 1970 for a language server after an installation. The changeset passes each status to the node, compares it after the EDT update, and shows no elapsed time when a node has no start time. This matches the fix described in the PR objectives and the raw summary.

Full details: Description check

Explanation

The description explains the root cause (a lost status from an unsynchronized comparison, and a missing start time of -1), the fix in LanguageServerExplorerLifecycleListener and LanguageServerProcessTreeNode.getElapsedTime, the new regression tests, and known limitations. It is directly related to the changeset.

Full details: Linked Issues check

Explanation

Issue #1335 asks for a fix to the wrong elapsed time shown for a language server after stopping it and running its installer. The head code in LanguageServerExplorerLifecycleListener.updateServerStatus now queues each supplied status and compares it with the node's status only when the node takes it on the EDT. This closes the lost-status path that the PR describes: a 'stopped' that follows 'stopping' at once is no longer skipped. The same method also keeps a status for a node whose language server was taken over or disposed, so a stale stop state does not persist. The PR summary states that LanguageServerProcessTreeNode.getElapsedTime returns null for a negative start time. I could not read that hunk, because the diff and the blob were unavailable, so that part rests on the summary. The added tests LanguageServerProcessNodesTest.testAStatusThatFollowsAnotherAtOnceOnAnotherThreadIsNotLost and LanguageServerProcessTreeNodeTest.testAStatusTakenWhileSwitchedOffShowsNoTimeOnceSwitchedOn cover both halves of the reported symptom. The PR does not add an 'installing' status, which the issue suggested. The PR text says that this is not needed to fix the displayed time. The issue does not require that approach as a coding requirement.

Full details: Out of Scope Changes check

Explanation

The PR changes four files: LanguageServerExplorerLifecycleListener (status handling in the LSP console), LanguageServerProcessTreeNode (elapsed time for a node without a start time), and two test classes that cover those two behaviors. Each change relates to the time and status symptom in #1335. The label of a row can still show 'disabled' until the next status. The PR states this limit, and it is not a change outside the issue scope. No unrelated change was found in the inspected evidence. The LanguageServerProcessTreeNode hunk was not directly readable, so its scope relies on the summary, which describes a change limited to getElapsedTime.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 65747796-0dcd-477f-89fa-a9e9d1c07945
Commits

Reviewing files that changed from the base of the PR and between b982bd4 and cb09080.

Files selected for processing: 4

  • src/main/java/com/redhat/devtools/lsp4ij/console/explorer/LanguageServerExplorerLifecycleListener.java
  • src/main/java/com/redhat/devtools/lsp4ij/console/explorer/LanguageServerProcessTreeNode.java
  • src/test/java/com/redhat/devtools/lsp4ij/console/LanguageServerProcessNodesTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/console/explorer/LanguageServerProcessTreeNodeTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.49%. Comparing base (b982bd4) to head (cb09080).

Files with missing lines Patch % Lines
...lorer/LanguageServerExplorerLifecycleListener.java 50.00% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2061   +/-   ##
=======================================
  Coverage   49.49%   49.49%           
=======================================
  Files         813      813           
  Lines       33350    33352    +2     
  Branches     5195     5196    +1     
=======================================
+ Hits        16505    16508    +3     
+ Misses      14272    14268    -4     
- Partials     2573     2576    +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lagergren
lagergren merged commit e7e2f5d into redhat-developer:main Nov 21, 2026
9 checks passed
@lagergren lagergren added bug Something isn't working lsp-console labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lsp-console

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strange time calculation after installing a language server that exists on the system

1 participant