Skip to content

Disable parent-poller if PID is 1#233

Merged
minrk merged 3 commits into
ipython:masterfrom
minrk:master
Mar 29, 2017
Merged

Disable parent-poller if PID is 1#233
minrk merged 3 commits into
ipython:masterfrom
minrk:master

Conversation

@minrk

@minrk minrk commented Mar 27, 2017

Copy link
Copy Markdown
Member

PID 1 is special, and we can't treat it the same as we do in other cases. When run in Docker, the parent (notebook server) can be PID 1, which results in IPython kernels exiting immediately on start, which manifests as "Kernel Restarting..." and "Kernel appears to have died". This is caused by the parent poller incorrectly detecting that the parent has exited, and shutting down.

Also adds logging for parent-exit-triggered shutdown, which would have helped figure this out much quicker.

closes jupyterhub/kubespawner#31
related: cassinyio/SwarmSpawner#6

cc @yuvipanda

minrk added 2 commits March 27, 2017 10:43
Parent polling doesn't work for PID 1,
the kernel will just exit immediately.
@minrk minrk modified the milestone: 4.6 Mar 27, 2017
@minrk

minrk commented Mar 27, 2017

Copy link
Copy Markdown
Member Author

appveyor is failing due to something weird with a tornado prerelease. Not related to this PR

@choldgraf

choldgraf commented Mar 27, 2017

Copy link
Copy Markdown

someone should write a series of mystery novel titles based on obscure bugs

"Jupyterhub and the mystery of the PID killer"

@yuvipanda

Copy link
Copy Markdown

Aaah, I had no idea we had a parent poller (not just a child one). This makes sense!

@yuvipanda

Copy link
Copy Markdown

I've tested this and it seems to fix the issue!

Comment thread ipykernel/kernelapp.py Outdated
self.poller = ParentPollerWindows(self.interrupt, self.parent_handle)
elif self.parent_handle:
elif self.parent_handle and self.parent_handle != 1:
# PID 1 is special. Parent polling doesn't work if ppid == 1 to start with.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add: # PID 1 (system init process) has no parent. Parent...

@willingc willingc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small suggestion on comment. Looks good. Thanks @minrk.

@minrk

minrk commented Mar 29, 2017

Copy link
Copy Markdown
Member Author

Thanks! Fixed the appveyor build in #237

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Specify container command

4 participants