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

Check process existence when listing nbserver processes #6099

Merged
merged 2 commits into from
Jul 20, 2014

Conversation

takluyver
Copy link
Member

While implementing nbopen, I realised that listing the available nbservers gave me info for a dozen servers that had died without cleaning up their info. This implements a simple check that a process with the given pid exists. This isn't perfect, because another process could be reusing the same pid, but the chances of that are fairly low, and it can't give a false negative, as far as I know.

I haven't tried to implement a .NET version of check_pid for the _process_cli module. The ctypes version for Windows is taken from code in IPython.parallel - this is simplified to use the new utility function.

@minrk minrk added this to the 3.0 milestone Jul 9, 2014
@minrk
Copy link
Member

minrk commented Jul 9, 2014

Nice. 👍

try:
os.unlink(file)
except OSError:
pass # TODO: This should warn or log or something
Copy link
Member

Choose a reason for hiding this comment

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

Yes, probably.

Copy link
Member

Choose a reason for hiding this comment

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

do you want to actually log something here, or should we merge as is ?

@dsblank
Copy link
Contributor

dsblank commented Jul 20, 2014

Looking forward to using the new nbopen and related functionality!

I haven't tried to implement a .NET version of check_pid for the _process_cli module.

Just a note that the _process_cli is for all implementations of CLI, so that includes Mono and .NET. It is easy to miss that _process_cli could be used on any operating system. But as long as it is an implemented function that is also in Mono, there should be no issue.

minrk added a commit that referenced this pull request Jul 20, 2014
Check process existence when listing nbserver processes
@minrk minrk merged commit d01354e into ipython:master Jul 20, 2014
@Carreau
Copy link
Member

Carreau commented Jul 20, 2014

Weren't there some # TODO: This should warn or log or something left still missing ?

@takluyver
Copy link
Member Author

Whenever it's clear what warning/logging it should do, anyone can add that later.

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Check process existence when listing nbserver processes
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.

4 participants