Skip to content
This repository

raw_input appears to be round-robin for qtconsole #673

Closed
ivanov opened this Issue August 03, 2011 · 3 comments

3 participants

Paul Ivanov Min RK Fernando Perez
Paul Ivanov
Collaborator

If I start a qtconsole, raw_input() seems to just work. But when I hook up to it from another kernel manager, then raw_input() only responds from qt_console every other time and blocks the other time, and if I attach a 3rd kernel manager, it only responds every 3rd time.

sending stdin_channel.input() from the 2nd and 3rd kernelmanagers always works, regardless of whether or not qtconsole is blocking or properly handling the raw_input.

Min RK
Owner
Fernando Perez
Owner

Yup, you caught this :) Thanks for making a proper report for it, we really need to fix this to have real use of multi-client scenarios.

Min RK
Owner

There are actually several more than the 2 options I proposed, but all would require some amount of handshaking to be added to frontends connecting to the kernel. The one we use now (and #2 above) is probably the worst, since a malicious/accidental connection to the stdin socket would cause this problem in a way the kernel has no way of preventing.

More could be:
3. implement stdin with a pair of PUB/SUB sockets, broadcasting the request to all, and accepting the first reply
4. separate req/rep pairs for each frontend

I think 1. and 3. are the best choices, depending on whether we want to bind the stdin request to the caller who caused it in the first place, or let any frontend respond (more flexible, but potentially weird side effects).

Min RK minrk closed this issue from a commit October 12, 2011
Min RK use ROUTER/DEALER sockets for stdin
stdin requests are now directed to the frontend that made the execution
request that called raw_input.

allow_stdin flag added to execution_request to indicate whether stdin_requests are allowed.

StdInNotImplementedError exception class added to IPython.core.error, and is raised if raw_input is called from execute requests where allow_input is undefined.

closes gh-673
a2ac298
Min RK minrk closed this in a2ac298 October 12, 2011
Min RK minrk closed this issue from a commit October 12, 2011
Min RK Merge branch 'stdin'
Changes stdin channel from REQ-REQ to ROUTER-DEALER, fixing
the round-robin load-balancing of stdin_requests across frontends.
stdin_requests now go to the client that made the execute_request
that prompted the stdin request.

stdin_requests from frontends that do not support stdin will raise an error,
rather than hanging on input that will never arrive.

reviewed by @fperez

closes #673
6e92ffd
Min RK minrk closed this in 6e92ffd October 12, 2011
Brian E. Granger ellisonbg referenced this issue from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Brian E. Granger ellisonbg referenced this issue from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.