Skip to content

KernelTerminated

William Stein edited this page Nov 2, 2017 · 7 revisions

Jupyter Kernel Terminated

This page is may be helpful if you see the message: "Kernel terminated -- this might be caused by running out of memory or hitting a bug in some library (e.g., forking too many processes, trying to access invalid memory, etc.). Consider restarting or upgrading your project or running the relevant code directly in a terminal to track down the cause."

Is it caused by using up too much memory?

Currently the easiest way to test this is to open a terminal (+New --> Terminal) in your project, then type top. Watch the processes listed there, especially the column labeled RES, which stands for "resident memory". If your project has 1000MB of RAM, which is the default in CoCalc, and the sum of the RES entries is close to 1000000, then you should definitely expect a memory allocation failure soon.

You can type M into top to make it sort processes by memory, which will help in seeing how much is used. You can also hit the space bar a lot to make it update frequently. Type q when you are done. If you want to kill a process in top, type k then the process id (PID), which is in the first column.

In addition to using the Terminal, you can also look in the Settings tab of your project under "Shared RAM", which will say how much is "currently" used. This is only updated once every 30s though.

You might also type smem -ntk in a terminal to get a pretty useful breakdown of memory usage.

Currently in CoCalc, if you open a bunch of Jupyter notebooks, then they just sit there using memory. You have to explicitly kill them with top or click "Restart" or restart your project in order for them to go away. This can be a significant problem if you are grading a dozens of assignments.

If you're hitting memory issues, and just want some more space, upgrade your project. The subscription are listed here. For example, for $7/month, you can upgrade from 1GB to 4GB, and have a lot more elbow room!

Clone this wiki locally