Skip to content

Isolates appear as "paused on entry" even if they're not paused #5397

@simolus3

Description

@simolus3

Describe the bug

When spawning new isolates at the start of an application, these isolates are mistakenly viewed as "paused on entry" in the call stack of the debugging view.

import 'dart:async';
import 'dart:isolate';

void main() async {
  final isolates = <Isolate>[];

  for (var i = 0; i < 10; i++) {
    isolates.add(await Isolate.spawn(
      (_) {
        print('isolate $i started');
        Timer.periodic(const Duration(minutes: 10), (_) {});
      },
      null,
    ));
  }

  await Future.delayed(Duration(seconds: 2));
  print('at resumed state');
  Timer.periodic(const Duration(minutes: 10), (_) {});
}

Setting a breakpoint on the print in line 18 and running this Dart program in VS Code will show most isolates as "paused on entry" (usually all of them, but not always. Maybe this is a race condition?).
Unfortunately, this is not just a cosmetic issue. It also affects the pause button in the button bar of the debugger, which will now interact with the new isolates instead of pausing / resuming the main isolate like it usually would.

Expected behavior
The isolates (except for main paused on a breakpoint) are all running and should be displayed as such.

I've attached a VM service to print the isolate's state shortly after hitting the breakpoint, the isolates are listed as running there. So I think this may be an issue in the extension (as opposed to something in the vm service).

Screenshots

Immediately after program start, all secondary isolates are shown as "Paused on entry". Then afterwards they're showing up as "".

Image

Please complete the following information:

Workspace Environment
Dart Code extension: 3.102.0
Flutter extension: 3.102.0 (not activated)

App: Visual Studio Code
App Host: desktop
Version: mac 1.96.3

Workspace type: Dart (LSP)
Workspace name: vscode_startup_issue

Dart (3.6.1): /opt/homebrew/Cellar/dart/3.6.1/libexec
Flutter (3.27.2): /Users/simon/fvm/versions/stable (No device)

Output from 'dart info'

/opt/homebrew/Cellar/dart/3.6.1/libexec/bin/dart info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

General info

  • Dart 3.6.1 (stable) (Tue Jan 7 09:50:00 2025 -0800) on "macos_arm64"
  • on macos / Version 15.2 (Build 24C101)
  • locale is de-DE

Project info

  • sdk constraint: '^3.6.1'
  • dependencies: sqlite_async, vm_service
  • dev_dependencies: lints, test

Process info

Memory CPU Elapsed time Command line
116 MB 0.0% 22:01 dart devtools
30 MB 0.0% 38:41 dart devtools --machine --allow-embedding --dtd-uri ws:/szh7dcqvfD8=
231 MB 0.0% 38:42 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.102.0
581 MB 0.0% 30:56 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.102.0
33 MB 0.0% 38:42 dart tooling-daemon --machine
64 MB 0.0% 30:56 dart tooling-daemon --machine
72 MB 0.0% 38:42 flutter_tools.snapshot daemon

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions