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

Client hangs with version 7.2.2 #771

Closed
chyzzqo2 opened this issue Apr 12, 2022 · 7 comments · Fixed by #772
Closed

Client hangs with version 7.2.2 #771

chyzzqo2 opened this issue Apr 12, 2022 · 7 comments · Fixed by #772
Labels

Comments

@chyzzqo2
Copy link

We've seen occasional client hangs on shutdown with version 7.2.2 and nbclient that i suspect is caused by 1219c7e

Trace looks like this

    term (zmq/sugar/context.py:190)
    destroy (zmq/sugar/context.py:243)
    stop_channels (jupyter_client/client.py:323)
    _async_cleanup_kernel (nbclient/client.py:484)
    _run (asyncio/events.py:88)
    _run_once (asyncio/base_events.py:1786)
    run_forever (asyncio/base_events.py:541)
    run_until_complete (asyncio/base_events.py:574)
    just_run (nbclient/util.py:62)
    wrapped (nbclient/util.py:84)
    setup_kernel (nbclient/client.py:567)
    __exit__ (contextlib.py:119)
    execute ```
    
 
@ccordoba12
Copy link
Contributor

We're also seeing something similar in Spyder, i.e. some errors coming from zmq.

@blink1073
Copy link
Contributor

Can either of you please point me to some reproduction code so I can make a test here and fix the bug?

@blink1073 blink1073 added the bug label Apr 13, 2022
@chyzzqo2
Copy link
Author

I haven't been able to reliably reproduce yet. I've seen it happen maybe 0.5% percent of the time, but with several different kernels.

@ccordoba12
Copy link
Contributor

In our case, please see issue spyder-ide/spyder#17615. @mrclary (one of our core devs) found it. Perhaps he can share more details.

@mrclary
Copy link

mrclary commented Apr 13, 2022

I found the following issue with jupyter_client=7.2.1.

>> conda create -n jup721 python=3.9.12 jupyter_client=7.2.1 qtconsole=5.3.0
>> conda activate jup721
(jup721) >> jupyter qtconsole

Upon quitting qtconsole the following stderr is printed in the Terminal.

jupyter_client 7.2.1 error
ERROR:asyncio:Exception in callback BaseAsyncIOLoop._handle_events(34, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(34, 1)>
Traceback (most recent call last):
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 189, in _handle_events
    handler_func(fileobj, events)
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 445, in _handle_events
    zmq_events = self.socket.EVENTS
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/zmq/sugar/attrsettr.py", line 51, in __getattr__
    return self._get_attr_opt(upper_key, opt)
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/zmq/sugar/attrsettr.py", line 63, in _get_attr_opt
    return self.get(opt)
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/zmq/_future.py", line 215, in get
    result = super(_AsyncSocket, self).get(key)
  File "zmq/backend/cython/socket.pyx", line 464, in zmq.backend.cython.socket.Socket.get
  File "zmq/backend/cython/socket.pyx", line 135, in zmq.backend.cython.socket._check_closed
zmq.error.ZMQError: Socket operation on non-socket
ERROR:asyncio:Exception in callback BaseAsyncIOLoop._handle_events(36, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(36, 1)>
Traceback (most recent call last):
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 189, in _handle_events
    handler_func(fileobj, events)
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 445, in _handle_events
    zmq_events = self.socket.EVENTS
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/zmq/sugar/attrsettr.py", line 51, in __getattr__
    return self._get_attr_opt(upper_key, opt)
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/zmq/sugar/attrsettr.py", line 63, in _get_attr_opt
    return self.get(opt)
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/zmq/_future.py", line 215, in get
    result = super(_AsyncSocket, self).get(key)
  File "zmq/backend/cython/socket.pyx", line 464, in zmq.backend.cython.socket.Socket.get
  File "zmq/backend/cython/socket.pyx", line 135, in zmq.backend.cython.socket._check_closed
zmq.error.ZMQError: Socket operation on non-socket
ERROR:asyncio:Exception in callback BaseAsyncIOLoop._handle_events(36, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(36, 1)>
Traceback (most recent call last):
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 189, in _handle_events
    handler_func(fileobj, events)
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/zmq/eventloop/zmqstream.py", line 445, in _handle_events
    zmq_events = self.socket.EVENTS
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/zmq/sugar/attrsettr.py", line 51, in __getattr__
    return self._get_attr_opt(upper_key, opt)
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/zmq/sugar/attrsettr.py", line 63, in _get_attr_opt
    return self.get(opt)
  File "/Users/rclary/opt/miniconda3/envs/jup721/lib/python3.9/site-packages/zmq/_future.py", line 215, in get
    result = super(_AsyncSocket, self).get(key)
  File "zmq/backend/cython/socket.pyx", line 464, in zmq.backend.cython.socket.Socket.get
  File "zmq/backend/cython/socket.pyx", line 135, in zmq.backend.cython.socket._check_closed
zmq.error.ZMQError: Socket operation on non-socket
jup721 environment
# packages in environment at /Users/rclary/opt/miniconda3/envs/jup721:
#
# Name                    Version                   Build  Channel
appnope                   0.1.2           py39hecd8cb5_1001  
asttokens                 2.0.5              pyhd3eb1b0_0  
backcall                  0.2.0              pyhd3eb1b0_0  
ca-certificates           2022.3.29            hecd8cb5_0  
certifi                   2021.10.8        py39hecd8cb5_2  
debugpy                   1.5.1            py39he9d5cce_0  
decorator                 5.1.1              pyhd3eb1b0_0  
entrypoints               0.3              py39hecd8cb5_0  
executing                 0.8.3              pyhd3eb1b0_0  
icu                       58.2                 h0a44026_3  
ipykernel                 6.9.1            py39hecd8cb5_0  
ipython                   8.2.0            py39hecd8cb5_0  
ipython_genutils          0.2.0              pyhd3eb1b0_1  
jedi                      0.18.1           py39hecd8cb5_1  
jpeg                      9d                   h9ed2024_0  
jupyter_client            7.2.1              pyhd8ed1ab_0    conda-forge
jupyter_core              4.9.2            py39hecd8cb5_0  
libcxx                    12.0.0               h2f01273_0  
libffi                    3.3                  hb1e8313_2  
libpng                    1.6.37               ha441bb4_0  
libsodium                 1.0.18               h1de35cc_0  
matplotlib-inline         0.1.2              pyhd3eb1b0_2  
ncurses                   6.3                  hca72f7f_2  
nest-asyncio              1.5.5              pyhd8ed1ab_0    conda-forge
openssl                   1.1.1n               hca72f7f_0  
packaging                 21.3               pyhd3eb1b0_0  
parso                     0.8.3              pyhd3eb1b0_0  
pexpect                   4.8.0              pyhd3eb1b0_3  
pickleshare               0.7.5           pyhd3eb1b0_1003  
pip                       21.2.4           py39hecd8cb5_0  
prompt-toolkit            3.0.20             pyhd3eb1b0_0  
ptyprocess                0.7.0              pyhd3eb1b0_2  
pure_eval                 0.2.2              pyhd3eb1b0_0  
pygments                  2.11.2             pyhd3eb1b0_0  
pyparsing                 3.0.4              pyhd3eb1b0_0  
pyqt                      5.9.2            py39h23ab428_6  
python                    3.9.12               hdfd78df_0  
python-dateutil           2.8.2              pyhd3eb1b0_0  
pyzmq                     22.3.0           py39he9d5cce_2  
qt                        5.9.7                h468cd18_1  
qtconsole                 5.3.0              pyhd3eb1b0_0  
qtpy                      2.0.1              pyhd3eb1b0_0  
readline                  8.1.2                hca72f7f_1  
setuptools                61.2.0           py39hecd8cb5_0  
sip                       4.19.13          py39h23ab428_0  
six                       1.16.0             pyhd3eb1b0_1  
sqlite                    3.38.2               h707629a_0  
stack_data                0.2.0              pyhd3eb1b0_0  
tk                        8.6.11               h7bc2e8c_0  
tornado                   6.1              py39h9ed2024_0  
traitlets                 5.1.1              pyhd3eb1b0_0  
tzdata                    2022a                hda174b7_0  
wcwidth                   0.2.5              pyhd3eb1b0_0  
wheel                     0.37.1             pyhd3eb1b0_0  
xz                        5.2.5                h1de35cc_0  
zeromq                    4.3.4                h23ab428_0  
zlib                      1.2.12               h4dc903c_0  

The following produces no errors when quitting qtconsole.

>> conda create -n jup720 python=3.9.12 jupyter_client=7.2.0 qtconsole=5.3.0
>> conda activate jup720
(jup720) >> jupyter qtconsole
jup720 environment
# packages in environment at /Users/rclary/opt/miniconda3/envs/jup720:
#
# Name                    Version                   Build  Channel
appnope                   0.1.2           py39hecd8cb5_1001  
asttokens                 2.0.5              pyhd3eb1b0_0  
backcall                  0.2.0              pyhd3eb1b0_0  
ca-certificates           2022.3.29            hecd8cb5_0  
certifi                   2021.10.8        py39hecd8cb5_2  
debugpy                   1.5.1            py39he9d5cce_0  
decorator                 5.1.1              pyhd3eb1b0_0  
entrypoints               0.3              py39hecd8cb5_0  
executing                 0.8.3              pyhd3eb1b0_0  
icu                       58.2                 h0a44026_3  
ipykernel                 6.9.1            py39hecd8cb5_0  
ipython                   8.2.0            py39hecd8cb5_0  
ipython_genutils          0.2.0              pyhd3eb1b0_1  
jedi                      0.18.1           py39hecd8cb5_1  
jpeg                      9d                   h9ed2024_0  
jupyter_client            7.2.0              pyhd8ed1ab_0    conda-forge
jupyter_core              4.9.2            py39hecd8cb5_0  
libcxx                    12.0.0               h2f01273_0  
libffi                    3.3                  hb1e8313_2  
libpng                    1.6.37               ha441bb4_0  
libsodium                 1.0.18               h1de35cc_0  
matplotlib-inline         0.1.2              pyhd3eb1b0_2  
ncurses                   6.3                  hca72f7f_2  
nest-asyncio              1.5.5              pyhd8ed1ab_0    conda-forge
openssl                   1.1.1n               hca72f7f_0  
packaging                 21.3               pyhd3eb1b0_0  
parso                     0.8.3              pyhd3eb1b0_0  
pexpect                   4.8.0              pyhd3eb1b0_3  
pickleshare               0.7.5           pyhd3eb1b0_1003  
pip                       21.2.4           py39hecd8cb5_0  
prompt-toolkit            3.0.20             pyhd3eb1b0_0  
ptyprocess                0.7.0              pyhd3eb1b0_2  
pure_eval                 0.2.2              pyhd3eb1b0_0  
pygments                  2.11.2             pyhd3eb1b0_0  
pyparsing                 3.0.4              pyhd3eb1b0_0  
pyqt                      5.9.2            py39h23ab428_6  
python                    3.9.12               hdfd78df_0  
python-dateutil           2.8.2              pyhd3eb1b0_0  
pyzmq                     22.3.0           py39he9d5cce_2  
qt                        5.9.7                h468cd18_1  
qtconsole                 5.3.0              pyhd3eb1b0_0  
qtpy                      2.0.1              pyhd3eb1b0_0  
readline                  8.1.2                hca72f7f_1  
setuptools                61.2.0           py39hecd8cb5_0  
sip                       4.19.13          py39h23ab428_0  
six                       1.16.0             pyhd3eb1b0_1  
sqlite                    3.38.2               h707629a_0  
stack_data                0.2.0              pyhd3eb1b0_0  
tk                        8.6.11               h7bc2e8c_0  
tornado                   6.1              py39h9ed2024_0  
traitlets                 5.1.1              pyhd3eb1b0_0  
tzdata                    2022a                hda174b7_0  
wcwidth                   0.2.5              pyhd3eb1b0_0  
wheel                     0.37.1             pyhd3eb1b0_0  
xz                        5.2.5                h1de35cc_0  
zeromq                    4.3.4                h23ab428_0  
zlib                      1.2.12               h4dc903c_0  

Both environments are identical except for jupyter_client

I get the same error for jupyter_client=7.2.2 as well.

@blink1073
Copy link
Contributor

Great, thanks everyone. I'll take a closer look tomorrow.

@blink1073
Copy link
Contributor

It appears the week got away from me 😄. I'll return to this next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants