Skip to content

test: fix the two tests that failed on main today - #1984

Merged
lagergren merged 2 commits into
redhat-developer:mainfrom
lagergren:test/wait-for-the-stop-not-an-answer-from-a-closed-session
Nov 12, 2026
Merged

lagergren merged 2 commits into
redhat-developer:mainfrom
lagergren:test/wait-for-the-stop-not-an-answer-from-a-closed-session

Conversation

@lagergren

@lagergren lagergren commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

DAPSessionTreeTest.testALiveSessionBelowATerminatedChildKeepsTheDebugSessionRunning failed twice on main today, both times on macOS: on 358015d at 09:44, and on af306d6 at 11:27. Both times it waited out its 2-minute bound: "the client handles the messages of the sessions".

Cause

The test, not the client. To check that the last terminated stops the debug process, the test sent a ping on that session's connection and waited for the client's answer. But stopping the debug process closes the connections of the sessions, and may close that one before the client answers the ping. The answer then never comes.

It reproduced on its first run locally with all CPUs busy. A thread dump at the hang showed one ping without an answer: the grandchild's, sent after its terminated ended the last live session. On a fast machine the answer usually goes out first, which is why it passed before. Today's DAP changes (#1965, #1974) changed how fast the connections close on a stop.

Change

The three checks that the debug session stops now wait until the debug process is stopping, as the test already did for a connection that closes. The checks that the session keeps running still use the ping, since those connections stay open.

How this was checked

Under the same full CPU load, 10 runs out of 10 pass. Before the change, it hung on the first.

FileOperationEditSaveTest.testTheServerIsToldOfTheRenameAfterTheSave

The other test that failed on main today, once, on the IntelliJ 2026.3 runner (1224c41). It gave up after its 10-second bound with "the server must be told of the rename", and printed nothing. It passed 15 times out of 15 locally with every CPU busy, so this looks like a slow runner rather than a lost notification. Its waits now only end a hang, at 60 seconds. A notification that really got lost would still fail the test.

…ssion which the stop ends

The session-tree tests checked that the last 'terminated' stops the debug
process by sending a ping on that session's connection, and waiting for
the client's answer. But stopping the debug process closes the
connections of the sessions, and may close that one before the client
answers the ping: the test then waited out its two minutes. It failed so
on macOS on main twice today, and on its first run under a full CPU load
locally. The test now waits until the debug process is stopping, as it
already did for a connection which closes.
@lagergren lagergren added this to the 0.30.0 milestone Nov 12, 2026
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

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: fe9d7307-f4ad-4d36-b9fa-366487cc2d2c
Commits

Reviewing files that changed from the base of the PR and between da4b1d6 and e47fd92.

Files selected for processing: 2

  • src/test/java/com/redhat/devtools/lsp4ij/FileOperationEditSaveTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPSessionTreeTest.java

@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.41%. Comparing base (daf9842) to head (e47fd92).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1984      +/-   ##
==========================================
+ Coverage   48.38%   48.41%   +0.03%     
==========================================
  Files         810      810              
  Lines       32612    32611       -1     
  Branches     6649     6649              
==========================================
+ Hits        15778    15790      +12     
+ Misses      14325    14315      -10     
+ Partials     2509     2506       -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.

testTheServerIsToldOfTheRenameAfterTheSave failed once on main today, on
the IntelliJ 2026.3 runner, after its bound of 10 seconds: the server
wasn't told of the rename in time. It passed 15 times out of 15 locally
with every CPU busy, and printed nothing when it failed, so it looks like
a slow runner rather than a lost notification. The waits of the test now
only end a hang, at 60 seconds; a lost notification would still fail it.
@lagergren lagergren changed the title test: wait for the debug session to stop, not for an answer from a session which the stop ends test: fix the two tests that failed on main today Nov 12, 2026
@lagergren
lagergren merged commit b43d31c into redhat-developer:main Nov 12, 2026
9 of 10 checks passed
lagergren added a commit that referenced this pull request Nov 21, 2026
…ations that move its last document (#2076)

## What

`FileOperationEditSaveTest.testTheServerIsToldOfTheRenameAfterTheSave` failed on the 2025.3 job of #2075 (run 44941700678, attempt 1). It waited 60 seconds for `workspace/didRenameFiles`, which never came. It had failed before, on 2026-11-12, when #1984 raised its wait from 10 to 60 seconds.

## Cause

The test renames the only document of its language server, and that document has no editor. Two things happen after the rename, and they race:

- **The notification:** `AbstractLSPFileListener` first saves the documents that the `willRenameFiles` edit changed, in an `invokeLater`, and only then sends `didRenameFiles`.
- **The stop:** `LSPFileListener` checks in the background whether the moved document is open at its new place. It has no editor there, so it isn't connected again. `stopIfIdle` then stops the language server, which has no document left. In unit-test mode the stop comes at once; otherwise it comes after `lastDocumentDisconnectedTimeout`.

When the stop wins, sending `didRenameFiles` starts the language server again. A probe that held the UI thread for 3 seconds after the rename showed it: the server stopped at 3187 ms, `didRenameFiles` arrived at 3210 ms, and the server was started again at 3213 ms. In the failed CI run, the stop's `shutdown` timed out during the test (`Timeout error while shutdown the language server 'mock-server-id'`), and `didRenameFiles` never arrived.

## Fix

`afterVfsChange` takes a keep-alive lease (`LanguageServerItem.keepAlive()`) on the language server. It releases the lease once the last `did*` notification of the file operations has been sent; the notifications are sent in order, so the last one goes after the others. The release runs off the dispatcher thread, because it can stop the language server.

So when a file operation moves a language server's last document, the server now stops after it's told of the operation, not before, and it isn't started again just to be told.

## Test

`FileOperationEditSaveTest.testTheServerIsToldOfTheRenameOfItsLastDocumentBeforeItStops` holds the UI thread for 500 ms after the rename, so that the stop would win. It then checks that the server had one connection when it was told of the rename. Without the fix it had two, because it had been started again.

All file-operation, file-move and keep-alive tests pass (118), and so does the full suite (1,808 tests, 0 failures, 7 skipped).
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.

1 participant