JupyterLab doesn't kill python process (PID) after shutdown?

Hi, I’m guessing this may not be a bug so hopefully this is an appropriate place to ask this question. I’m on Ubuntu 20.04 and use JL via MiniConda. JupyterLab runs great and I love using it. :slight_smile:

My question is as follows, in terms of processes (PID).

When I launch JL, I can see two PID created by using a command like ps -ef | grep python:

  1. one that seems to be more of a parent, and never shows up in top
  2. another one that has the above PID as it’s parent PPID, and when I run code in the notebook it does show up in top as command python

If I restart the kernel, the 2) process above will be killed, and a new one is created from the same parent PPID.

All well and good. When I then do File->Shutdown (ie, “Do you want to shutdown JupyterLab”), the first process is then killed (no longer shows up in the ps command), but the second process is not killed. It still shows up in the ps command. It never shows up in top anymore, and I suspect it may not be taking up any resources?

So I’m just wondering: is this by design, for some reason, and does it really matter?

Thank you for satisfying my curiosity! (I did try to Google this, but couldn’t find anything that was asking this specific question)

I forgot about this, but just recently remembered and don’t think I ever found an answer elsewhere.

So here is a screenshot showing what I mean:

The first command is with JL running, but no kernel active.
The second command is with a new kernel started.
The third command is with shutting down JL (“Please confirm you want to shut down Jupyter Lab”) but not shutting down the kernel (manually).

Does the persistence of this process (PID) related to the kernel matter? Does it use up system resources?

If it does … I’m just wondering why shutting down JL would not automatically shut down all active kernels?

Thank you! :slight_smile:

Anyone? Bueller? :slight_smile:

I guess I will just make sure I manually shut down any active kernels before I shutdown the Jupyter Lab server/browser. Then the issue of these “orphaned” kernels will be avoided.