Hangs property inspection of an object #1730
Replies: 1 comment
-
Thanks for the issue. I don't think debugpy would be able to implement this though. We currently use exec to run evaluation. That's how we get the variable properties of Exec also has to run in the same frame that the debugger is stopped at (so that it gets all the necessary information in order to evaluate the expression). Meaning this thread can't be torn down. It's the actual thread in your application - one solution might be to just kill the thread after a timeout. I'll move this to a discussion. Maybe somebody else has a different suggestion on how to implement this. There's a possible alternative. You make things that take too long be async. Then when we eval them we don't actually evaluate the result, we just return the coroutine. Something like this: import asyncio
class A:
@property
async def long_timeout_value(self):
# This property represents the case where it has a long waiting time to get something.
# As an example: WebDriver element evaluation, API call (to super slow system) and any other long operation
await asyncio.sleep(1)
return 10
a = A()
x = asyncio.run(a.long_timeout_value)
print('Set a brakepoint here') But that doesn't really meet the need to not have debugging break if some property happens to take a long time. You'd have to know ahead of time. |
Beta Was this translation helpful? Give feedback.
-
Type: Bug
Behaviour
A variable inspection hangs if the variable has a property that has long time execution.
Steps to reproduce:
a
variable of an object ofclass A
Expected result
After some time, for example 30 seconds (or a setting from the configuration file), if the
a
value could not be inspected then show an error and stop trying to inspect it.Actual result
There is an infinite attempt to inspect the value of
a
. This may block further debugging.Diagnostic data
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Extension version: 2024.18.1
VS Code version: Code 1.95.2 (e8653663e8840adaf45af01eab5c627a5af81807, 2024-11-07T11:07:22.054Z)
OS version: Windows_NT x64 10.0.19045
Modes:
python.languageServer
setting: DefaultUser Settings
Installed Extensions
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
A/B Experiments
Beta Was this translation helpful? Give feedback.
All reactions