Jupyterlab IJulia kernel "too many file descriptors in select()"

Jupyterlab (Windows 10, local) works for a while (~15 min), then the kernel dies with the message
Server Connection Error
A connection to the Jupyter server could not be established. JupyterLab will continue trying to reconnect. Check your network connection or Jupyter server configuration.

The powershell window, after initial startup, repeatedly (every 10 secs) prints:
[… LabApp] Adapting from protocol version 5.0 (kernel 2d6…) to 5.3
Then after about 15 minutes the kernel dies with the following output:
[I 18:00:09.662 LabApp] Shutting down 1 kernel
[I 18:00:14.757 LabApp] Kernel shutdown: b4a4bdfb-339e-40a5-a195-bcecdfb3c7dd
Traceback (most recent call last):

  • File “d:\python37\lib\runpy.py”, line 193, in _run_module_as_main*
  • main”, mod_spec)*
  • File “d:\python37\lib\runpy.py”, line 85, in _run_code*
  • exec(code, run_globals)*
  • File “d:\python37\scripts\jupyter-lab.EXE_main_.py”, line 9, in *
  • File “d:\python37\lib\site-packages\jupyter_core\application.py”, line 267, in launch_instance*
  • return super(JupyterApp, cls).launch_instance(argv=argv, *kwargs)
  • File “d:\python37\lib\site-packages\traitlets\config\application.py”, line 658, in launch_instance*
  • app.start()*
  • File “d:\python37\lib\site-packages\notebook\notebookapp.py”, line 1857, in start*
  • self.io_loop.start()*
  • File “d:\python37\lib\site-packages\tornado\platform\asyncio.py”, line 132, in start*
  • self.asyncio_loop.run_forever()*
  • File “d:\python37\lib\asyncio\base_events.py”, line 534, in run_forever*
  • self._run_once()*
  • File “d:\python37\lib\asyncio\base_events.py”, line 1735, in _run_once*
  • event_list = self._selector.select(timeout)*
  • File “d:\python37\lib\selectors.py”, line 323, in select*
  • r, w, _ = self._select(self._readers, self._writers, , timeout)*
  • File “d:\python37\lib\selectors.py”, line 314, in _select*
  • r, w, x = select.select(r, w, w, timeout)*
    ValueError: too many file descriptors in select()

After looking through past issues I have tried:
(1) pip uninstall tornado
python -m pip install tornado==5.1.1
(2) Pkg.update(“IJulia”)
to no effect.

The IPython kernel works fine.

Julia version is 1.1.0
Jupyter lab is 1.0.2
Jupyter core is 4.5.0

Any thoughts or suggestions would be appreciated.

Do you happen to run a 32-bit version of windows?

Thanks for the reply - no, 64-bit (v1903)

Possibly it’s this pyzmq bug:

In any case, the error is on the Python side, so you might file a Jupyter issue.

Thanks for your response. I think I’m not seeing the PyZMQ issue in my output - although the error certainly relates to ‘running out of file descriptors’.

I’ve done some more research - I have tried several kernels. As I mentioned above the Python 3 kernel does not cause the file error. On startup however, it also puts out just a couple of these:

[… LabApp] Adapting from protocol version 5.1 (kernel …) to 5.3 …

But they do not repeat every 10 seconds (until the system eventually runs out of file descriptors) like the Julia 1.1.0 kernel does.

Interestingly, when I start a tab with the Python kernel, the IJulia kernel stops repeating the ‘Adapting…’ message. Consequently, a work-around for me at the moment is to open an Python tab after starting an IJulia tab, which then enables me to work consistently in the Julia notebook, with no repeating ‘Adapting protocol…’ messages in the Powershell window.

This would be only mildly irritating if it continued to work when opening new Julia tabs. But in fact I always have to open a new Python tab after the Julia tab. So at the moment I have to open all the Julia tabs I expect to be working on, then a Python tab, and finally I can work without interruption.

I’ve also tried 2 other kernels. The Scilab kernel does not have the problem, but the Javascript (Node.js) kernel does.

Since I didn’t have the problem with the previous Jupyter lab, I would suggest that the latest version has invalidated the Adapting from protocol process in the IJulia and Javascript kernels (perhaps something that had been deprecated in previous specifications for a Jupyter kernel?)

The “adapting from protocol” message is still from the Jupyter side — it is not in the IJulia or Javascript kernels.

The IJulia kernel tells Jupyter that it uses protocol_version 5.0. A Jupyter that uses a newer protocol version is then supposed to turn on an “adapter” that enables it to talk to kernels that use older protocols. But it seems that their latest adapter is buggy. Can you file an issue at https://github.com/jupyter/jupyter_client?

Ok - thanks - I think I get it. I note that Python, Javascript & Scilab need to be updated from 5.1 (although Javascript also does not work) whereas Julia is from 5.0.

And thanks for the link - I will file an issue as you suggest.

Issue filed
https://github.com/jupyter/jupyter_client/issues/463

Another jupyterlab version (1.0.3) has appeared and the problem seems to be fixed. Updated using

python -m pip install -U jupyterlab

(also performed the rebuild when jupyterlab suggested it on restart)

1 Like