-
Notifications
You must be signed in to change notification settings - Fork 133
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
Debugger starts to paginate memory when getting the representation of big byte arrays #242
Comments
Which variables would you expect to see at this point? We don't show variables that are unassigned, which is going to be all of the locals (except for the function arguments) if you set a breakpoint on the first line of the function. As you step through the lines, you should be seeing variables show up as they get assigned. |
Shouldn’t foo be visible? Away from computer but thought I stepped over the f=foo assignment and had same issue.
…On May 13, 2020, 2:19 PM -0400, Pavel Minaev ***@***.***>, wrote:
Which variables would you expect to see at this point? We don't show variables that are unassigned, which is going to be all of the locals (except for the function arguments) if you set a breakpoint on the first line of the function. As you step through the lines, you should be seeing variables show up as they get assigned.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Given that |
You're right though, it should be showing up under "Globals". I can't get a trivial repro, though; e.g. this code does work for me, showing z = 123
def foo():
def bar():
x = 1 # breakpoint here
yield x
y = z
yield y
return list(bar())
foo() The fact that it also doesn't show in Watch might be a clue, though. Normally we just send the whole thing over to Python for evaluation, and if it fails, print the error message from the exception. But "not available" is something else - I've only seen it before when there's no active debug session. |
@fabioz Extension version 2020.5.78807 ships debugpy 1.0.0b9, so this should be working. |
In that case, @jelling, can you provide the logs for the run? i.e.:
|
Just in case, can you also do |
Debug logs: |
@fabioz Note the Call Stack pane - the generator is being iterated on a background thread, and it's the first user code frame on that thread (or possibly even the first Python code frame). Perhaps this has something to do with it? |
I think I see part of the problem. When it breaks, the first thing that VSCode does is evaluate @jelling, what is the type of |
Python debug version looks correct:
And f/foo is
|
We use |
@int19h It's a 5 minute video file so yeah that is likely it. |
@jelling, can you provide the I thought we already handled such cases, but maybe we don't deal well enough in really extreme cases. |
Here it is:
|
It seems that's really the issue (I was able to reproduce it here). -- I think that when you're converting that 20GB byte array in your machine it's getting slow due to the amount of RAM required -- in my machine, with 32GB of RAM doing a repr on a 10GB byte array worked in 40 seconds but with the 20GB array I had to stop it when the OS started to paginate. So, we need better support in the debugger when really big byte arrays are in memory (I think we usually don't get there because usually users would be using numpy arrays for such extreme use cases, but we should definitely support this use case too). I'll take a look at it. |
We have some logic to avoid |
@fabioz Ah, I think I see the problem - we don't actually avoid |
Yeap... I'm checking it (or would you like to take a look at that since that code was inherited from ptvsd?) As for dealing with raw values, I'm not sure the best way to proceed. I definitely don't want to send a 20GB string over the wire nor even decode the bytes even at that case (the server would probably just halt anyways... we may have bigger limits for when raw is requested, but I think we should have some higher limit even in that case -- maybe something like 100MB -- what do you think @int19h ?). |
If you're already looking into this, go ahead. I just took a quick peek at the code. There's some functionality in DAP around memory references that we never tapped into, that might perhaps be relevant here - it essentially provides random access to the client without ever retrieving the complete value. I don't know how this actually looks in UI in VSCode, or whether VS supports it, but we should check. If this is wired up in VS, maybe we can stop reporting them as raw values altogether? If not, then I guess we'll have to limit. |
Note: I'm still working on this (I'm dealing with some corner cases on encodings on python 2 with the different approach -- I think I got it properly already, but I'm still in the process of updating related tests). |
Environment data
"python.jediEnabled"
set to; more info How to update the language server to the latest stable version vscode-python#3977): jedipython.languageServer
setting: MicrosoftExpected behaviour
Show the local variables in debug
Actual behaviour
I can attach to a Flask web server - meaning that it stops on the line - but no local variables are displayed.
Steps to reproduce:
Launch debugger with either one of the below configs; neither works.
The text was updated successfully, but these errors were encountered: