# Stray Julia Processes

**URL:** <https://discourse.julialang.org/t/stray-julia-processes/58270>\
**Category:** General Usage\
**Created:** [March 31, 2021, 1:55am UTC](https://discourse.julialang.org/t/stray-julia-processes/58270 "2021-03-31T01:55:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholaswogan](https://avatars.discourse-cdn.com/v4/letter/n/f1d935/32.png) [@Nicholaswogan](https://discourse.julialang.org/u/Nicholaswogan)\
**Post date:** [March 31, 2021, 1:55am UTC](https://discourse.julialang.org/t/stray-julia-processes/58270/1 "2021-03-31T01:55:36Z")

</div>

I use Julia through Jupyter notebooks on MacOS Catalina (10.15.7). My “activity monitor app” ([See screenshot here](https://discourse.julialang.org/uploads/short-url/s3N25QiVYPVSClYomaBIPdIFUu0.png) ) claims I have a TON of Julia stray processes eating up many GB of RAM. Why is this? What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [March 31, 2021, 3:36am UTC](https://discourse.julialang.org/t/stray-julia-processes/58270/2 "2021-03-31T03:36:39Z")

</div>

Are you by any chance using `Distributed` and adding processors? i.e. `addprocs()`?

---

<div class="post-metadata">

**Author:** ![Nicholaswogan](https://avatars.discourse-cdn.com/v4/letter/n/f1d935/32.png) [@Nicholaswogan](https://discourse.julialang.org/u/Nicholaswogan)\
**Post date:** [March 31, 2021, 3:44am UTC](https://discourse.julialang.org/t/stray-julia-processes/58270/3 "2021-03-31T03:44:45Z")

</div>

> Are you by any chance using `Distributed` and adding processors? i.e. `addprocs()` ?

No.

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [March 31, 2021, 4:10am UTC](https://discourse.julialang.org/t/stray-julia-processes/58270/4 "2021-03-31T04:10:59Z")

</div>

How many notebooks did you have open when you took that screenshot? Had you killed/restarted the kernel recently?

---

<div class="post-metadata">

**Author:** ![Nicholaswogan](https://avatars.discourse-cdn.com/v4/letter/n/f1d935/32.png) [@Nicholaswogan](https://discourse.julialang.org/u/Nicholaswogan)\
**Post date:** [March 31, 2021, 5:11am UTC](https://discourse.julialang.org/t/stray-julia-processes/58270/5 "2021-03-31T05:11:28Z")

</div>

None. When I took the screen shot, I had closed every window on my computer and quit almost all running applications. The Julia processes were hidden from sight. I suspect they have somehow been building up over the past few days/weeks.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [March 31, 2021, 5:52am UTC](https://discourse.julialang.org/t/stray-julia-processes/58270/6 "2021-03-31T05:52:08Z")

</div>

Did you shutdown the kernels before closing the browser window of the notebooks? If not, the kernels may still be running. If you use Jupyter notebooks, try `jupyter notebook list` to see the running kernels.

---

<div class="post-metadata">

**Author:** ![Nicholaswogan](https://avatars.discourse-cdn.com/v4/letter/n/f1d935/32.png) [@Nicholaswogan](https://discourse.julialang.org/u/Nicholaswogan)\
**Post date:** [April 1, 2021, 3:51pm UTC](https://discourse.julialang.org/t/stray-julia-processes/58270/7 "2021-04-01T15:51:16Z")

</div>

Yes @mkitti is right. I had jupyter notebook servers running. I think Python kernels will be automatically stopped when you “exit” out of the terminal, but Julia kernels will not be.

---

<div class="post-metadata">

**Author:** ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Post date:** [April 1, 2021, 4:13pm UTC](https://discourse.julialang.org/t/stray-julia-processes/58270/8 "2021-04-01T16:13:13Z")

</div>

Novice question: How do I “shutdown the kernels” from the webpages for the notebooks? I’m running this from the REPL with `> notebook()`

---

<div class="post-metadata">

**Author:** ![ivirshup](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ivirshup/32/16364_2.png) [@ivirshup](https://discourse.julialang.org/u/ivirshup)\
**Post date:** [April 3, 2021, 4:54am UTC](https://discourse.julialang.org/t/stray-julia-processes/58270/9 "2021-04-03T04:54:08Z")

</div>

I’ve been noticing this as well. I’ve currently got a julia process running that was created for a notebook, even though the jupyter server is no longer on.

---

<div class="post-metadata">

**Author:** ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Post date:** [April 5, 2021, 12:03am UTC](https://discourse.julialang.org/t/stray-julia-processes/58270/10 "2021-04-05T00:03:55Z")

</div>

This pattern is working for me with IJulia, Julia 1.6, MAC Big Sur,

use `notebook()` and then navigate to the place where your notebooks are  
or  
navigate to the place where your notebooks are, then type `notebook(dir=pwd())`  
and then do whatever you need to do, opening as many notebooks as you like.

When it’s time to shut down. Shut down **each notebook** with (1) save and (2) cntrl-w. You will be left with the single notebook web page in the directory. Shut that one down by hitting the **quit** button. Then shutdown the whole works with **logout**.

Julia will fester for a bit before you see the `julia>` prompt, but you will see it. If you do `exit()` and then `ps -A | grep Julia` you will not see any rogue processes.

This worked for me, but YMMV.
