Hello, I’m looking for a reliable way of tunneling TCP sockets of pydevd <https://www.pydev.org/manual_adv_remote_debugger.html> through notebook’s websocket. General tunnel can be easily implemented using Comm, but debugger requires a special approach. Debugger is a tool that stops all threads of the process to let you debug them, including the main event loop thread. And, unfortunately, Comm and shell requests are handled in the same thread.
Actually I’ve succeeded in creating a working tunnel for pydevd. A special function moves handling of shell requests in a separate thread. All shell requests are either being processed in-place if they’re related to my protocol extension or being re-queued in a main IOLoop. Pydevd knows about that thread and never stops it. All that features are attained by monkey-patching different protected methods of kernel.shell_socket, kernel.shell_channel, kernel.session, etc. So that black magic is unsteady. After exploring a code of ipykernel and notebook, I considered that the easiest way to make a tunnel for the debugger is to create a separate channel. Let’s name that channel «management». It should look like an analog of IOPubThread with CommManager and could be used for debugging, profiling, collecting metrics at runtime, etc. What do you think about that idea? Do you see any obvious pitfalls around implementing the new channel? Will you accept a patch if me with my colleagues will implement it for notebook, ipykernel and probably for a gateway? Thanks, Vladimir -- You received this message because you are subscribed to the Google Groups "Project Jupyter" group. To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/9a5fd364-6583-40a3-9796-01e92db2cab5%40googlegroups.com.