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

**URL:** <https://discourse.julialang.org/t/jupyterlab-ijulia-kernel-too-many-file-descriptors-in-select/26606>\
**Category:** General Usage\
**Tags:** jupyter\
**Created:** [July 21, 2019, 5:42pm UTC](https://discourse.julialang.org/t/jupyterlab-ijulia-kernel-too-many-file-descriptors-in-select/26606 "2019-07-21T17:42:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ralphmrm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralphmrm1/32/8934_2.png) [@ralphmrm1](https://discourse.julialang.org/u/ralphmrm1)\
**Post date:** [July 21, 2019, 5:42pm UTC](https://discourse.julialang.org/t/jupyterlab-ijulia-kernel-too-many-file-descriptors-in-select/26606/1 "2019-07-21T17:42:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![freemint](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freemint/32/20013_2.png) [@freemint](https://discourse.julialang.org/u/freemint)\
**Post date:** [July 21, 2019, 6:18pm UTC](https://discourse.julialang.org/t/jupyterlab-ijulia-kernel-too-many-file-descriptors-in-select/26606/2 "2019-07-21T18:18:45Z")

</div>

Do you happen to run a 32-bit version of windows?  
[https://superuser.com/questions/1356320/what-is-the-number-of-open-files-limits](https://superuser.com/questions/1356320/what-is-the-number-of-open-files-limits)

---

<div class="post-metadata">

**Author:** ![ralphmrm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralphmrm1/32/8934_2.png) [@ralphmrm1](https://discourse.julialang.org/u/ralphmrm1)\
**Post date:** [July 21, 2019, 6:33pm UTC](https://discourse.julialang.org/t/jupyterlab-ijulia-kernel-too-many-file-descriptors-in-select/26606/3 "2019-07-21T18:33:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 21, 2019, 9:31pm UTC](https://discourse.julialang.org/t/jupyterlab-ijulia-kernel-too-many-file-descriptors-in-select/26606/4 "2019-07-21T21:31:00Z")

</div>

Possibly it’s this pyzmq bug:

[https://github.com/zeromq/pyzmq/issues/1170](https://github.com/zeromq/pyzmq/issues/1170)

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

---

<div class="post-metadata">

**Author:** ![ralphmrm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralphmrm1/32/8934_2.png) [@ralphmrm1](https://discourse.julialang.org/u/ralphmrm1)\
**Post date:** [July 22, 2019, 5:29pm UTC](https://discourse.julialang.org/t/jupyterlab-ijulia-kernel-too-many-file-descriptors-in-select/26606/5 "2019-07-22T17:29:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 22, 2019, 5:35pm UTC](https://discourse.julialang.org/t/jupyterlab-ijulia-kernel-too-many-file-descriptors-in-select/26606/6 "2019-07-22T17:35:16Z")

</div>

> [@ralphmrm1](#):
>
> 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](https://github.com/JuliaLang/IJulia.jl/blob/master/src/handlers.jl#L152). 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 [GitHub - jupyter/jupyter\_client: Jupyter protocol client APIs](https://github.com/jupyter/jupyter_client)?

---

<div class="post-metadata">

**Author:** ![ralphmrm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralphmrm1/32/8934_2.png) [@ralphmrm1](https://discourse.julialang.org/u/ralphmrm1)\
**Post date:** [July 22, 2019, 6:30pm UTC](https://discourse.julialang.org/t/jupyterlab-ijulia-kernel-too-many-file-descriptors-in-select/26606/7 "2019-07-22T18:30:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ralphmrm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralphmrm1/32/8934_2.png) [@ralphmrm1](https://discourse.julialang.org/u/ralphmrm1)\
**Post date:** [July 22, 2019, 7:09pm UTC](https://discourse.julialang.org/t/jupyterlab-ijulia-kernel-too-many-file-descriptors-in-select/26606/8 "2019-07-22T19:09:26Z")

</div>

Issue filed  
[https://github.com/jupyter/jupyter\_client/issues/463](https://github.com/jupyter/jupyter_client/issues/463)

---

<div class="post-metadata">

**Author:** ![ralphmrm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralphmrm1/32/8934_2.png) [@ralphmrm1](https://discourse.julialang.org/u/ralphmrm1)\
**Post date:** [July 26, 2019, 11:34am UTC](https://discourse.julialang.org/t/jupyterlab-ijulia-kernel-too-many-file-descriptors-in-select/26606/9 "2019-07-26T11:34:53Z")

</div>

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)
