microsoft/debugpy

Troubles when expanding self object during debug in constructor

ibobak opened this issue · 4 comments

Type: Bug

Behaviour

When I am debugging a constructor of the object and in that debug session I am trying to expand "self" in the watch window, the python process crashes,

Steps to reproduce:

  1. install anaconda
  2. create a new environment
  3. pip install catboost
  4. create a new notebook, make a single cell with this code
from catboost import CatBoostRegressor, Pool
# Initialize data

train_data = [[1, 4, 5, 6],
              [4, 5, 6, 7],
              [30, 40, 50, 60]]

eval_data = [[2, 4, 6, 8],
             [1, 4, 50, 60]]

train_labels = [10, 20, 30]

p = Pool(data=train_data, label=train_labels)

# Initialize CatBoostRegressor
model = CatBoostRegressor(iterations=2,
                          learning_rate=1,
                          depth=2)
# Fit model
model.fit(train_data, train_labels)
# Get predictions
preds = model.predict(eval_data)

  1. Put a brakpoint on line
p = Pool(data=train_data, label=train_labels)
  1. "Go to definition" for Pool, you will be redirected to Pool class, inside this class put a breakpoint on the firtst line
with log_fixup(log_cout, log_cerr):
  1. Debug this cell.
  2. As soon as your debugging line is this "with log_fixup(log_cout, log_cerr)", open the "self" object
    image
    image

Diagnostic data

launch.json configuration

XXX

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

Output for Python Debugger in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python Debugger)

XXX

Extension version: 2024.6.0
VS Code version: Code 1.90.2 (5437499feb04f7a586f677b155b039bc2b3669eb, 2024-06-18T22:33:48.698Z)
OS version: Linux x64 6.4.6-060406-generic
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.9
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
System Info
Item Value
CPUs Intel(R) Xeon(R) CPU E5-2696 v4 @ 2.20GHz (88 x 2706)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
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: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 17, 21, 14
Memory (System) 251.76GB (41.57GB free)
Process Argv --crash-reporter-id 27d42247-63fb-4d9e-9cb0-87d9974843dc
Screen Reader no
VM 50%
DESKTOP_SESSION ubuntu-xorg
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu-xorg
XDG_SESSION_TYPE x11
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
jchc7451:31067544
chatpanelt:31048053
dsvsc021:30996838
9c06g630:31013171
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
2f103344:31071589
legacy_priority:31077528

Thanks for the issue. I can repro without a notebook too. Retrieving the value for cat_features is causing pydevd to crash.

Here's the logs from my crash:
debugpy.server-11776.zip

Rich, if you tell me how to get the logs, next time I will know how to do this and will attach them.

I'm actually not sure how to do it when jupyter debugging, but if you're using a launch.json (for a python file), it's a setting:

        {
            "name": "Python Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "logToFile": true, // This setting
            "justMyCode": false
        }

It writes the logs to where the python debugger extension is installed. In my case, that's here:

C:\Users\rchiodo.vscode\extensions\ms-python.debugpy-2024.7.11591013-win32-x64