Skip to content

DAP: a second stopped event while suspended lists every thread twice #2118

Closed

Description

@lagergren

What happens

When the adapter sends stopped while the session is already suspended, LSP4IJ adds every thread to the current suspend context again:

  • the Frames view then lists each thread twice;
  • each later stop adds them once more;
  • the older copies keep the frames they were built with.

Reproduced on IntelliJ IDEA Community 2024.2 and 2025.3, with a test whose adapter stops main and then worker:

The threads which the Frames view lists expected:<[main, worker]> but was:<[main, worker, main, worker]>

When it happens

  • The adapter stops only the thread that hit a breakpoint (allThreadsStopped: false), and a second thread stops while the first stop is shown.
  • The program resumes without LSP4IJ knowing, then stops again. An example is GDB after continue typed in the Debug console. LSP4IJ doesn't handle the continued event yet (DAP: support the Continued event #2106), so the session is still suspended at the next stop.

Steps

  1. Debug a program with two threads, main and worker, with an adapter that stops only the thread that hits a breakpoint.
  2. main stops at a breakpoint.
  3. While the session is suspended, worker stops at a breakpoint.
  4. Open the thread list of the Frames view.

Expected

Each thread is listed once, and the session shows the stop in worker.

Cause

On main (35eb012):

  • DAPClient.stopped reads the threads and the stopped thread's frames, then calls suspend (DAPClient.java:569-588).
  • getSuspendContext reuses the session's DAPSuspendContext when the session is suspended, and calls addToExecutionStack for every thread (DAPClient.java:753-761).
  • DAPSuspendContext.addToExecutionStack always appends a new DAPExecutionStack (DAPSuspendContext.java:36-43), so the stacks of the earlier stop stay.
  • The Frames view gets all of getExecutionStacks() through XSuspendContext.computeExecutionStacks.

Suggested fix

  • Create a new DAPSuspendContext for each stop in getSuspendContext. The threads are read again on every stop anyway (getThreads(true)).
  • If the old context must be kept, addToExecutionStack should replace the stack of a thread that is already there, keyed by the thread id.

Related

#2106

Activity

  1. added
    bug
    dap
    on Nov 22, 2026
  2. added a commit that references this issue on Nov 23, 2026
    d0affa0
  3. added this to the 0.30.2 milestone on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdap

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions