-
Notifications
You must be signed in to change notification settings - Fork 144
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
Improve dealing with blocking evaluate requests #157
Comments
I'll investigate to see what could be causing that... |
I just checked with |
I've just tested using the insiders version with the experiments enabled (and verified that it's using new_ptvsd) with debug current file, as well as manually running ptvsd (
(@fabioz I don't seem to have permission to reopen) |
Can you provide the logs for the run? i.e.:
|
From attaching to an existing ptvsd process: From running using current file (I presume it's these ones that you want): |
Thanks for the logs... I was able to reproduce it with that info (although I still don't know the reason). I'll investigate. |
Ok, I did the investigation here... what happens is that So, when you do In the case where Also, because the current policy is to always stop or run all the threads, you can't selectively run just that thread. The current workarounds are using To ask the debugger to never trace that thread, change For an actual fix, I think we'd need to run/stop threads independently... right now, we stop/resume all threads by design because it's the only option supported by Visual Studio, but I believe Visual Studio Code itself does support running/stopping threads independently (as does the debugger), so, maybe we could create an option for users to choose the policy here (it does need some investigation though and it's probably not a simple fix). @karthiknadig @int19h what do you think? |
@fabioz is |
@karthiknadig I don't think we can differentiate well the threads for As for the setting, I didn't really understand the difference from Note that supporting that combination may not be all that troublesome as the code is independent from one another (although it probably doesn't make much sense to control threads independently and have step resume all threads). |
Well, the first thing I think is defining whether we should support @int19h @karthiknadig waiting on feedback here. |
As I recall, we originally decided to use the all-threads-paused model for VSC not just because it's what VS was doing, but also because it was felt to be more intuitive for the users. I think we should make a similar decision on behavior here first. There are obvious downsides to not letting threads run, as this bug shows; but there are also downsides to letting them run, especially if this means hitting breakpoints etc. For what it's worth, in VS, other threads do not run, but it also has a timeout, which brings you to this help page: Also, apparently the docs might not even be up to date, because trying this on VS 2019, I get this error once it times out: So it looks like it's setup up to not resume threads by default, but if evaluation times out, then it assumes there's a deadlock, and resumes them. Perhaps we can do something similar? |
I'll start to work on this issue. My current idea for the fix will be doing the following:
As a note, I think that for the first one we can have something like a 10s. timeout (which the user could configure to be lower/higher/disabled) and the second should not be active by default since it's possible that the evaluation is really expected to be a long running operation (right now I'll only enable those to be set only through environment variables -- we can make a setting for that later if needed). After that's done for the evaluation we should probably do something similar for the use case where just getting a representation of some object takes a really long time (which is probably the culprit in #274). @int19h @karthiknadig I'll start to work on that approach, but I'm open to feedback if you think something should be different here. |
Sounds good! For the notification, we can always add a custom message and wire it up on VSCode side - indeed, we already discussed such a thing for #170. Then it could be an async message that does not block or otherwise interrupt the evaluation - merely notifies the user that it's still ongoing. Also, DAP has added "progress" events not long ago - take a look at |
To clarify: 1s is probably too low to try resuming other threads - 10s sounds more reasonable (we can experiment and figure out what works best). But 1s would be a better threshold for a low-key notification that evaluation is taking a long time. |
As a note, I'm still working on this issue. I've just finished the part related to unblocking threads, which required dealing with asynchronous messages (both on pydevd as on debugpy), but there are things still missing:
|
Environment data
Actual behavior
When justMyCode is set to false, operations on a spark dataframe that has been constructed in python using
session.createDataFrame
will hang if run in the debugger repl, but not if run normally. Spark appears to hang, printing[Stage 0:> (0 + 1) / 1]
.Expected behavior
The code should not hang, or it should not matter what the state of justMyCode is.
Steps to reproduce:
With pyspark installed (I have the latest spark 3.0 preview build), I can reproduce it by trying to debug the following script with
"justMyCode": false
in launch.json.In ptvsd 4.2.10, it also hangs if you step over the
df.show()
line, but that was fixed by moving to 4.3.2. I guess that is because of microsoft/ptvsd#1372, although I haven't verified that.The text was updated successfully, but these errors were encountered: