Repository navigation
test: DAPRefusedResumeSessionTest records the pauses only once IntelliJ has told the listeners of the first stop - #2304
Merged
lagergren merged 1 commit intoNov 27, 2026
Conversation
…iJ has told the listeners of the first stop testAStopBeforeARefusedResumeAtABreakpointWhichDoesNotSuspendIsWhereTheSessionIsSuspended failed once on CI (Test (ubuntu-latest, 2026.3), IU 2026.3, on PR redhat-developer#2302) with "The frames where the session paused since it ran to the breakpoint: only at the newer stop expected:<[3]> but was:<[1, 3]>". The 1 was the first stop, which the test had seen before it started recording. XDebugSessionImpl.positionReached shows the session suspended (paused, suspend context, current frame) before it tells the listeners with sessionPaused, on the thread that suspended the session, here a common-pool thread of the DAP client. debug() returned as soon as the session showed the first stop, and recordPauses() then added its listener. When that thread was still between the two, in logPositionReached, the new listener was told of the first stop too, at frame 1, before the test resumed the program: pool: positionReached(stop 1) shows the session suspended at frame 1 EDT: debug() sees it, recordPauses() adds the listener, then Resume pool: sessionPaused() for stop 1, recorded as frame 1 ... breakpoint stop 2 (doesn't suspend), 'stopped' 3, refused 'continue': pause at frame 3 The product paused once per stop, as it should: it doesn't suspend the session at the stale stop. The DAP server of the test now stops first when the test says, once it is configured. debug() adds a session listener before that, and returns only once IntelliJ has told it of the first pause. A listener added after that isn't told of it, as IntelliJ tells the listeners that it has when it starts telling them. Shown with a hold of IntelliJ's thread in logPositionReached at the first stop, until the test had started recording: the test failed every time with the CI message on 2024.2. With this change and the same hold, released while the session showed the stop but hadn't told its listeners yet, it passes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2304 +/- ##
==========================================
+ Coverage 58.51% 58.53% +0.01%
==========================================
Files 847 847
Lines 36501 36501
Branches 7560 5733 -1827
==========================================
+ Hits 21360 21365 +5
- Misses 12136 12139 +3
+ Partials 3005 2997 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
@coderabbitai review |
Action not completed
|
Collaborator
Author
|
@coderabbitai review |
Action performed
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DAPRefusedResumeSessionTest.testAStopBeforeARefusedResumeAtABreakpointWhichDoesNotSuspendIsWhereTheSessionIsSuspendedfailed once on the IU 2026.3 CI job of #2302, whose changes are unrelated:Cause: a race in the test
IntelliJ marks a session suspended at a stop before it tells the session's listeners (
sessionPaused), on the thread that suspended it, here a pool thread of the DAP client; in between it runslogPositionReached(checked inXDebugSessionImplof 2024.2 and 2026.3).debug()returned as soon as the session showed the first stop, andrecordPauses()then added its listener, which IntelliJ could still tell about that first stop:positionReachedfor stop 1, the session shows frame 1;debug()sees it,recordPauses()adds its listener, Resume;sessionPausedfor stop 1 reaches the new listener, recorded as frame 1;[1, 3].The product pauses once per stop and never at the stale stop.
Fix
The mock DAP server no longer stops by itself at
configurationDone.debug()waits until the session exists and the server is configured (and has the breakpoint where there is one), adds a session listener, sends the first stop, and returns once IntelliJ has told that listener of the pause. A listener added from then on isn't told of it. All 14 tests start throughdebug().Tests
logPositionReachedat the first stop, after the session shows the stop and before it tells the listeners. With the old test it fails every time with the CI message; with this one it passes. The hold isn't kept: it tests the test's own recording, and depends on an experimental extension point and a private method's name.dap.stepping.*on 2024.2, 28 tests;DAPRefusedResumeSessionTeston IU 2026.3, 14 tests. No failure, error or skip.Test only, no change for users.