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

kernel keeps crashing #101

Open
TheMadHatter666 opened this issue Oct 9, 2017 · 39 comments
Open

kernel keeps crashing #101

TheMadHatter666 opened this issue Oct 9, 2017 · 39 comments

Comments

@TheMadHatter666
Copy link

TheMadHatter666 commented Oct 9, 2017

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 ?

@dsblank
Copy link
Member

dsblank commented Oct 9, 2017

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?

@TheMadHatter666
Copy link
Author

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.

@blink1073
Copy link
Contributor

Which version of zeromq is this? conda info zeromq.

@TheMadHatter666
Copy link
Author

4.2.1 if that helps. Thanks.

@TheMadHatter666
Copy link
Author

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
Copy link
Author

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

@blink1073
Copy link
Contributor

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

@TheMadHatter666
Copy link
Author

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
Copy link
Author

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

@blink1073
Copy link
Contributor

Is there a lot of output associated with the cells?

@TheMadHatter666
Copy link
Author

Not really. In some cases, just simple evaluations.

@blink1073
Copy link
Contributor

Ah, it looks like this is a known issue with libzmq on Windows: zeromq/libzmq#1808

@TheMadHatter666
Copy link
Author

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).

@blink1073
Copy link
Contributor

Does it happen if you use the Python kernel?

@TheMadHatter666
Copy link
Author

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

@TheMadHatter666
Copy link
Author

Yep, definitely a Matlab kernel thing.

@blink1073
Copy link
Contributor

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

@TheMadHatter666
Copy link
Author

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

@blink1073
Copy link
Contributor

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.

@TheMadHatter666
Copy link
Author

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.

@blink1073
Copy link
Contributor

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

@JuanRdBO
Copy link

JuanRdBO commented Oct 23, 2017

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

@benvanwerkhoven
Copy link

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.

@blink1073
Copy link
Contributor

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

@JuanRdBO
Copy link

JuanRdBO commented Nov 6, 2017

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

@dsblank
Copy link
Member

dsblank commented Nov 6, 2017

@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
Copy link
Member

dsblank commented Nov 6, 2017

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

@JuanRdBO
Copy link

JuanRdBO commented Nov 6, 2017

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).

@2dvisio
Copy link

2dvisio commented Dec 1, 2017

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.

@cpjobling
Copy link

cpjobling commented Jan 6, 2018

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.

@dsblank
Copy link
Member

dsblank commented Jan 6, 2018

Thanks @cpjobling for the information! Perhaps this will help someone with a Mac and Matlab be able to further debug this. (I notice that you mention Windows on your course notebook. You might also mention Linux/Ubuntu as I suspect that that is the most tested, and best supported, environment.)

@cpjobling
Copy link

Thanks @dsblank ... unfortunately, Linux is not commonly used by undergraduate students -- at least at Swansea University where I teach. A mention for postgrads might be appropriate.

I could try helping out with the debugging if you could give me some hints on what to look for.

@dsblank
Copy link
Member

dsblank commented Jan 6, 2018

(Linux wasn't common at my school either, until I started suggesting and helping students get started. Ubuntu is easier to use than ever.)

Regarding debugging: Do you get messages on the console? Does the --debug flag give more info? Is the error consistent every time? You have up-to-date zmp python code? Up-to-date everything?

Have you tried Octave? We also support it via metakernel: https://github.com/Calysto/octave_kernel/

Also, have you thought about running from a JupyterHub server? I wouldn't teach without it, but it does take a dedicated computer. I've taught classes on an old, slow machine, and on a very nice $10k machine. Not that hard to setup, and once going, my college saw the benefits and it is now a college-wide supported machine: https://jupyter.brynmawr.edu/hub/login

@cpjobling
Copy link

cpjobling commented Jan 6, 2018

I installed a brand new copy of the latest Anaconda Release (4.30.0) yesterday. Matlab-Python link for Matlab 9.3.0.713579 (R2017b) and matlab_kernel both installed using the instructions given in the Calysto/matlab_kernal instructions.

Started kernel using

jupyter notebook matlab_kernel.ipynb --debug

Run all cells. Point of crash is rather random. Here is a listing of the console log for a failure at

a = [1,2,3]
[D 15:15:27.632 NotebookApp] activity on c35838ad-3fd4-487e-85f8-e77871dd6142: display_data
[D 15:15:27.636 NotebookApp] activity on c35838ad-3fd4-487e-85f8-e77871dd6142: status
Assertion failed: nbytes == sizeof (dummy) (/Volumes/100GB/conda/conda-bld/zeromq_1505916310977/work/src/signaler.cpp:364)
[D 15:15:27.637 NotebookApp] activity on c35838ad-3fd4-487e-85f8-e77871dd6142: status
[D 15:15:27.639 NotebookApp] activity on c35838ad-3fd4-487e-85f8-e77871dd6142: execute_input
[I 15:15:29.228 NotebookApp] KernelRestarter: restarting kernel (1/5)
kernel c35838ad-3fd4-487e-85f8-e77871dd6142 restarted
[D 15:15:29.230 NotebookApp] Starting kernel: ['/Users/eechris/anaconda3/bin/python', '-m', 'matlab_kernel', '-f', '/Users/eechris/Library/Jupyter/runtime/kernel-c35838ad-3fd4-487e-85f8-e77871dd6142.json']
[D 15:15:29.236 NotebookApp] Connecting to: tcp://127.0.0.1:65148
[D 15:15:32.240 NotebookApp] KernelRestarter: restart apparently succeeded
[D 15:15:40.104 NotebookApp] activity on c35838ad-3fd4-487e-85f8-e77871dd6142: status
[D 15:15:40.111 NotebookApp] activity on c35838ad-3fd4-487e-85f8-e77871dd6142: status
[D 15:15:40.114 NotebookApp] activity on c35838ad-3fd4-487e-85f8-e77871dd6142: status
[D 15:16:15.263 NotebookApp] 200 GET /api/contents/matlab_kernel.ipynb?content=0&_=1515251653178 (::1) 2.08ms
[I 15:16:15.268 NotebookApp] Saving file at /matlab_kernel.ipynb
[D 15:16:15.269 NotebookApp] Saving /Users/eechris/dev/EG-247-Resources/setup/matlab_kernel.ipynb
[D 15:16:15.290 NotebookApp] 200 PUT /api/contents/matlab_kernel.ipynb (::1) 21.73ms

As for consistency, the crash occurs at various points in the notebook but the error message is always the same:

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

I don't know how to check if the zmp code is most up to date available.

I'll take your suggestions on how to encourage the use of Linux and deploying Jupyter Hub into account in my future plans for my course. Our problem is that as an Engineering school, we've gotten tied-in to Matlab for teaching!

@RobBW
Copy link

RobBW commented Jan 7, 2018 via email

@2dvisio
Copy link

2dvisio commented Jan 14, 2018

I have installed the version of zmq via brew install zmq. It installs the version 4.2.3 (latest stable). My conda however still uses 4.2.2. And the kernel is still crashing.

I have tried to search a 4.2.3 package for conda but unsuccessfully.

@buschbapti
Copy link

Any update on this issue? I am not on Mac but Ubuntu 18.04. For me the Kernel also keep crashing but not really at random. I have narrowed it down that calling the rand function is likely to make the Kernel crash and restart. Maybe my problem is not related to the above issues though as --debug does not seems to chow any error. It just output that the kernel is restarting.

Thanks for the help.
Best.

@dsblank
Copy link
Member

dsblank commented Sep 22, 2018

@buschbapti This sounds different. Do you see any error message in the window where you start "jupyter notebook"?

@dsweber2
Copy link

dsweber2 commented Nov 7, 2018

I'm on a Linux desktop 18.04, and I'm getting the same issue, random crashing after a few commands and the error message

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

Installing zmq via sudo apt-get install libzmq3-dev increased the number of cells I could run before the error happened, but didn't solve the issue.

As a side note, this is after installing via anaconda/bin/pip wheel git+https://github.com/Calysto/matlab_kernel.git; when I installed using anaconda's pip, it ran into issues building the wheel; specifically it said that there was no 'License.txt' found. Not sure if you want that filed as a separate issue.

I've also tried installing it in my user python, rather than the anaconda one. I get the same problem as OP there, but was able to install via pip install matlab_kernel

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

No branches or pull requests

10 participants