-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
Handle the Control channel in a separate thread #447
Comments
I think that a new channel that is explicitly for threaded operation would be better (ThreadedControl?), so there is no ambiguity as to if the message is handled on the main thread or in the dedicated thread. |
@impact27 sure, it would be a much cleaner architecture. However, if a new channel appeared in |
It could be an optional channel. It could be connected only upon request. |
An optional channel still should be proxied through the Jupyter Notebook server, and now it doesn't know anything about an optional channel. Talking about Jupyter hosted on a remote server, usually it's possible to connect only to Jupyter Notebook server, all other listening TCP ports could be filtered by a firewall. |
@blink1073, @SylvainCorlay, what do you think about this? We really need something like this in Spyder to not create our own channel and avoid problems like spyder-ide/spyder#13288, which we've been unable to solve after months of trying it. |
I think as long as the control channel isn't modifying kernel state, it should be fine to run it in a separate thread. |
@ccordoba12 @blink1073 yes! We definitely need to run the control channel in its own thread, for many reasons. Actually
The plan is to make that change in ipykernel, and also to implement the new Jupyter Debugger Protocol in ipykernel (and not just in xeus-python). I would love to see spyder also be a front-end to that protocol! |
@ccordoba12 @vladimirlagunov FYI PR #585 splits control into a separate thread |
Thanks a lot @SylvainCorlay for the ping and your work on this! Pinging @impact27 in case he wants to take a look at the debugger implementation in PR #597. |
Hello,
I’d created a similar discussion in Jupyter Google Groups but looks that responsible people from IPython kernel does not participate in groups.
Brief explanation: I tried to implement a tunnel for the pydev debugger through notebook’s websocket and using Comm. Unfortunately, Comm and cell execution shares the same thread, so when debugger suspends the cell’s code it also suspends the tunnel. Anyway, I'd succeeded to implement it by moving a Control channel in a separate thread using monkey-patching but it doesn't look like a production-ready solution.
I propose to move handling of the Control channel in a separate thread and add an analog of Comm for that thread. It could be used for tunneling streams of a debugger or for collecting metrics at runtime.
A rough algorithm of handling each message in a separate thread:
kernel_info_request
,complete_request
, Comm for Control.Do you see any obvious pitfalls around handling the Control channel in a separate thread? If I’ll prepare a patch with acceptable code quality, will you merge it?
The text was updated successfully, but these errors were encountered: