microsoft / debugpy

An implementation of the Debug Adapter Protocol for Python
https://pypi.org/project/debugpy/
Other
1.82k stars 132 forks source link

Debugpy Server Disconnects Unexpectedly when Inspecting Variable #1338

Open Ekhao opened 1 year ago

Ekhao commented 1 year ago

Actual behavior

Inspecting a variable will show me the contents of that variable

Expected behavior

A short message "Server[1] disconnected unexpectedly" is shown, followed by the debug session crashing.

Steps to reproduce:

  1. Use the following code:
    
    import tensorflow as tf
    a = []
    for element in range(3):
    a.append(tf.random.uniform([60,144,80,1]))

c = 0


2. set a breakpoint at c = 0
3. Inspect the contents of a[0]

See below for log files captured during a crashed debugging session:
[debugger.vscode_2ab32481-8c72-4e77-a1a8-e763da6858ba.log](https://github.com/microsoft/debugpy/files/12195638/debugger.vscode_2ab32481-8c72-4e77-a1a8-e763da6858ba.log)
[debugpy.adapter-1716.log](https://github.com/microsoft/debugpy/files/12195640/debugpy.adapter-1716.log)
[debugpy.launcher-1719.log](https://github.com/microsoft/debugpy/files/12195641/debugpy.launcher-1719.log)
[debugpy.pydevd.1722.log](https://github.com/microsoft/debugpy/files/12195642/debugpy.pydevd.1722.log)
[debugpy.server-1722.log](https://github.com/microsoft/debugpy/files/12195643/debugpy.server-1722.log)
int19h commented 1 year ago

Exit code 245 is SIGSEGV, so it likely crashed somewhere in native code. Unfortunately, there isn't enough info in the logs to diagnose this - they just terminate abruptly while trying to evaluate a[0]. Do you know if there's anything unusual about that variable?

If there isn't anything obvious, we'll need a dump file to diagnose the crash.

NateAGeek commented 11 months ago

I am also receiving this issue. I do wonder if it has to do with Tensorflow data types, in this case an EagerTensor. As when I am doing debugging on a numpy array in the same debug context and was able to view it. Maybe since tensorflow does some autograph it is not mapping correctly or the debugger is crashing accessing some memory? I'm not too sure, but will see if I can pull more info on why this is crashing. Please do share any tips on where to find log files to maybe see where and why this crash is happening. I do feel like this debugger was working with TF before...

Update: Nope, I tried versions of this extension as back as far as a year, and it still was not working...

Ekhao commented 11 months ago

I apologize for not answering the first message - I must have missed it. As Nate mentions it likely has to do with the Tensorflow data types. I'll also be happy to provide more log files/dump files if you can provide me instructions for how to generate these!

StarGate01 commented 1 week ago

Has there been any progress on this? I am also experiencing this issue with tensorflow / numpy data variables.

rchiodo commented 4 days ago

No sorry, nobody is looking at this at the moment. It might need a dump of the CPython runtime to see where the crash is happening.