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

"Debug adapter process has terminated unexpectedly" when doing remote debug with ptvsd #981

Closed
Dlizzz opened this Issue May 24, 2017 · 39 comments

Comments

Projects
None yet
@Dlizzz

Dlizzz commented May 24, 2017

Environment data

VS Code version: 1.12.2 on Windows
Python Extension version: 0.6.4 on Windows
Python Version: 3.6.1 (64bits) on Windows - 3.5.3 on Ubuntu
OS and version: Client on Windows 10 Professional 1703 - Server on Ubuntu Zesty 17.04
tpvsd version: 3.1.0 on Ubuntu

Actual behavior

The server side (Ubuntu) script runs and wait for the debugger on port 3000 (see netstat --tcp --listening output)
image
When the debug configuration is launched, the client side (Windows) never connects and the only message we get is "Debug adapter process has terminated unexpectedly".

Expected behavior

The client side (Windows) should connect to the server side to start debugging or we should get a log explaining why the connection failed.

Steps to reproduce:

  • Execute the following string on Ubuntu machine (same LAN):
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import ptvsd

def main():
    print("Connected!")
    
if __name__ == "__main__":
    ptvsd.enable_attach("python-debug", address=("0.0.0.0", 3000))
    ptvsd.wait_for_attach()
    main()
  • Launch the "Attach" debugger configuration from VSCode on Windows
  • Got the following message (in french), without any log at all
    image

Settings

launch.json:

{
     "name": "Attach (Remote Debug)",
     "type": "python",
     "request": "attach",
     "localRoot": "${workspaceRoot}",
     "remoteRoot": "/home/.../dupbackup",  (obfuscated)
     "port": 3000,
     "secret": "python-xxx", (obfuscated)
    "host": "10.10.x.xx" (obfuscated)
}

settings.json:

{
    "workbench.iconTheme": "vscode-icons",
    "editor.tabSize": 2,
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\cmd.exe",
    "window.menuBarVisibility": "default"
}

Logs

Output from Python output panel

Nothing!

Output from Console window (Help->Developer Tools menu)

Uncaught Error: TypeError: Cannot read property 'Threads' of undefined
    at PythonDebugger.threadsRequest (C:\Users\denis\.vscode\extensions\donjayamanne.python-0.6.4\out\client\debugger\Main.js:340:27)
    at PythonDebugger.DebugSession.dispatchRequest (C:\Users\denis\.vscode\extensions\donjayamanne.python-0.6.4\node_modules\vscode-debugadapter\lib\debugSession.js:427:22)
    at PythonDebugger.ProtocolServer._handleData (C:\Users\denis\.vscode\extensions\donjayamanne.python-0.6.4\node_modules\vscode-debugadapter\lib\protocol.js:104:38)
    at Socket.<anonymous> (C:\Users\denis\.vscode\extensions\donjayamanne.python-0.6.4\node_modules\vscode-debugadapter\lib\protocol.js:24:60)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:551:20)
    at PythonDebugger.threadsRequest (C:\Users\denis\.vscode\extensions\donjayamanne.python-0.6.4\out\client\debugger\Main.js:340:27)
    at PythonDebugger.DebugSession.dispatchRequest (C:\Users\denis\.vscode\extensions\donjayamanne.python-0.6.4\node_modules\vscode-debugadapter\lib\debugSession.js:427:22)
    at PythonDebugger.ProtocolServer._handleData (C:\Users\denis\.vscode\extensions\donjayamanne.python-0.6.4\node_modules\vscode-debugadapter\lib\protocol.js:104:38)
    at Socket.<anonymous> (C:\Users\denis\.vscode\extensions\donjayamanne.python-0.6.4\node_modules\vscode-debugadapter\lib\protocol.js:24:60)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:551:20)
    at file:///D:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:2217019
    at Object.v [as _notify] (file:///D:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:68880)
    at Object.enter (file:///D:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:72381)
    at n.Class.derive._oncancel._run (file:///D:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:73702)
    at n.Class.derive._oncancel._error (file:///D:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:73219)
    at file:///D:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:1952869
    at g.e.dispatch (file:///D:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:1954220)
    at g.e.handleData (file:///D:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:1953728)
    at Socket.<anonymous> (file:///D:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:1952729)
    at emitOne (events.js:96:13)
@krash84

This comment has been minimized.

Show comment
Hide comment
@krash84

krash84 commented May 30, 2017

+1

@mikemcgowan

This comment has been minimized.

Show comment
Hide comment
@mikemcgowan

mikemcgowan May 30, 2017

I am also experiencing this issue, while trying to follow this blog post from a month ago, so it probably got broken relatively recently. Same version of VSCode 1.12.2 and the Python plugin 0.6.4 as above.

mikemcgowan commented May 30, 2017

I am also experiencing this issue, while trying to follow this blog post from a month ago, so it probably got broken relatively recently. Same version of VSCode 1.12.2 and the Python plugin 0.6.4 as above.

@slaadvak

This comment has been minimized.

Show comment
Hide comment
@slaadvak

slaadvak commented Jun 6, 2017

+1

@ndlygaSyr

This comment has been minimized.

Show comment
Hide comment
@ndlygaSyr

ndlygaSyr Jun 6, 2017

+1 Suddenly stopped working after updating VSCode, tried rolling back to version 0.6.2 and 0.6.1 with same results.

ndlygaSyr commented Jun 6, 2017

+1 Suddenly stopped working after updating VSCode, tried rolling back to version 0.6.2 and 0.6.1 with same results.

@stid

This comment has been minimized.

Show comment
Hide comment
@stid

stid Jun 8, 2017

+1
Same as above but under OSX - Suddenly stopped working after updating VSCode or (hard to tell) python component itself.

  • VSCode Version: Code 1.12.2 (19222cdc84ce72202478ba1cec5cb557b71163de, 2017-05-10T13:13:11.413Z)
  • OS Version: Darwin x64 16.6.0
    Python extension: 0.6.4 (4 May 2017)
    pvsd version: 3.1.0

Server run on docker FROM python:2.7.12

No logs in the console, first tentative fail with "Debug adapter process has terminated unexpectedly", subsequent tentatives produce no effects until VSCode restart.

stid commented Jun 8, 2017

+1
Same as above but under OSX - Suddenly stopped working after updating VSCode or (hard to tell) python component itself.

  • VSCode Version: Code 1.12.2 (19222cdc84ce72202478ba1cec5cb557b71163de, 2017-05-10T13:13:11.413Z)
  • OS Version: Darwin x64 16.6.0
    Python extension: 0.6.4 (4 May 2017)
    pvsd version: 3.1.0

Server run on docker FROM python:2.7.12

No logs in the console, first tentative fail with "Debug adapter process has terminated unexpectedly", subsequent tentatives produce no effects until VSCode restart.

@joenot443

This comment has been minimized.

Show comment
Hide comment
@joenot443

joenot443 Jun 8, 2017

Same problem as the OP with a similar error log (Uncaught Error: TypeError: Cannot read property 'Threads' of undefined).

OS X 10.12.5
VS Code 1.13.0

Hoping we hear from @DonJayamanne soon about this! :)

joenot443 commented Jun 8, 2017

Same problem as the OP with a similar error log (Uncaught Error: TypeError: Cannot read property 'Threads' of undefined).

OS X 10.12.5
VS Code 1.13.0

Hoping we hear from @DonJayamanne soon about this! :)

@Dlizzz

This comment has been minimized.

Show comment
Hide comment
@Dlizzz

Dlizzz Jun 9, 2017

Tested today with VSCode 1.13.0 on Windows. No change. Same behavior.

Dlizzz commented Jun 9, 2017

Tested today with VSCode 1.13.0 on Windows. No change. Same behavior.

@synthecypher

This comment has been minimized.

Show comment
Hide comment
@synthecypher

synthecypher Jun 12, 2017

Got the same issue. :(

macOS Sierra - 10.12.5
VSCode - 1.13.0
ptvsd - 3.1.0
Python - 2.7.13

synthecypher commented Jun 12, 2017

Got the same issue. :(

macOS Sierra - 10.12.5
VSCode - 1.13.0
ptvsd - 3.1.0
Python - 2.7.13

@sjschubert

This comment has been minimized.

Show comment
Hide comment
@sjschubert

sjschubert Jun 13, 2017

Also encountered this issue today:

OS X: 10.12.5
VS Code: 1.13.0 (376c52b955428d205459bea6619fc161fc8faacf)
VS Code Extension: 0.6.4
ptvsd: 3.1.0
Python: 3.6.1

Same error as previous posters from the dev tools console:

Uncaught Error: TypeError: Cannot read property 'Threads' of undefined

sjschubert commented Jun 13, 2017

Also encountered this issue today:

OS X: 10.12.5
VS Code: 1.13.0 (376c52b955428d205459bea6619fc161fc8faacf)
VS Code Extension: 0.6.4
ptvsd: 3.1.0
Python: 3.6.1

Same error as previous posters from the dev tools console:

Uncaught Error: TypeError: Cannot read property 'Threads' of undefined

@DonJayamanne

This comment has been minimized.

Show comment
Hide comment
@DonJayamanne

DonJayamanne Jun 13, 2017

Owner

Please try using ptvsd 3.0.0 (temporary solution)

Owner

DonJayamanne commented Jun 13, 2017

Please try using ptvsd 3.0.0 (temporary solution)

@ndlygaSyr

This comment has been minimized.

Show comment
Hide comment
@ndlygaSyr

ndlygaSyr Jun 13, 2017

Confirmed working with version 3.0.0.
Win 10
VS Code: 1.13
VS Code Ext: 0.6.5
ptvsd: 3.0.0
Python: 3.6.1

ndlygaSyr commented Jun 13, 2017

Confirmed working with version 3.0.0.
Win 10
VS Code: 1.13
VS Code Ext: 0.6.5
ptvsd: 3.0.0
Python: 3.6.1

@sjschubert

This comment has been minimized.

Show comment
Hide comment
@sjschubert

sjschubert Jun 13, 2017

I can confirm this works in for:

OS X: 10.12.5
VS Code: 1.13.0 (376c52b955428d205459bea6619fc161fc8faacf)
VS Code Extension: 0.6.4
ptvsd: 3.1.0
Python: 3.6.1

Additionally, I spent some time trying to dig into the stack trace to see if I could help out, which pointed to Main.ts (in the debugger directory). After looking over the code, it seemed like the PythonProcess instance in was somehow being set to null, but line numbers didn't correspond in the source code with the stack trace. I just assumed this was an artifact of transpilation - have never used type script or written any extensions for VS code, so I was fumbling around a bit.

At any rate, I followed the instructions detailed at the end of contributions. I cloned the repo, and started up the extension along with a debugger server. I then tried to repeat the process of connecting to my remote python interpreter using the 'extension host' process, but could not stop at breakpoints.

Given the temporary solution was to downgrade ptvsd, seems like the issue is upstream in ptvsd - not sure if this is actually an issue in the extension...

@DonJayamanne Thanks for posting a workaround. If there is anything I can do to help, let me know.

sjschubert commented Jun 13, 2017

I can confirm this works in for:

OS X: 10.12.5
VS Code: 1.13.0 (376c52b955428d205459bea6619fc161fc8faacf)
VS Code Extension: 0.6.4
ptvsd: 3.1.0
Python: 3.6.1

Additionally, I spent some time trying to dig into the stack trace to see if I could help out, which pointed to Main.ts (in the debugger directory). After looking over the code, it seemed like the PythonProcess instance in was somehow being set to null, but line numbers didn't correspond in the source code with the stack trace. I just assumed this was an artifact of transpilation - have never used type script or written any extensions for VS code, so I was fumbling around a bit.

At any rate, I followed the instructions detailed at the end of contributions. I cloned the repo, and started up the extension along with a debugger server. I then tried to repeat the process of connecting to my remote python interpreter using the 'extension host' process, but could not stop at breakpoints.

Given the temporary solution was to downgrade ptvsd, seems like the issue is upstream in ptvsd - not sure if this is actually an issue in the extension...

@DonJayamanne Thanks for posting a workaround. If there is anything I can do to help, let me know.

@mikemcgowan

This comment has been minimized.

Show comment
Hide comment
@mikemcgowan

mikemcgowan Jun 14, 2017

As suggested above, ptvsd==3.0.0 workaround confirmed working for:

  • Ubuntu Gnome 16.04
  • VSCode 1.13.0
  • Python VSCode extension 0.6.5
  • Python 3.4.6

Thank you for the workaround!

mikemcgowan commented Jun 14, 2017

As suggested above, ptvsd==3.0.0 workaround confirmed working for:

  • Ubuntu Gnome 16.04
  • VSCode 1.13.0
  • Python VSCode extension 0.6.5
  • Python 3.4.6

Thank you for the workaround!

@joenot443

This comment has been minimized.

Show comment
Hide comment
@joenot443

joenot443 Jun 14, 2017

Sadly, I'm currently getting a different error now, despite using ptvsd==3.0.0

Debug adapter process has terminated unexpectedly
e.doShow @ /Applications/Visual Studio Code.app/.../workbench.main.js:28
e.show @ /Applications/Visual Studio Code.app/.../workbench.main.js:28
g.onServerExit @ /Applications/Visual Studio Code.app/.../workbench.main.js:28
(anonymous) @ /Applications/Visual Studio Code.app/.../workbench.main.js:28
emitTwo @ events.js:111
emit @ events.js:191
__dirname.ChildProcess._handle.onexit @ internal/child_process.js:215

This occurs both using a secret and without one. I believe this is very similar to the problem outlined in #626.

OS X 10.12.5
VS Code 1.13.0
ptvsd 3.0.0
Python VSCode extension 0.6.5

joenot443 commented Jun 14, 2017

Sadly, I'm currently getting a different error now, despite using ptvsd==3.0.0

Debug adapter process has terminated unexpectedly
e.doShow @ /Applications/Visual Studio Code.app/.../workbench.main.js:28
e.show @ /Applications/Visual Studio Code.app/.../workbench.main.js:28
g.onServerExit @ /Applications/Visual Studio Code.app/.../workbench.main.js:28
(anonymous) @ /Applications/Visual Studio Code.app/.../workbench.main.js:28
emitTwo @ events.js:111
emit @ events.js:191
__dirname.ChildProcess._handle.onexit @ internal/child_process.js:215

This occurs both using a secret and without one. I believe this is very similar to the problem outlined in #626.

OS X 10.12.5
VS Code 1.13.0
ptvsd 3.0.0
Python VSCode extension 0.6.5

@cashlalala

This comment has been minimized.

Show comment
Hide comment
@cashlalala

cashlalala commented Jun 15, 2017

+1

@Dlizzz

This comment has been minimized.

Show comment
Hide comment
@Dlizzz

Dlizzz Jun 17, 2017

I do confirm that with "ptvsd==3.0.0" remote debugging is working.

VS Code version: 1.13.1 on Windows
Python Extension version: 0.6.5 on Windows
tpvsd version: 3.0.0 on Ubuntu
OS and version: Client on Windows 10 Professional 1703 - Server on Ubuntu Zesty 17.04

Dlizzz commented Jun 17, 2017

I do confirm that with "ptvsd==3.0.0" remote debugging is working.

VS Code version: 1.13.1 on Windows
Python Extension version: 0.6.5 on Windows
tpvsd version: 3.0.0 on Ubuntu
OS and version: Client on Windows 10 Professional 1703 - Server on Ubuntu Zesty 17.04

@DonJayamanne

This comment has been minimized.

Show comment
Hide comment
@DonJayamanne
Owner

DonJayamanne commented Jun 17, 2017

Moved to #1018

@AwayQu

This comment has been minimized.

Show comment
Hide comment
@AwayQu

AwayQu Jun 19, 2017

I still got 'Debug adapter process has terminated unexpectedly' with ptvsd==3.0.0.

VS Code version: 1.13.1 on Mac
Python Extension version: 0.6.5 on Mac
ptvsd version:3.0.0 on Mac
OS version: OS X 10.12.5
Python version: 3.5.2

AwayQu commented Jun 19, 2017

I still got 'Debug adapter process has terminated unexpectedly' with ptvsd==3.0.0.

VS Code version: 1.13.1 on Mac
Python Extension version: 0.6.5 on Mac
ptvsd version:3.0.0 on Mac
OS version: OS X 10.12.5
Python version: 3.5.2

@mickeyperlstein

This comment has been minimized.

Show comment
Hide comment
@mickeyperlstein

mickeyperlstein Jul 9, 2017

messageService.ts:125 Debug adapter process has terminated unexpectedly
e.doShow @ messageService.ts:125
e.show @ messageService.ts:104
g.onServerExit @ rawDebugSession.ts:517
(anonymous) @ rawDebugSession.ts:431
emitTwo @ events.js:111
emit @ events.js:191
__dirname.ChildProcess._handle.onexit @ internal/child_process.js:215

Using ptvsd ver 3.10.10

  • Fails using VSCode
  • Works using Visual Studio Community 2017

I will use vs as a workaround for now, but am looking foreword to your fix

mickeyperlstein commented Jul 9, 2017

messageService.ts:125 Debug adapter process has terminated unexpectedly
e.doShow @ messageService.ts:125
e.show @ messageService.ts:104
g.onServerExit @ rawDebugSession.ts:517
(anonymous) @ rawDebugSession.ts:431
emitTwo @ events.js:111
emit @ events.js:191
__dirname.ChildProcess._handle.onexit @ internal/child_process.js:215

Using ptvsd ver 3.10.10

  • Fails using VSCode
  • Works using Visual Studio Community 2017

I will use vs as a workaround for now, but am looking foreword to your fix

@DonJayamanne

This comment has been minimized.

Show comment
Hide comment
@DonJayamanne

DonJayamanne Jul 9, 2017

Owner

Please use ptvsd version:3.0.0

Owner

DonJayamanne commented Jul 9, 2017

Please use ptvsd version:3.0.0

@suankan

This comment has been minimized.

Show comment
Hide comment
@suankan

suankan Jul 12, 2017

I'm still getting TypeError: Cannot read property 'Threads' of null with ptvsd version 3.0.0.

macOS Sierra 10.12.5
vscode 1.14.0
vscode python ext 0.6.7
Python 2.7.13
ptvsd 3.0.0

suankan commented Jul 12, 2017

I'm still getting TypeError: Cannot read property 'Threads' of null with ptvsd version 3.0.0.

macOS Sierra 10.12.5
vscode 1.14.0
vscode python ext 0.6.7
Python 2.7.13
ptvsd 3.0.0

@suankan

This comment has been minimized.

Show comment
Hide comment
@suankan

suankan Jul 12, 2017

Also tried ptvsd versions 3.0.0rc1 and 2.2.0 but still the same error.

shell.ts:443 TypeError: Cannot read property 'Threads' of null
    at PythonDebugger.threadsRequest (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/out/client/debugger/Main.js:364:27)
    at PythonDebugger.DebugSession.dispatchRequest (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/debugSession.js:427:22)
    at PythonDebugger.ProtocolServer._handleData (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/protocol.js:104:38)
    at Socket.<anonymous> (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/protocol.js:24:60)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:551:20): Error: TypeError: Cannot read property 'Threads' of null
    at PythonDebugger.threadsRequest (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/out/client/debugger/Main.js:364:27)
    at PythonDebugger.DebugSession.dispatchRequest (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/debugSession.js:427:22)
    at PythonDebugger.ProtocolServer._handleData (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/protocol.js:104:38)
    at Socket.<anonymous> (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/protocol.js:24:60)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:551:20)
    at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:2183829
    at Object.v [as _notify] (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:53344)
    at Object.enter (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:56836)
    at n.Class.derive._oncancel._run (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:58157)
    at n.Class.derive._oncancel._error (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:57674)
    at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:1971976
    at g.e.dispatch (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:1973327)
    at g.e.handleData (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:1972835)
    at Socket.<anonymous> (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:1971836)
    at emitOne (events.js:96:13)
index.js:41 [uncaught exception]: Error: TypeError: Cannot read property 'Threads' of null
    at PythonDebugger.threadsRequest (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/out/client/debugger/Main.js:364:27)
    at PythonDebugger.DebugSession.dispatchRequest (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/debugSession.js:427:22)
    at PythonDebugger.ProtocolServer._handleData (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/protocol.js:104:38)
    at Socket.<anonymous> (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/protocol.js:24:60)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:551:20)

suankan commented Jul 12, 2017

Also tried ptvsd versions 3.0.0rc1 and 2.2.0 but still the same error.

shell.ts:443 TypeError: Cannot read property 'Threads' of null
    at PythonDebugger.threadsRequest (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/out/client/debugger/Main.js:364:27)
    at PythonDebugger.DebugSession.dispatchRequest (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/debugSession.js:427:22)
    at PythonDebugger.ProtocolServer._handleData (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/protocol.js:104:38)
    at Socket.<anonymous> (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/protocol.js:24:60)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:551:20): Error: TypeError: Cannot read property 'Threads' of null
    at PythonDebugger.threadsRequest (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/out/client/debugger/Main.js:364:27)
    at PythonDebugger.DebugSession.dispatchRequest (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/debugSession.js:427:22)
    at PythonDebugger.ProtocolServer._handleData (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/protocol.js:104:38)
    at Socket.<anonymous> (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/protocol.js:24:60)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:551:20)
    at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:2183829
    at Object.v [as _notify] (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:53344)
    at Object.enter (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:56836)
    at n.Class.derive._oncancel._run (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:58157)
    at n.Class.derive._oncancel._error (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:57674)
    at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:1971976
    at g.e.dispatch (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:1973327)
    at g.e.handleData (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:1972835)
    at Socket.<anonymous> (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28:1971836)
    at emitOne (events.js:96:13)
index.js:41 [uncaught exception]: Error: TypeError: Cannot read property 'Threads' of null
    at PythonDebugger.threadsRequest (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/out/client/debugger/Main.js:364:27)
    at PythonDebugger.DebugSession.dispatchRequest (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/debugSession.js:427:22)
    at PythonDebugger.ProtocolServer._handleData (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/protocol.js:104:38)
    at Socket.<anonymous> (/Users/suankan/.vscode/extensions/donjayamanne.python-0.6.7/node_modules/vscode-debugadapter/lib/protocol.js:24:60)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:551:20)
@stelf

This comment has been minimized.

Show comment
Hide comment
@stelf

stelf Sep 4, 2017

👍 same here with

/usr/local/lib/python2.7/dist-packages/ptvsd-3.2.1.dist-info:

...and vscode 1.15.1 on linux mint 18. desired port (in my case 3030) is open:

tcp 0 0 *:3030 *:* LISTEN

...trying to debug a remote embedded app (within Scribus) that was successfully subject to debugging with winpdb

stelf commented Sep 4, 2017

👍 same here with

/usr/local/lib/python2.7/dist-packages/ptvsd-3.2.1.dist-info:

...and vscode 1.15.1 on linux mint 18. desired port (in my case 3030) is open:

tcp 0 0 *:3030 *:* LISTEN

...trying to debug a remote embedded app (within Scribus) that was successfully subject to debugging with winpdb

@dbnex14

This comment has been minimized.

Show comment
Hide comment
@dbnex14

dbnex14 Oct 3, 2017

same issue on mac

dbnex14 commented Oct 3, 2017

same issue on mac

@DonJayamanne

This comment has been minimized.

Show comment
Hide comment
@DonJayamanne

DonJayamanne Oct 3, 2017

Owner

You need to use PTVSD 3.0.0
#981 (comment)

Owner

DonJayamanne commented Oct 3, 2017

You need to use PTVSD 3.0.0
#981 (comment)

@microcoder

This comment has been minimized.

Show comment
Hide comment
@microcoder

microcoder Nov 8, 2017

hi, guys!

$ python3 --version Python 3.6.3
$ python3 -m ptvsd --version ptvsd 3.2.1.0

import ptvsd

print('Waiting connection on port 3000')
ptvsd.enable_attach("my_secret", address=("0.0.0.0", 3000))
ptvsd.wait_for_attach()

VS Code:

Version 1.17.2
Commit b813d12980308015bcd2b3a2f6efa5c810c33ba5
Date 2017-10-16T13:57:00.652Z
Shell 1.7.7
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

I'm getting the error at debug console like this Error: TypeError: Cannot read property 'Threads' of undefined

Do i need to use ptvsd 3.0.0?

microcoder commented Nov 8, 2017

hi, guys!

$ python3 --version Python 3.6.3
$ python3 -m ptvsd --version ptvsd 3.2.1.0

import ptvsd

print('Waiting connection on port 3000')
ptvsd.enable_attach("my_secret", address=("0.0.0.0", 3000))
ptvsd.wait_for_attach()

VS Code:

Version 1.17.2
Commit b813d12980308015bcd2b3a2f6efa5c810c33ba5
Date 2017-10-16T13:57:00.652Z
Shell 1.7.7
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

I'm getting the error at debug console like this Error: TypeError: Cannot read property 'Threads' of undefined

Do i need to use ptvsd 3.0.0?

@Dlizzz

This comment has been minimized.

Show comment
Hide comment
@Dlizzz

Dlizzz commented Nov 8, 2017

Yes.

@microcoder

This comment has been minimized.

Show comment
Hide comment
@microcoder

microcoder Nov 8, 2017

Dlizzz, thank you! Is this a bug pytvsd >3.0.0?

microcoder commented Nov 8, 2017

Dlizzz, thank you! Is this a bug pytvsd >3.0.0?

@DonJayamanne

This comment has been minimized.

Show comment
Hide comment
@DonJayamanne

DonJayamanne Nov 8, 2017

Owner

@microcoder no, PTVSD has refactored their code to talk the vscode debugger protocol. I'm waiting for them to complete their work in that space.

Owner

DonJayamanne commented Nov 8, 2017

@microcoder no, PTVSD has refactored their code to talk the vscode debugger protocol. I'm waiting for them to complete their work in that space.

@Dlizzz

This comment has been minimized.

Show comment
Hide comment
@Dlizzz

Dlizzz Nov 8, 2017

No. It's just that they have implemented a new protocol in ptvsd > 3.0.0 to control remote debugging. This new protocol is not yet supported by the plugin, as described in #1018.

Dlizzz commented Nov 8, 2017

No. It's just that they have implemented a new protocol in ptvsd > 3.0.0 to control remote debugging. This new protocol is not yet supported by the plugin, as described in #1018.

@istrel

This comment has been minimized.

Show comment
Hide comment
@istrel

istrel Jan 19, 2018

As @DonJayamanne mentioned in #1018

@zooba Version 3.0 of PTVSD python library has some significant changes. My extension still uses the old mechanism of communication, using the binary messages. Version 3.0 uses IPC JSON.

#1018 (comment)

So solution is in using older version of ptvsd. I used version 2.2.0 explicitly and it worked

istrel commented Jan 19, 2018

As @DonJayamanne mentioned in #1018

@zooba Version 3.0 of PTVSD python library has some significant changes. My extension still uses the old mechanism of communication, using the binary messages. Version 3.0 uses IPC JSON.

#1018 (comment)

So solution is in using older version of ptvsd. I used version 2.2.0 explicitly and it worked

@neerajsinghsonu

This comment has been minimized.

Show comment
Hide comment
@neerajsinghsonu

neerajsinghsonu Jan 20, 2018

Hi All,

I had same issue while I was start using VSCode. Well i took 3 hours to figure out what is exactly issue, I just stared with some step by step debugging like what port being used and what are the other settings.

Finally I was lucky and got the solutions :) So I created a page to share with everyone. You can check what is my findings and what you should need to setup to get Xdebug work with VSCode.

