-
Notifications
You must be signed in to change notification settings - Fork 67
adapter: multiple concurrent sessions #1713
Comments
Connections between the adapter and the IDESince stdin/stdout can only be used for one channel at a time, all the extra channels will have to be socket channels, utilizing client access tokens (#1711) for security. The stdio channel is not really necessary at that point, and we could do everything over sockets - but we already have it implemented, and DAP clients other than VS and VSCode might not support connection to the server via sockets. Also the DAP spec still defines stdio as the DAP transport. So it's best to keep it supported. Thus, for "launch" scenarios, we will keep the current arrangement for single-proc : the IDE launches the adapter directly, and uses stdio for communication. This will also be the case for "launch" that involves multiple processes, but only for the first process; with the child processes, the adapter sends notifications ( For "attach", both single-proc and multiproc, there will be no local adapter at all. Instead, the adapter is spawned on the remote side (#1712), and the IDE will connect directly to it over a socket. This will require a small change to We'll build on the existing |
Connections between the adapter and the debug server (ptvsd/pydevd)All of these connections are over sockets - the only difference is that instead of having zero or one connection, we need to support zero or more connections. As before, the direction of the connection can be either adapter->server or server->adapter. However, different connections can have different directions. Furthermore, in multiproc mode (or perhaps always, for simplicity?) even if the initial connection is adapter->server, the adapter must still start a listener for future server->adapter connections from subprocesses. Regardless of the direction, the adapter will need to pass the server access token, and to validate the client access token (#1710). Per #1708, pydevd will now be sending information about the debug server listener port in the "initialize" event, when a new subprocess first connects to the adapter. The adapter will need to extract that information and preserve it for re-connection purposes. |
Debug sessionsEvery channel between the adapter and the IDE has a corresponding channel between the adapter and the debug server - the mapping is N:1:N. Every pair of channels defines a logical debug session, seen as a separate debugged process from within the IDE. This means that some things that are currently treated as singletons in the adapter will now have multiple instances, one for each session:
We will likely need a new class, The only global state in the adapter will then be a list of |
…disconnect Fix microsoft#1721 "runInTerminal" is broken on non-Windows platforms. Fix microsoft#1722: Output is not captured in "noDebug" with "runInTerminal" Groundwork for microsoft#1713: adapter: multiple concurrent sessions Move "launch" request parsing and debuggee process spawning, PID reporting and tracking, stdio "output" capture, and exit code reporting into launcher. Launcher now communicates to the adapter via a full-fledged message channel. Refactor adapter. Add an abstraction for a debug session, and treat IDE, launcher, and debug server as separate components managed by that session. Improve adapter logging to capture information about current debug session, and current message handler if any. Fix reporting exceptions from message handlers.
…disconnect Fix microsoft#1721 "runInTerminal" is broken on non-Windows platforms. Fix microsoft#1722: Output is not captured in "noDebug" with "runInTerminal" Groundwork for microsoft#1713: adapter: multiple concurrent sessions Move "launch" request parsing and debuggee process spawning, PID reporting and tracking, stdio "output" capture, and exit code reporting into launcher. Launcher now communicates to the adapter via a full-fledged message channel. Refactor adapter. Add an abstraction for a debug session, and treat IDE, launcher, and debug server as separate components managed by that session. Improve adapter logging to capture information about current debug session, and current message handler if any. Fix reporting exceptions from message handlers.
…disconnect Fix microsoft#1721 "runInTerminal" is broken on non-Windows platforms. Fix microsoft#1722: Output is not captured in "noDebug" with "runInTerminal" Groundwork for microsoft#1713: adapter: multiple concurrent sessions Move "launch" request parsing and debuggee process spawning, PID reporting and tracking, stdio "output" capture, and exit code reporting into launcher. Launcher now communicates to the adapter via a full-fledged message channel. Refactor adapter. Add an abstraction for a debug session, and treat IDE, launcher, and debug server as separate components managed by that session. Improve adapter logging to capture information about current debug session, and current message handler if any. Fix reporting exceptions from message handlers.
…disconnect Fix microsoft#1721 "runInTerminal" is broken on non-Windows platforms. Fix microsoft#1722: Output is not captured in "noDebug" with "runInTerminal" Groundwork for microsoft#1713: adapter: multiple concurrent sessions Move "launch" request parsing and debuggee process spawning, PID reporting and tracking, stdio "output" capture, and exit code reporting into launcher. Launcher now communicates to the adapter via a full-fledged message channel. Refactor adapter. Add an abstraction for a debug session, and treat IDE, launcher, and debug server as separate components managed by that session. Improve adapter logging to capture information about current debug session, and current message handler if any. Fix reporting exceptions from message handlers. Various test fixes.
…disconnect Fix microsoft#1721 "runInTerminal" is broken on non-Windows platforms. Fix microsoft#1722: Output is not captured in "noDebug" with "runInTerminal" Groundwork for microsoft#1713: adapter: multiple concurrent sessions Move "launch" request parsing and debuggee process spawning, PID reporting and tracking, stdio "output" capture, and exit code reporting into launcher. Launcher now communicates to the adapter via a full-fledged message channel. Refactor adapter. Add an abstraction for a debug session, and treat IDE, launcher, and debug server as separate components managed by that session. Improve adapter logging to capture information about current debug session, and current message handler if any. Fix reporting exceptions from message handlers. Various test fixes.
…disconnect Fix microsoft#1721 "runInTerminal" is broken on non-Windows platforms. Fix microsoft#1722: Output is not captured in "noDebug" with "runInTerminal" Groundwork for microsoft#1713: adapter: multiple concurrent sessions Move "launch" request parsing and debuggee process spawning, PID reporting and tracking, stdio "output" capture, and exit code reporting into launcher. Launcher now communicates to the adapter via a full-fledged message channel. Refactor adapter. Add an abstraction for a debug session, and treat IDE, launcher, and debug server as separate components managed by that session. Improve adapter logging to capture information about current debug session, and current message handler if any. Fix reporting exceptions from message handlers. Various test fixes.
…disconnect Fix microsoft#1721 "runInTerminal" is broken on non-Windows platforms. Fix microsoft#1722: Output is not captured in "noDebug" with "runInTerminal" Groundwork for microsoft#1713: adapter: multiple concurrent sessions Move "launch" request parsing and debuggee process spawning, PID reporting and tracking, stdio "output" capture, and exit code reporting into launcher. Launcher now communicates to the adapter via a full-fledged message channel. Refactor adapter. Add an abstraction for a debug session, and treat IDE, launcher, and debug server as separate components managed by that session. Improve adapter logging to capture information about current debug session, and current message handler if any. Fix reporting exceptions from message handlers. Various test fixes.
…disconnect Fix microsoft#1721 "runInTerminal" is broken on non-Windows platforms. Fix microsoft#1722: Output is not captured in "noDebug" with "runInTerminal" Groundwork for microsoft#1713: adapter: multiple concurrent sessions Move "launch" request parsing and debuggee process spawning, PID reporting and tracking, stdio "output" capture, and exit code reporting into launcher. Launcher now communicates to the adapter via a full-fledged message channel. Refactor adapter. Add an abstraction for a debug session, and treat IDE, launcher, and debug server as separate components managed by that session. Improve adapter logging to capture information about current debug session, and current message handler if any. Fix reporting exceptions from message handlers. Various test fixes.
…disconnect Fix microsoft#1721 "runInTerminal" is broken on non-Windows platforms. Fix microsoft#1722: Output is not captured in "noDebug" with "runInTerminal" Groundwork for microsoft#1713: adapter: multiple concurrent sessions Move "launch" request parsing and debuggee process spawning, PID reporting and tracking, stdio "output" capture, and exit code reporting into launcher. Launcher now communicates to the adapter via a full-fledged message channel. Refactor adapter. Add an abstraction for a debug session, and treat IDE, launcher, and debug server as separate components managed by that session. Improve adapter logging to capture information about current debug session, and current message handler if any. Fix reporting exceptions from message handlers. Various test fixes.
…disconnect Fix microsoft#1721 "runInTerminal" is broken on non-Windows platforms. Fix microsoft#1722: Output is not captured in "noDebug" with "runInTerminal" Groundwork for microsoft#1713: adapter: multiple concurrent sessions Move "launch" request parsing and debuggee process spawning, PID reporting and tracking, stdio "output" capture, and exit code reporting into launcher. Launcher now communicates to the adapter via a full-fledged message channel. Refactor adapter. Add an abstraction for a debug session, and treat IDE, launcher, and debug server as separate components managed by that session. Improve adapter logging to capture information about current debug session, and current message handler if any. Fix reporting exceptions from message handlers. Various test fixes.
Fix #1721 "runInTerminal" is broken on non-Windows platforms. Fix #1722: Output is not captured in "noDebug" with "runInTerminal" Groundwork for #1713: adapter: multiple concurrent sessions Move "launch" request parsing and debuggee process spawning, PID reporting and tracking, stdio "output" capture, and exit code reporting into launcher. Launcher now communicates to the adapter via a full-fledged message channel. Refactor adapter. Add an abstraction for a debug session, and treat IDE, launcher, and debug server as separate components managed by that session. Improve adapter logging to capture information about current debug session, and current message handler if any. Fix reporting exceptions from message handlers. Various test fixes.
The adapter process currently has a 1:1 mapping to DAP process, and the associated debug session. For #1706, we need to change this to 1:N.
DAP requires a separate connection for every process / debug session, so we will still have separate communication channels for each one. And for every connection from the IDE to the adapter, there's a corresponding connection from the adapter to the debug server inside the debugged process. Specific requirements for the IDE and the server will be described below.
The text was updated successfully, but these errors were encountered: