You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DAP: serialize the resume after an answer with the suspension of a stop, so that a late-handled answer can't undo a stop #2322
#2321 makes the answer to Reverse Continue, Step Back or Reset Frame leave the session alone once the debug adapter
has reported a stop or a continue since the request. That closes the case of #2320, where stopped comes before the
answer.
One narrower window remains, as CodeRabbit noted in #2321:
The answer comes first, the order DAP normally uses, but its handler runs late on the EDT.
The handler checks that the epoch hasn't ended and that the session is still at the old stop, and both checks
pass.
Before it calls session.sessionResumed(), the stopped event arrives. On a pool thread, the stop fetches the
threads and the stack, and suspends the session at the new stop.
sessionResumed() then clears that stop.
The session then shows the program running although it is stopped, until the next stopped event. It needs the
whole stop, with two round trips to the debug adapter, to complete in the gap between the check and the resume, so
it should be much rarer than #2320.
How to close it
Make the check-and-resume of DAPClient.resumeWhenAnswered and the stop's suspension (positionReached)
mutually exclusive: one lock, or one serial executor, shared by both. With a lock:
either the resume runs first, and the stop suspends the session after it;
or the stop runs first, and the resume then finds a new suspend context and does nothing.
Care needed
Both sessionResumed() and positionReached call IntelliJ's debugger listeners synchronously, and the lock would be
held while they run. A listener that waits for another thread that needs the lock would deadlock. Check this on 2024.2,
and with the split debugger of 2026.x.
Test
Force the answer-first order: the answer handled on the EDT, the epoch check passing, and then the stop's stackTrace released only while the EDT is inside sessionResumed()'s beforeSessionResume. The test needs no
fixed sleeps, as in #2321's test. It should fail without the lock, and pass with it, on 2024.2, 2026.2 and 2026.3.
Activity
fix: a refused Resume or step leaves the session at a stop which come…
fix: a 'continued' event leaves the session at a stop of another thre…
fix: a refused Resume or step leaves the session at a stop which come…
fix: a 'continued' event leaves the session at a stop of another thre…
fix: the session stays suspended at a stop which comes while the answ…