Skip to content
This repository was archived by the owner on Aug 2, 2023. It is now read-only.

Conversation

@DonJayamanne
Copy link
Contributor

@DonJayamanne DonJayamanne commented Mar 30, 2018

@int19h @ericsnowcurrently @karthiknadig
The code is far from complete., but would like some early feedback on the solution.
With the changes I've made I've managed to get re-attach working, at least on VSC.

Pending - Fix remainder of the code and what ever tests fail

Summary:

  • Create new threading to check for connections
  • Change how callbacks are passed into pydevd

ptvsd/wrapper.py Outdated
# print(s)
#ipcjson._TRACE = ipcjson_trace
def ipcjson_trace(s):
with open('/Users/donjayamanne/Desktop/Development/vscode/my_forked_ptvsd/ptvsd/log.log', 'a') as file:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary debugging code 😃

ptvsd/wrapper.py Outdated

if addhandlers:
_add_atexit_handler(proc, server_thread)
_set_signal_handlers(proc)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to have to modify _set_signal_handlers to close all VS Code message processors.

ptvsd/wrapper.py Outdated
client, _ = server.accept()
_add_socket_handler(client, pydevd, 'ptvsd.Server', killonclose=True, addhandlers=False)

connection_thread = threading.Thread(target=_wait_for_more, name='ptvsd_client_connection')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New thread that'll ensure we support more than one client.
@int19h When speaking to Karthik the question about limiting multiple concurrent client connections came up.
Should we have a limit on the number of concurrent connections, to just one?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. We never supported anything more than that before, and just thinking of all the possibilities of things going wrong in that scenario makes my head hurt. :)

Copy link
Contributor Author

@DonJayamanne DonJayamanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments

ptvsd/wrapper.py Outdated
_add_pydevd_event_handler(client, pydevd, name='ptvsd.Server')

connection_thread = threading.Thread(target=_wait_for_more_connections,
name='ptvsd_client_connection')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ptvsd.Client.Connection as name, to be consistent with other ptvsd thread names

@DonJayamanne DonJayamanne changed the title Add ability to attach, detach and attach once again WIP - Add ability to attach, detach and attach once again Apr 2, 2018
ptvsd/wrapper.py Outdated
"""
client = _create_client()
client.connect((host, port))
pydevd = PydevdSocket()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not needed, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@DonJayamanne DonJayamanne changed the title WIP - Add ability to attach, detach and attach once again Add ability to attach, detach and attach once again Apr 2, 2018
@DonJayamanne
Copy link
Contributor Author

DonJayamanne commented Apr 2, 2018

@ericsnowcurrently
Here are the requirements for remote debugging:

  • Current functionality of PR
  • Run a program
    • Somewhere down the line, we can import ptvsd and start the socket server (PTVSD)
    • It should listen for connections (non-blocking)
      This is a scenario where we have the socket server listening for connections, but in a non-blocking manner.
    • If a connection is made, then debugger should connect
  • If more than one try to connect, we need to return an error message rather than just rejecting the connection (else user will never know why the connection is being rejected - very important for us too to diagnoze the errors)

@codecov-io
Copy link

Codecov Report

Merging #287 into master will increase coverage by 0.23%.
The diff coverage is 73.01%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #287      +/-   ##
==========================================
+ Coverage    57.4%   57.64%   +0.23%     
==========================================
  Files          10       10              
  Lines        1850     1891      +41     
==========================================
+ Hits         1062     1090      +28     
- Misses        788      801      +13
Impacted Files Coverage Δ
ptvsd/ipcjson.py 65.7% <100%> (+0.33%) ⬆️
ptvsd/wrapper.py 50.9% <72.13%> (+0.6%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78d3225...d059ca8. Read the comment docs.

@DonJayamanne
Copy link
Contributor Author

Closing in favor of #296

@DonJayamanne DonJayamanne deleted the detach branch July 14, 2018 22:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants