matlab_kernel icon indicating copy to clipboard operation
matlab_kernel copied to clipboard

kernel keeps crashing

Open TheMadHatter666 opened this issue 7 years ago • 39 comments

I am able to start a notebook and evaluate a few cells. But I usually can't get too far before the kernel crashes (there is no predictability to it). If I use Cell -> run all, it will die every time. The terminal window shows no error messages. Just notes that the kernel is restarting. Ideas ?

TheMadHatter666 avatar Oct 09 '17 03:10 TheMadHatter666

You can run jupyter notebook --debug to get more error messages in the terminal. What versions of jupyter, matlab_kernel, and matlab are you running?

dsblank avatar Oct 09 '17 11:10 dsblank

Thanks, I tried that and the random crash occurred again. Here is what I am seeing now in the terminal right before the crash:

Assertion failed: nbytes == sizeof dummy (/Volumes/100GB/conda/conda-bld/zeromq_1505916310977/work/src/signaler.cpp:206)

I can do all the same commands in Matlab directly with no issue. Sometimes I get further than this in the notebook.

TheMadHatter666 avatar Oct 09 '17 13:10 TheMadHatter666

Which version of zeromq is this? conda info zeromq.

blink1073 avatar Oct 09 '17 15:10 blink1073

4.2.1 if that helps. Thanks.

TheMadHatter666 avatar Oct 09 '17 23:10 TheMadHatter666

FYI, I used conda install zeromq=4.2.1 but that did not fix the issue. Same error message under the debug.

I ran the same notebook on my Windows device today. In runs perfectly. So it's something to do with my Mac.

TheMadHatter666 avatar Oct 10 '17 00:10 TheMadHatter666

I am starting to believe (but don't know for sure) that autosave is somehow related. Is there a way anyone knows to disable it when running a matlab kernel? There is no %autosave magic available

TheMadHatter666 avatar Oct 10 '17 01:10 TheMadHatter666

Here are the instructions for turning off autosave: https://stackoverflow.com/a/45980165/2814123

blink1073 avatar Oct 10 '17 11:10 blink1073

Thanks again. It appears that disabling the autosave has stopped the random crashing. Not perfect, but it's a work around for now. Going to leave this open though.

TheMadHatter666 avatar Oct 10 '17 14:10 TheMadHatter666

Crud! I spoke too soon. I just got further than ever before. Still crashes randomly.

TheMadHatter666 avatar Oct 10 '17 14:10 TheMadHatter666

Is there a lot of output associated with the cells?

blink1073 avatar Oct 10 '17 15:10 blink1073

Not really. In some cases, just simple evaluations.

TheMadHatter666 avatar Oct 11 '17 01:10 TheMadHatter666

Ah, it looks like this is a known issue with libzmq on Windows: https://github.com/zeromq/libzmq/issues/1808

blink1073 avatar Oct 11 '17 11:10 blink1073

Thanks. I am not sure how to interpret that. I have a mac and I have a somewhat different error message (" nbytes == sizeof dummy" vs "Connection reset by peer"). I tried updating a few packages, but eventually that just prevented Jupyter from launching at all. So I reinstalled Anaconda but am back where I started: Matlab kernel randomly crashes (every few evaluations).

TheMadHatter666 avatar Oct 11 '17 13:10 TheMadHatter666

Does it happen if you use the Python kernel?

blink1073 avatar Oct 11 '17 13:10 blink1073

Near as I can tell, Python kernels are stable. Not had the issue

TheMadHatter666 avatar Oct 13 '17 01:10 TheMadHatter666

Yep, definitely a Matlab kernel thing.

TheMadHatter666 avatar Oct 13 '17 01:10 TheMadHatter666

Do you mind trying with Calysto Bash? It is also based on metakernel, and we could narrow down our potential sources of error.

blink1073 avatar Oct 13 '17 11:10 blink1073

Thanks for continuing to help me. I installed Calysto Bash, but I am not sure to do from there. The notebook doesn't display output like in the sample notebook. I ran the command command jupyter notebook --debug in a cell and in the session thereby generated opened a notebook with the matlab kernel and evaluated cells until the crash occurred (never takes very long). Anyway, the cell is just showing a * instead of a number meaning that it's busy. But I don't know to do next.

Here is a screenshot.
screen shot 2017-10-13 at 1 46 11 pm

TheMadHatter666 avatar Oct 13 '17 18:10 TheMadHatter666

Oh wow, you are quite right. Looks like that kernel needs some updating. In the mean time you could try https://github.com/Calysto/calysto_prolog.

blink1073 avatar Oct 13 '17 21:10 blink1073

Thank you again. I am not sure what I am supposed to do with a prolog kernel. One thing I did try tonight was to spend a good deal of time sending commands and variables to and from MATLAB via the matlab engine (using the console in Spyder). No crashes. So I am pretty sure it's related to either Jupyter or the kernel. But I thought I should check that it is not a bug in Python engine for matlab. I don't think it is. But of course, since the error is random, who knows? I just know the error happen frequent enough in Jupyter that I can get it to happens usually after less than 5 minutes.

TheMadHatter666 avatar Oct 14 '17 06:10 TheMadHatter666

I updated the bash kernel, if you'd like to give that a try again.

blink1073 avatar Oct 21 '17 11:10 blink1073

Hello I get the same error:

[D 12:20:20.395 NotebookApp] activity on c564caaa-43f2-403e-92a4-c890683b5ff7: execute_input
Assertion failed: nbytes == sizeof (dummy) (/Volumes/100GB/conda/conda-bld/zeromq_1505916310977/work/src/signaler.cpp:364)

It also crashes randomly when I try to execute a command on the matlab kernel

I also followed the instructions detaled above but I was not able to solve this

JuanRdBO avatar Oct 23 '17 10:10 JuanRdBO

I'm running into the same problem, it looks a little bit different:

Assertion failed: nbytes == sizeof dummy (src/signaler.cpp:196)

I'm using a Linux system with Matlab 2016b, Python 3.5.4, installed using Miniconda. And the following Python packages: matlab-kernel==0.15.0 matlabengineforpython===R2016b metakernel==0.20.11 pyzmq==16.0.2

For me it's usable to some extent, sometimes I can use the notebook for an hour or so without issues, but sometimes it just crashes and does not recover for a while.

benvanwerkhoven avatar Oct 31 '17 16:10 benvanwerkhoven

Apologies, I'm not sure what else to try and I don't have a Matlab license to try and reproduce.

blink1073 avatar Oct 31 '17 17:10 blink1073

I solved it by reinstalling zeromq, however not by pip install. This method of installation did not work for some reason. Follow it’s github instructions

JuanRdBO avatar Nov 06 '17 07:11 JuanRdBO

@JuanRdBO Great news! We can put a note on the README. Can you say a bit about your situation? On WIndows? Which instructions did you follow? Was it this: https://github.com/zeromq/pyzmq/wiki/Building-and-Installing-PyZMQ#building-pyzmq-from-source

dsblank avatar Nov 06 '17 10:11 dsblank

Also, how did you install jupyter? Do you use anaconda?

dsblank avatar Nov 06 '17 10:11 dsblank

This issue occurred in a macbook pro mid 2012 with macOS High Sierra v. 10.13. I installed jupyter following the instructions on this github, so a standard installation. Then I installed the matlab kernel following this GitHub.

The solution was installing zeromq using the instructions provided here in zeromq.org's website. Actually it was just a line of code: brew install zmq. After that i restarted jupyter and it worked fine. However, there are still crashes sometimes, but the amount of them has decreased to an acceptable value. I'd say one every 2 hours or so. When it crashes, it does not show any output (Even in debugging mode).

JuanRdBO avatar Nov 06 '17 11:11 JuanRdBO

I had the same with my Macbook and Matlab R2017b installed on my machine. Apparently, running with --debug makes it more robus O_o. While before the kernel would crash every 3/4 minutes, now it still hasn't crashed yet.

2dvisio avatar Dec 01 '17 19:12 2dvisio

Just to keep this issue alive, I can report that I have the same issue on my Mac with a similar set up to @JuanRdBO. @2dvisio's suggestion to run with --debug doesn't appear to work for me.

It might be out there but I wonder if the issue is with the cases where the output is suppressed on Matlab. I ran the example notebook and noted that the crash always occurred around

b = a + 3;

So I removed the semicolon, re-ran and the notebook executed to the end without a crash.

Just a thought!

P.S. I am creating setup instructions (as a Jupyter notebook) for a class I am teaching in February. Here is a link to the notebook cpjobling/EG-247-Resources/setup.

cpjobling avatar Jan 06 '18 12:01 cpjobling