-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DevTools automatically resumes after current breakpoint if paused when connecting #8812
Comments
Possibly related to #8789. |
Possibly related to flutter/flutter#158958. @jakemac53 do you have VM Developer Mode enabled in DevTools? (Open DevTools and check the top level settings) |
I do not have VM Developer Mode enabled, should I? |
No, you don't need to. In flutter/flutter#158958, the workaround was to disable VM Developer Mode. I'm suspicious that this is a problem with the CPU profiler itself, but rather a problem with DevTools automatically resuming upon connecting to the app. I know @elliette worked on some breakpoint-related logic last year that could be related to this bug. |
Yes this seems to be exactly what is happening |
Indeed if I even just do the "open devtools" command pallete option - it resumes as soon as that connects. |
Is this because devtools assumes it is connecting to something which hasn't actually started yet? Like an app which set pause-isolates-on-start? |
Adding some notes here. This is something @bkonyi @DanTup and I worked on last year. A high level summary is that DDS, which sits between our debugging tools (e.g. DevTools, IDEs) and the VM Service is responsible for deciding when to forward a What we would expect to happen here:
It's possible |
I think the issue might be that this is only for the pause on start and pause on exit states? (see https://github.com/dart-lang/sdk/blob/b7a9e2b5d90807c137832c221f50d29f53d107c0/pkg/dds/lib/src/isolate_manager.dart#L446 and https://github.com/dart-lang/sdk/blob/b7a9e2b5d90807c137832c221f50d29f53d107c0/pkg/dds/lib/src/isolate_manager.dart#L99). So, if it is paused at a user breakpoint then there isn't logic in there to not resume when it connects? Unless the |
To clarify, by when "it connects" do you mean when DevTools connects? I think that is possible, I think it's also possible that we are sending a Side note: If I remember correctly, the pause start state means that isolates are initially paused on start-up and also paused after any hot-restarts. |
Yes, I think it isn't getting connected until I either open the devtools web app or open the CPU profiler, so it is connecting once the isolate is already running, but doesn't recognize/handle that? |
Is there any known workaround for this issue (other than setting two breakpoints)? |
Not that I know of, I have just been setting multiple breakpoints. |
I ran into this running a Flutter app from VS Code, and re-reading the issue description here, it seems like this also is occurring when setting a breakpoint in VS Code, not DevTools. I suspect there has been a regression from when #7231 was completed. Writing down some notes before I forget on how to narrow this down:
|
Correct - you have to already be stopped at a breakpoint, and then connect with devtools, once devtools connects the app will resume (but it shouldn't). You probably could reproduce this with two devtools instances as well, by setting a breakpoint in one, then connecting with another to the same app. |
I haven't tried debugging, but searching the code I see that BreakpointManager has this flag to control whether it runs
And at the end of devtools/packages/devtools_app/lib/src/screens/debugger/breakpoint_manager.dart Lines 90 to 93 in 5252a88
Assuming this is the path that's triggering it, I wonder if that |
Raising the priority of this bug from P2 to P1. |
Assigning to myself so we don't have multiple folks working on this at once 😄
Yes, just did a little investigation and that is indeed where it's being called. Wrapping in a check to make sure we aren't paused at a breakpoint works (yay!). But I'm wondering if DevTools should even be trying to manage breakpoints in this environment... I was looking back at the meeting notes from last year, and I'm pretty sure we are in this situation (copy-pasted from notes):
I don't think we (or at least I) ever considered that DevTools would be sending resume requests if a user was debugging from their IDE, and hadn't attached/launched a separate DevTools instance. However, because the The only places it is being used are in the debugger panel (hidden when a user is in their IDE) and the VM developer tools panel. Potentially we should either not initialize it if DevTools embedded in IDE and the connected app is not a VM app, or move initialization out of I think for now @DanTup's suggestion (only resume here for |
When reproducing this issue, I'm not using DevTools embedded, I'm opening it in a browser from the IDE. I believe part of the goal of the Although, I will note that the idea of "only resuming if the pause event is x" is also somewhat racy, because it's not guaranteed that the isolate is still in that state when the resume is sent (ideally we would probably send a "resume this isolate if it is in pauseStart/pausePostRequest state", but whether in practice it's likely to happen and worth supporting that, I don't know). |
Repro instructions
Create any app, and set a breakpoint on the first line inside of main:
In VsCode, debug this app (click the
debug
tooltip above themain
function).It should stop at the breakpoint you set.
Click the button to open up the CPU profiler
The app will now advance past the breakpoint you set, and exit (unless you have more breakpoints set).
Expected behavior
I expect it to stay stopped at a breakpoint - I set it here in order to be able to resume it once I have connected the profiler and started recording frames.
The text was updated successfully, but these errors were encountered: