Skip to content

Debugger has races and can show "Paused on Entry" shown for continued threads #280933

Open

Description

@DanTup

This came up before in #238591 and it was fixed, however I had the same issue reported again this week and have managed to repro again in mock debug (I think the timing is just slightly different to trigger this).

Here's a full repro you can run:

https://github.com/DanTup/vscode-mock-debug/tree/repro-dart-code-5829
git clone https://github.com/DanTup/vscode-mock-debug -b repro-dart-code-5829

The repro code looks like:

// Start additional threads, pause on entry, continue.
const startThread = 2, endThread = 12;
for (var i = startThread; i <= endThread; i++) {
	this._threads.push(new Thread(i, `Thread ${i}`));
	this.sendEvent(new ThreadEvent('started', i));
	this.sendEvent(new OutputEvent(`Thread ${i} started\n`));
}

await this.delay(1);

for (var i = startThread; i <= endThread; i++) {
	this.sendEvent(new StoppedEvent('entry', i));
	this.sendEvent(new OutputEvent(`Thread ${i} stopped on entry\n`));
}

await this.delay(1);

for (var i = endThread; i >= startThread; i--) {
	this.sendEvent(new ContinuedEvent(i, false));
	this.sendEvent(new OutputEvent(`Thread ${i} continued\n`));
}

Open and run the mock debug extension, open a markdown file, press F5. You will sometimes see the following (it's timing dependent, and sometimes it works fine):

Image

Note: I do not believe it's related (since it still wouldn't add up), but the StoppedEvent in the debug library used here does not appear to support setting allThreadsStopped (which in the actual debug adapter where I'm hitting this issue I set to false). Even if that was being set to true here, since we stop all threads before resuming all threads, the result is the same - every thread is resumed at the end, yet the UI often shows many threads paused.

cc Connor Peet (@connor4312) since you made the previous fix.

The "real" repro for this with Dart is at Dart-Code/Dart-Code#5829, including a copy of what the real DAP log looks like (Dart-Code/Dart-Code#5829 (comment)).

Activity

  1. added
    bugIssue identified by VS Code Team member as probable bug
    debugDebug viewlet, configurations, breakpoints, adapter issues
    on Dec 3, 2025
  2. anthonymoretti commented on Feb 16, 2026

    @anthonymoretti

    I've been experiencing the same problem on iOS and macOS for over a year a I think, the problem doesn't occur on Android for me though. Not sure if it's related to Dart-Code/Dart-Code#5397.

    I'll include 4 screenshots of what I see in VS Code on my Mac when running on the iOS Simulator, and 1 screenshot of the (correct) UI I see when running on the Android Emulator.

    iOS Simulator screenshots:

    1. After I click "Start Debugging".
    2. When isolates have started.
    3. When isolates have finished.
    4. After I click "Continue".

    Android Emulator screenshot:

    • When isolates have started (correct).

    --

    Image

    iOS - 1. After I click "Start Debugging"

    Image

    iOS - 2. When isolates have started

    Image

    iOS - 3. When isolates have finished

    Image

    iOS - 4. After I click "Continue"

    Image

    Android - When isolates have started (correct)

  3. DanTup commented on Feb 17, 2026

    @DanTup
    ContributorAuthor

    Anthony Moretti (@anthonymoretti) the issue is a race that depends on specific timing. The timing of the threads starting on different platforms varies a bit, which is probably why it triggers on one platform and not others.

    Not sure if it's related to Dart-Code/Dart-Code#5397.

    That issue was also a VS Code bug that was fixed in #265755. My feeling is that this is a similar issue (a different race, but with the same outcome that the local model of threads in VS Code becomes incorrect).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugdebugDebug viewlet, configurations, breakpoints, adapter issues

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions