-
Notifications
You must be signed in to change notification settings - Fork 323
Breakpoints disappear #4598
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
Comments
I can't reproduce this (although I see an issue with them becoming unverified - I've opened #4599 to look at this). Can you test it on a newly created app so I can be sure I'm performing the same steps, and could you also capture a log:
Thanks! |
Do you need a new app AND logs? Or I can just collect logs in my project and send you? |
A new app is best, because it confirms it can be reproduced in the code I'm testing with (I often spend time trying to repro things that seem like they should always happen, but are actually triggered by some specific things). Logs are always useful though. If it happens in a new project, just those logs are fine. If it doesn't happen there, logs for your project may help. |
I was not able to repro it on a new project, but here is the log from the one I have the problem in: Dart-Code-Log-2023-05-00 16-07-29.txt Does it help? |
I was able to reproduce on a new app : |
@incendial thanks - looking through your log I see something wrong - we seem to resolve two breakpoints using the same ID, and I think that could be "merging" them in VS Code (we don't actually have any code that ever removes breakpoints):
However, it's not clear to me why this happened because the VM Service traffic was not logged and I'm not sure what the source file looked liked. Are you able to capture a log while also recording what you see, and ensure you start logging before you start the debug session, so that the VM Service traffic is also logged? @woprandi I checked your log, but I only see a single breakpoint being set - it's not clear to me what you're seeing. Can you provide details of what you did/saw, and if possible also a recording of what you're seeing with a matching log. Thanks! |
Ah, I started the recording after pressing the debug button. Sure, I'll send you a full version soon. |
@DanTup Sorry it's a bad analysis. I didn't reproduce on new app. |
@woprandi np! Are you seeing this too, in a different project? A log file of it happening (that was started before the debug session, so that logging of VM Service traffic is enabled) would be very useful even if not on a new project. A recording of the behaviour (or at least a clear description of what happens), and a copy of the lines around where breakpoints are added/disappear would also definitely help. If you can think of anything different in your project that might explain the difference with a new project, that might help too. For example, are there unsaved files? Or modified and saved files? Have you hot-reloaded before this happens? Are you using any sort of codegen that may have run since the session started? Do you have multiple isolates (and if so, could they have loaded different versions of the same packages?). Thanks! |
@DanTup send you an email |
@DanTup I'm not sure I had this bug. Also a bad analysis and a wrong code. Or it's fixed now. Anyway I can't help you anymore. I'll monitor that and back here if it comes (back) |
@woprandi gotcha, np! @incendial got them, thanks - I'll see what I can find. For future me, this was helpful to reduce the log to just breakpoint lines:
|
Yeah, I was not sure what exactly you need, so send the full log. But there is a lot of data 😅. |
@incendial out of interest, does this only happen if you click fairly quickly? I see some overlapped requests in the logs which make it difficult to follow. I'm wondering if that's related or not. If you can repro with a longer pause between each, that log file would be much easier to understand (and if it doesn't, it might confirm it's timing related). |
Feels like it's not related to the speed. Screen.Recording.2023-06-26.at.19.28.39.mov |
Any chance you can capture a log going slowly like that (with a matching video so I can see the behaviour)? Thanks! :) |
Are you trying to make it even more entertaining for me? 😂 But on a serious note, sure, but probably later. |
heh, sorry - what I see in the logs doesn't make a lot of sense so I'm trying to eliminate some variables :-) I do see you have two isolates though, and we're adding these breakpoints twice (once to each isolate). It seems like the VM is then giving us back different lines. Is there any possibility you have two versions of this code running in different isolates? |
If it's nothing you're doing deliberately, then it's possible |
Oh btw, in your most recent video here, it's possible the lines you're adding breakpoints to are not valid targets (since they don't have any executable code, they're just arguments). So perhaps this is working correctly there (they're resolving to the closest valid breakpoint target), although it seems like their update is delayed until the next breakpoint change (which doesn't seem right). I'll do some testing of that, but I don't know if it's the same thing the original video showed. |
@incendial I can repro what's shown in your last videos (and it's definitely not just delayed updates), so no need to try to capture additional logs for now. Thanks for the help though :-) |
Happy to hear that! So, is it just invalid lines or something worse? |
@incendial I think it's restricted to lines where you can't stop. I created a simple test with That breakpoint seemed to jump between 18 and 35 during the next breakpoint operations. Here's an annotated log:
I think an easy fix is that we just always ignore breakpoint events that are unresolved. We never want to move a resolved breakpoint back to its unresolved location just because we didn't know which isolates it was valid for. I'll try this out shortly and post back. |
This feels scary in case there are some problems with them marked unresolved unintentionally. I'm actually wondering why there are two isolates and why they both participate... |
To clarify: the thing I repro'd and your most recent video I think this is the case. I'm less sure about the very top video here though. |
Not sure I understand. Breakpoints can never be unresolved once resolved. It just happens that we get the events for each isolate, and because we blindly read the "verified" flag from the VM, we pass it on to VS and essentially instruct it to go back to the unresolved state. It's always possible we'll add the breakpoint to isolates that won't resolve it so we need to handle that.
I'm pretty sure one of them is |
I'm not sure about that "only invalid lines" thing 🙂. Screen.Recording.2023-06-26.at.20.24.12.mov |
Yeah, see #4598 (comment) I think it explains what I can repro but I'm less sure it's the whole issue. If you can get a log+video of that (with pauses between each action), that would be appreciated :-) |
Ah, then it makes sense. I thought that (due to the current behaviour in VS Code) they can get back to unresolved.
Okay, but why they both participate? Shouldn't it be only one isolate (the main, controlling)? |
To be more specific - a breakpoint set in an isolate in the VM cannot be unresolved. However when you modify breakpoints, VS Code just gives us a whole new set (it doesn't tell us about added/removed breakpoints), so we remove and re-add them. So in that respect, they may become unresolved as far as VS Code is concerned (because they're actually new breakpoints that need to be resolved).
The UI in VS Code doesn't let you set breakpoints per-thread, so when it tells us to set breakpoints, we have to send them to all isolates. While some isolates might have not loaded your script, it's possible they will load it in future, so we still need to send them the breakpoint. |
…lates When there are multiple isolates, we may get breakpoint responses/events like this: - Request/Response to add breakpoint to Isolate 1 - Request/Response to add breakpoint to Isolate 2 - BreakpointAdded for Isolate 1 - BreakpointResolved for Isolate 1 - BreakpointAdded for Isolate 2 Because Isolate 2 did not load the script, the last breakpoint was never resolved. However because the breakpoint ID matched, we would forward this event to the client and un-resolve the previously resolved breakpoint. This would result in odd behaviour in VS Code. Additionally, the VM may return the same BM breakpoint ID for what the client thinks are two breakpoints (they are on different lines, but resolve to the same location) so when we get a resolved breakpoint, we need to handle both: - Client breakpoints that have already been transmitted - Future client breakpoints that may resolve to this same VM breakpoint The previous code assumed that a BreakpointResolved event could be handled just once. Either for an existing breakpoint, or a future one. This change swaps from storing queued events to storing the resolution information for each breakpoint, and it does this even if there was an existing breakpoint (in case the breakpoint is reused in future). Fixes at least some of Dart-Code/Dart-Code#4598 Change-Id: I53b92debfaa0c8f538dc8d67966854bb89634708 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311480 Reviewed-by: Ben Konyi <bkonyi@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
dart-lang/sdk@4d1b418 just landed which fixes at least some of the issues above (races from multiple isolates). I don't see why this would fix any issues with breakpoints on valid lines, but it would be useful to test whether you can still repro issues with an SDK that includes this (and if so, get a fresh log using this version, setting them slowly, and including only valid lines). The current builds are dated around an hour ago, so I suspect around an hour from know you could get a bleeding-edge build using the URLs here: https://dart.dev/get-dart/archive#main-channel-url-scheme I think this is the same directory, but has directory listing enabled so you can see the timestamps: https://gsdview.appspot.com/dart-archive/channels/be/raw/latest/sdk/ I wouldn't recommend generally developing with a bleeding-edge build, but it's useful for verifying fixes like this. |
@DanTup sorry, but can you remind me what do you need from me?
To test this or there is something else? |
@incendial I wanted to know if you can still reproduce this issue with an SDK that includes the change above. If so, I'd be interested in a log/video. I was never able to reproduce them them disappearing on "valid" lines, only when they resolved to the same location. |
This issue has been marked stale because it is tagged awaiting-info for 20 days with no activity. Remove the stale label or comment to prevent the issue being closed in 10 days. |
@incendial are you able to reproduce this at all using a bleeding-edge/master SDK? |
Which Dart version includes this fix? I have Flutter master with dart |
That version includes the change above (as long as you're running a Dart project, not Flutter, and using the new SDK debug adapters). Are you able to capture a log file of this happening (and ideally a video from the same repro as the log file)? The only issue I was able to reproduce above was the one that change fixed. Thanks! |
Sorry, I downgraded back to beta channel (as my usual env), will do in the upcoming days |
Upgraded to the master channel again (now it's Dart 3.2.0-41.0.dev) and can't reproduce the issue. Although, breakpoints blink a bit annoyingly Screen.Recording.2023-08-07.at.21.48.30.mov |
Thanks for testing! I think the blinking is because when you add/remove a breakpoint, VS Code doesn't tell us about the individual change, it just sends us a whole new set and says "replace all the breakpoints with these" so we end up deleting all the old ones and adding the new ones. It's possible now that we're able to provide IDs for them that it'll send our IDs back that would make it easier to figure out which ones are added/deleted. I've filed #4678 to have a look at this. I'll close this one as it seems like the issue was solved (probably by changes for #4599 - they probably were related). Thanks! |
@DanTup I am experiencing behavior very similarly to this still. Let me know if I can help in any other way. This problem is very intermittent for me. Reloading VS Code fixes it for a while usually. Here is a video recorder - I am trying to set a break point on line 35 - every time I click, it does something weird with my breakpoints. Screen.Recording.2024-04-02.at.1.02.06.PM.movHere is the log that I tried to get: |
@jackmchristie sorry for the delay, I just found the notification for this. Are you able to make a small sample that reproduces this issue and share it in a new issue? I had a quick try but couldn't reproduce it. Can you also include details of your Dart extension version and your Flutter SDK version? Thanks! |
Describe the bug
Adding breakpoints causes some of the existing breakpoints to disappear.
I mean, I like arcades, but this feels too much 😂.
Screen.Recording.2023-06-20.at.20.20.27.mov
To Reproduce
Steps to reproduce the behavior:
Please complete the following information:
The text was updated successfully, but these errors were encountered: