voila-dashboards / voila

Voilà turns Jupyter notebooks into standalone web applications
https://voila.readthedocs.io
Other
5.43k stars 504 forks source link

Crash in Partially pre-render notebook. Exception in callback <TaskWakeupMethWrapper> #1183

Open BaraGhuleTrum opened 2 years ago

BaraGhuleTrum commented 2 years ago

Description

As investigations showed, it happening because of tornado==6.2. Downgrading to 6.1 - solving problem.

Reproduce

  1. Run voila in preheated-mode with partially pre-render (get_query_string) method in .ipynb file Run command: voila --enable_nbextensions=True --no-browser \ --Voila.ip='0.0.0.0' \ --Voila.port=8866 \ --Voila.tornado_settings="{'allow_origin': '*'}" \ --VoilaConfiguration.file_whitelist="['*']" \ --preheat_kernel=True \ --MappingKernelManager.cull_interval=60 \ --MappingKernelManager.cull_idle_timeout=120 \ --pool_size=5 \ test_ws.ipynb

    test_ws.ipynb file: from voila.utils import get_query_string query_string = get_query_string() from test_ws_app import *

  2. See error in logs.

Expected behavior

Working properly

Context

Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here.
You may want to sanitize the paths in the output.
`$PATH:                 
        /usr/local/bin 
        /usr/local/sbin
        /usr/local/bin 
        /usr/sbin      
        /usr/bin       
        /sbin          
        /bin

sys.path:
        /usr/local/bin
        /usr/local/lib/python39.zip
        /usr/local/lib/python3.9
        /usr/local/lib/python3.9/lib-dynload
        /usr/local/lib/python3.9/site-packages

sys.executable:
        /usr/local/bin/python

sys.version:
        4.9.13 (main, Aug  2 2022, 11:13:23)
        [GCC 10.2.1 20210110]

platform.platform():
        Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.31

which -a jupyter:
        /usr/local/bin/jupyter
        /usr/local/bin/jupyter

pip list:
        Package              Version
        -------------------- -----------
        anyio                3.6.1
        argon2-cffi          21.3.0
        argon2-cffi-bindings 21.2.0
        attrs                22.1.0
        Babel                2.10.3
        backcall             0.2.0
        beautifulsoup4       4.11.1
        bleach               5.0.1
        certifi              2022.6.15
        cffi                 1.15.1
        charset-normalizer   2.1.0
        debugpy              1.6.2
        decorator            5.1.1
        defusedxml           0.7.1
        entrypoints          0.4
        fastjsonschema       2.16.1
        idna                 3.3
        importlib-metadata   4.12.0
        ipykernel            6.15.1
        ipython              7.26.0
        ipython-genutils     0.2.0
        ipywidgets           7.6.3
        jedi                 0.18.1
        Jinja2               3.1.2
        json5                0.9.9
        jsonschema           4.9.1
        jupyter              1.0.0
        jupyter-client       7.3.4
        jupyter-console      6.4.4
        jupyter-core         4.11.1
        jupyter-server       1.18.1
        jupyterlab-pygments  0.2.2
        jupyterlab-server    2.15.0
        jupyterlab-widgets   1.1.1
        MarkupSafe           2.1.1
        matplotlib-inline    0.1.3
        mistune              0.8.4
        nbclient             0.5.13
        nbconvert            6.5.0
        nbformat             5.4.0
        nest-asyncio         1.5.5
        notebook             6.4.12
        numpy                1.23.1
        packaging            21.3
        pandas               1.4.3
        pandocfilters        1.5.0
        parso                0.8.3
        pexpect              4.8.0
        pickleshare          0.7.5
        pip                  22.0.4
        prometheus-client    0.14.1
        prompt-toolkit       3.0.30
        psutil               5.9.1
        ptyprocess           0.7.0
        pycparser            2.21
        Pygments             2.12.0
        pyparsing            3.0.9
        pyrsistent           0.18.1
        python-dateutil      2.8.2
        pytz                 2022.1
        pyzmq                23.2.0
        qtconsole            5.3.1
        QtPy                 2.1.0
        requests             2.28.1
        Send2Trash           1.8.0
        setuptools           58.1.0
        six                  1.16.0
        sniffio              1.2.0
        soupsieve            2.3.2.post1
        terminado            0.15.0
        tinycss2             1.1.1
        tornado              6.2
        traitlets            5.3.0
        typeguard            2.13.3
        typing               3.7.4.3
        typing_extensions    4.3.0
        urllib3              1.26.11
        voila                0.3.5
        wcwidth              0.2.5
        webencodings         0.5.1
        websocket-client     1.3.3
        websockets           10.3
        wheel                0.37.1
        widgetsnbextension   3.5.2
        zipp                 3.8.1`
Command Line Output
From Docker container below:
`Exception in callback ()

handle: ()>

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run

    self._context.run(self._callback, *self._args)

RuntimeError: Cannot enter into task  wait_for=> while another task  cb=[IOLoop.add_future..() at /usr/local/lib/python3.9/site-packages/tornado/ioloop.py:694]> is being executed.

Exception in callback ()

handle: ()>

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run

    self._context.run(self._callback, *self._args)

RuntimeError: Cannot enter into task  wait_for=> while another task  cb=[IOLoop.add_future..() at /usr/local/lib/python3.9/site-packages/tornado/ioloop.py:694]> is being executed.

Exception in callback ()

handle: ()>

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run

    self._context.run(self._callback, *self._args)

RuntimeError: Cannot enter into task  wait_for=> while another task  cb=[IOLoop.add_future..() at /usr/local/lib/python3.9/site-packages/tornado/ioloop.py:694]> is being executed.

Exception in callback ()

handle: ()>

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run

    self._context.run(self._callback, *self._args)

RuntimeError: Cannot enter into task  wait_for=> while another task  cb=[IOLoop.add_future..() at /usr/local/lib/python3.9/site-packages/tornado/ioloop.py:694]> is being executed.

Exception in callback ()

handle: ()>

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run

    self._context.run(self._callback, *self._args)

RuntimeError: Cannot enter into task  wait_for=> while another task  cb=[IOLoop.add_future..() at /usr/local/lib/python3.9/site-packages/tornado/ioloop.py:694]> is being executed.`
Browser Output
Paste the output from your browser Javascript console here.
-

If using JupyterLab

Installed Labextensions
Paste the output from your command line running `jupyter labextension list`.
Not working
ektar commented 2 years ago

I'm observing same issue, similar command string:

voila --debug --enable_nbextensions=True --VoilaConfiguration.file_whitelist="['.*\.(png|jpg|gif|svg|mp4|avi|ogg|js|woff)']" \
--Voila.tornado_settings=$'{"headers":{"Content-Security-Policy":"frame-ancestors *;" }}' \
--VoilaConfiguration.preheat_kernel=False \
runner.ipynb

Not doing partial pre-render, just going straight into my app.

BaraGhuleTrum commented 2 years ago

Well. To be completely honest, this bug appears not only in partial pre-render, as I figured out later.