Link: How-to-setup-PHP-Debugging-xdebug-with-VSCode-Visual-Studio-Code

Hope my experience would be helpful for someone. Cheers!!!

neerajsinghsonu commented Jan 20, 2018

Hi All,

I had same issue while I was start using VSCode. Well i took 3 hours to figure out what is exactly issue, I just stared with some step by step debugging like what port being used and what are the other settings.

Finally I was lucky and got the solutions :) So I created a page to share with everyone. You can check what is my findings and what you should need to setup to get Xdebug work with VSCode.

Link: How-to-setup-PHP-Debugging-xdebug-with-VSCode-Visual-Studio-Code

Hope my experience would be helpful for someone. Cheers!!!

@Cyberjuice

This comment has been minimized.

Show comment
Hide comment
@Cyberjuice

Cyberjuice Feb 7, 2018

Hi,
I updated visual studio code today and I got a message, that python extension is now available from microsoft, so I uninstalled both of my python related extensions and installed the new one.
Debugging now works.

Thanks.

Cyberjuice commented Feb 7, 2018

Hi,
I updated visual studio code today and I got a message, that python extension is now available from microsoft, so I uninstalled both of my python related extensions and installed the new one.
Debugging now works.

Thanks.

@DonJayamanne

This comment has been minimized.

Show comment
Hide comment
@DonJayamanne

DonJayamanne Feb 7, 2018

Owner

Debugging now works.

@Cyberjuice A number of debugger related issues were fixed in the December release.

Owner

DonJayamanne commented Feb 7, 2018

Debugging now works.

@Cyberjuice A number of debugger related issues were fixed in the December release.

@Yajo

This comment has been minimized.

Show comment
Hide comment
@Yajo

Yajo Feb 9, 2018

So can we now use the latest version of the ptvsd package? 😊

Yajo commented Feb 9, 2018

So can we now use the latest version of the ptvsd package? 😊

@microcoder

This comment has been minimized.

Show comment
Hide comment
@microcoder

microcoder Feb 9, 2018

@Yajo for me it do not work on ptvsd version 3.2.1, vscode 1.20.0 crashing:

index.js:39 [uncaught exception]: Error: write EPIPE
onError @ index.js:39
(anonymous) @ index.js:111
emitOne @ events.js:96
emit @ events.js:191
window.onerror @ /usr/share/code/resources/electron.asar/renderer/init.js:135
i.globals.onerror @ errorTelemetry.ts:64
index.js:42 Error: write EPIPE
    at exports._errnoException (util.js:1050)
    at WriteWrap.afterWrite [as oncomplete] (net.js:813)
