Skip to content
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

set close_fds=False when starting kernels on Windows #408

Merged
merged 1 commit into from Dec 1, 2018

Conversation

@minrk
Copy link
Member

minrk commented Nov 30, 2018

Python 3.7 sets close_fds=True by default, closing the interrupt/parent handles we are trying to pass to the kernel.

We can be more explicit and use the new STARTUPINFO.lpAttributeList (the reason for the change in default behavior) in the future to explicitly inherit only these handles, but this preserves the pre-3.7 behavior on 3.7, getting kernels back to working on py37.

closes ipython/ipykernel#374

cf spyder-ide/spyder#8013

Python 3.7 sets close_fds=True by default,
closing the interrupt/parent handles we are trying to pass to the kernel.
@minrk minrk referenced this pull request Nov 30, 2018
0 of 3 tasks complete
@minrk minrk added this to the 5.3 milestone Nov 30, 2018
@CAM-Gerlach

This comment has been minimized.

Copy link

CAM-Gerlach commented Nov 30, 2018

Per @ccordoba12 's request, I tried to test this on Windows but I got a huge chain of exceptions trying to install it locally, starting with AttributeError: _DistInfoDistribution__dep_map and ending with pip._vendor.pkg_resources.RequirementParseError: Parse error at "'; extra '": Expected stringEnd, which occured even after I uninstalled the jupyter_client version in the conda env I was using for testing and updated pip and setuptools to the latest versions.

@minrk

This comment has been minimized.

Copy link
Member Author

minrk commented Nov 30, 2018

@CAM-Gerlach that sounds like conda-forge/testpath-feedstock#7 which I believe is fixed in the latest conda package of testpath, so I think conda update testpath should fix it.

@CAM-Gerlach

This comment has been minimized.

Copy link

CAM-Gerlach commented Dec 1, 2018

@minrk Thanks! That did indeed resolve the problem (I'd assumed it was just some machine or OS-specific issue with pip), and testing the fix this does indeed resolve the stated problem. Ctrl-C still doesn't properly interrupt execution on Windows under QtConsole (the interrupt only gets handled at the end, after the 10 seconds have elapsed) but it does register properly at least like on Python 3.6.

@minrk

This comment has been minimized.

Copy link
Member Author

minrk commented Dec 1, 2018

Yes, not being able to interrupt time.sleep promptly on Windows is a function of how interrupt_main works on Windows, and time.sleep is specifically not interruptible from other threads until control returns to the Python interpreter on that thread. Most realistic code returns to the Python interpreter with a reasonable frequency, so this is less often an issue in reality than when using time.sleep to test.

Thanks for confirming! We should do a release shortly.

@minrk minrk merged commit 1d807c2 into jupyter:master Dec 1, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@minrk minrk deleted the minrk:close-fds-windows branch Dec 1, 2018
meeseeksmachine pushed a commit to meeseeksmachine/jupyter_client that referenced this pull request Dec 1, 2018
@CAM-Gerlach

This comment has been minimized.

Copy link

CAM-Gerlach commented Dec 2, 2018

Thanks @minrk ! I seem to recall reading something to that effect previously and I just chalked it up (like most conda commands taking 10x longer on native Windows than on my Fedora VM running inside of it) to Windows' many limitations.

minrk added a commit that referenced this pull request Dec 4, 2018
…on-5.x

Backport PR #408 on branch 5.x (set close_fds=False when starting kernels on Windows)
@papagala

This comment has been minimized.

Copy link

papagala commented Dec 10, 2018

Sorry, I have a basic question. Which file do I have to edit in order to set close_fds=False when starting kernels on Windows?

@CAM-Gerlach

This comment has been minimized.

Copy link

CAM-Gerlach commented Dec 11, 2018

@papagala conda install jupyter_client=5.2.4 in your Spyder environment.

alex-dewar added a commit to newaetech/chipwhisperer that referenced this pull request Dec 13, 2018
Jupyter client < 5.2.4 was unable to interrupt on Windows
with Python 3.7+. See jupyter/jupyter_client#408
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.