onError @ index.js:42
(anonymous) @ index.js:111
emitOne @ events.js:96
emit @ events.js:191
window.onerror @ /usr/share/code/resources/electron.asar/renderer/init.js:135
i.globals.onerror @ errorTelemetry.ts:64
events.js:163 Uncaught Error: write EPIPE
    at exports._errnoException (util.js:1050)
    at WriteWrap.afterWrite [as oncomplete] (net.js:813)
exports._errnoException @ util.js:1050
afterWrite @ net.js:813
messageService.ts:126 Debug adapter process has terminated unexpectedly
e.doShow @ messageService.ts:126
e.show @ messageService.ts:105
_.onServerExit @ rawDebugSession.ts:535
(anonymous) @ rawDebugSession.ts:449
emitTwo @ events.js:111
emit @ events.js:194
__dirname.ChildProcess._handle.onexit @ internal/child_process.js:215

microcoder commented Feb 9, 2018

@Yajo for me it do not work on ptvsd version 3.2.1, vscode 1.20.0 crashing:

index.js:39 [uncaught exception]: Error: write EPIPE
onError @ index.js:39
(anonymous) @ index.js:111
emitOne @ events.js:96
emit @ events.js:191
window.onerror @ /usr/share/code/resources/electron.asar/renderer/init.js:135
i.globals.onerror @ errorTelemetry.ts:64
index.js:42 Error: write EPIPE
    at exports._errnoException (util.js:1050)
    at WriteWrap.afterWrite [as oncomplete] (net.js:813)
onError @ index.js:42
(anonymous) @ index.js:111
emitOne @ events.js:96
emit @ events.js:191
window.onerror @ /usr/share/code/resources/electron.asar/renderer/init.js:135
i.globals.onerror @ errorTelemetry.ts:64
events.js:163 Uncaught Error: write EPIPE
    at exports._errnoException (util.js:1050)
    at WriteWrap.afterWrite [as oncomplete] (net.js:813)
exports._errnoException @ util.js:1050
afterWrite @ net.js:813
messageService.ts:126 Debug adapter process has terminated unexpectedly
e.doShow @ messageService.ts:126
e.show @ messageService.ts:105
_.onServerExit @ rawDebugSession.ts:535
(anonymous) @ rawDebugSession.ts:449
emitTwo @ events.js:111
emit @ events.js:194
__dirname.ChildProcess._handle.onexit @ internal/child_process.js:215
@DonJayamanne

This comment has been minimized.

Show comment
Hide comment
@DonJayamanne

DonJayamanne Feb 9, 2018

Owner

So can we now use the latest version of the ptvsd package? 😊

There's a separate piece of engineering work to rehaul the debugger, however that'll take sometime. Fyi that's in progress.

Owner

DonJayamanne commented Feb 9, 2018

So can we now use the latest version of the ptvsd package? 😊

There's a separate piece of engineering work to rehaul the debugger, however that'll take sometime. Fyi that's in progress.

@Yajo

This comment has been minimized.

Show comment
Hide comment
@Yajo

Yajo Feb 12, 2018

Cool, is there any place I can subscribe to know when will that be released? 🤔

Yajo commented Feb 12, 2018

Cool, is there any place I can subscribe to know when will that be released? 🤔

@DonJayamanne

This comment has been minimized.

Show comment
Hide comment
@DonJayamanne

DonJayamanne Feb 12, 2018

Owner

You can track it here (all work is now done in the Microsoft fork)

Please monitor the releases and issues.

Owner

DonJayamanne commented Feb 12, 2018

You can track it here (all work is now done in the Microsoft fork)

Please monitor the releases and issues.

DonJayamanne added a commit that referenced this issue Mar 15, 2018

Fixes issue that display incorrect interpreter briefly before updatin…
…g it to the right value (#1054)

* 🐛 fire change event only when changes are detected
* 📝 change log
* 🔨 fix typos
* Fixes #981

Goom11 added a commit to mostafaeweda/pythonVSCode that referenced this issue Aug 30, 2018

Fixes issue that display incorrect interpreter briefly before updatin…
…g it to the right value (DonJayamanne#1054)

* 🐛 fire change event only when changes are detected
* 📝 change log
* 🔨 fix typos
* Fixes DonJayamanne#981
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment