spyder icon indicating copy to clipboard operation
spyder copied to clipboard

Spyder crash when turning on/reconnecting a VPN

Open ifariasg opened this issue 5 years ago • 11 comments

Problem Description

While having a VPN, if I lose connection or manually reconnect spyder crashes with no error message. In my case, the VPN is Windscribe connected to the closest possible node. Turning the VPN off while having Spyder open does not generate a crash.

What steps reproduce the problem?

  1. Open Spyder
  2. Turn on VPN
  3. Crash

Versions

  • Spyder version: 4.1.5 None
  • Python version: 3.8.5 64-bit
  • Qt version: 5.12.5
  • PyQt5 version: 5.12.3
  • Operating System: Windows 10

Dependencies


# Mandatory:
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.6.0 (OK)
diff_match_patch >=20181111    :  20200713 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.18.1 (OK)
jedi =0.17.1                   :  0.17.1 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  1.1.0 (OK)
paramiko >=2.4.0               :  2.7.2 (OK)
parso =0.7.0                   :  0.7.0 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.2 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=1.0                   :  2.6.0 (OK)
pyls >=0.34.0;<1.0.0           :  0.34.1 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  1.0.1 (OK)
qtconsole >=4.6.0              :  4.7.7 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.2.1 (OK)
spyder_kernels >=1.9.4;<1.10.0 :  1.9.4 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  19.0.2 (OK)

# Optional:
cython >=0.21                  :  None (OK)
matplotlib >=2.0.0             :  3.3.2 (OK)
numpy >=1.7                    :  1.19.1 (OK)
pandas >=0.13.1                :  1.1.2 (OK)
scipy >=0.17.0                 :  1.5.0 (OK)
sympy >=0.7.3                  :  None (OK)

ifariasg avatar Dec 02 '20 16:12 ifariasg

Hi @ifariasg sorry to hear that, if the crash is related with the VPN being on or reconnecting maybe the issue is caused by the VPN closing some connection to the LSP. Is there a way for your VPN config to exclude localhost/127.0.0.1 address to prevent connection interruptions? Also, maybe running from the Anaconda prompt spyder --debug-info verbose could give us some useful info about the error and if there is something we can do from the Spyder side.

Any new info is greatly appreciated :)

dalthviz avatar Dec 02 '20 17:12 dalthviz

Ok, so when starting spyder from the command prompt with the VPN ON this occurs. Spyder works perfect in this case but indeed something related with the localhost seems to occur and Kite?

2020-12-03 04:04:01,984 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 0 Got response from kite
2020-12-03 04:04:01,984 [DEBUG] [spyder.plugins.completion.kite.client] -> Perform request textDocument/didOpen with id 1
2020-12-03 04:04:01,986 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (4): 127.0.0.1:46624
2020-12-03 04:04:04,025 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (5): 127.0.0.1:46624
2020-12-03 04:04:06,057 [DEBUG] [spyder.plugins.completion.kite.client] -> Perform request textDocument/didOpen with id 2
2020-12-03 04:04:06,057 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 1 Got response from kite
2020-12-03 04:04:06,058 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (6): 127.0.0.1:46624
2020-12-03 04:04:08,095 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (7): 127.0.0.1:46624
2020-12-03 04:04:10,135 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 2 Got response from kite
2020-12-03 04:04:10,135 [DEBUG] [spyder.plugins.completion.kite.client] -> Perform request textDocument/didOpen with id 5
2020-12-03 04:04:10,135 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 3 Got response from kite
2020-12-03 04:04:10,137 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 4 Got response from kite
2020-12-03 04:04:10,137 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (8): 127.0.0.1:46624
2020-12-03 04:04:12,171 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (9): 127.0.0.1:46624
2020-12-03 04:04:14,214 [DEBUG] [spyder.plugins.completion.kite.client] -> Perform request textDocument/didOpen with id 6
2020-12-03 04:04:14,214 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 5 Got response from kite
2020-12-03 04:04:14,216 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (10): 127.0.0.1:46624
2020-12-03 04:04:16,250 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (11): 127.0.0.1:46624
2020-12-03 04:04:18,293 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 6 Got response from kite
2020-12-03 04:04:18,294 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (12): 127.0.0.1:46624
2020-12-03 04:04:18,294 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 7 Got response from kite
2020-12-03 04:04:18,295 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 8 Got response from kite
2020-12-03 04:04:20,335 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 9 Got response from kite
2020-12-03 04:04:20,336 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 10 Got response from kite
2020-12-03 04:04:20,336 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 11 Got response from kite
2020-12-03 04:04:20,336 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (13): 127.0.0.1:46624
2020-12-03 04:04:20,337 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 12 Got response from kite
2020-12-03 04:04:20,337 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 13 Got response from kite
2020-12-03 04:04:20,337 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 14 Got response from kite
2020-12-03 04:04:54,319 [DEBUG] [spyder.plugins.editor.utils.autosave] -> Autosave triggered

Now, I switch off the VPN and then on to force a crash, this happens:

Assertion failed: Connection reset by peer [10054] (D:\bld\zeromq_1594387071337\work\src\signaler.cpp:368)
Assertion failed: Connection reset by peer [10054] (D:\bld\zeromq_1594387071337\work\src\signaler.cpp:368)
Assertion failed: Connection reset by peer [10054] (D:\bld\zeromq_1594387071337\work\src\signaler.cpp:368)
Assertion failed: Connection reset by peer [10054] (D:\bld\zeromq_1594387071337\work\src\signaler.cpp:368)
Assertion failed: Connection reset by peer [10054] (D:\bld\zeromq_1594387071337\work\src\signaler.cpp:368)
Assertion failed: Connection reset by peer [10054] (D:\bld\zeromq_1594387071337\work\src\signaler.cpp:368)
Assertion failed: Connection reset by peer [10054] (D:\bld\zeromq_1594387071337\work\src\signaler.cpp:368)
2020-12-03 04:08:43,430 [ERROR] [asyncio] -> Exception in callback BaseSelectorEventLoop._read_from_self()
handle: <Handle BaseSelectorEventLoop._read_from_self()>
Traceback (most recent call last):
  File "C:\Users\Fari\.conda\envs\pcrglob_imod\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Fari\.conda\envs\pcrglob_imod\lib\asyncio\selector_events.py", line 120, in _read_from_self
    data = self._ssock.recv(4096)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
2020-12-03 04:08:43,438 [ERROR] [asyncio] -> Exception in callback BaseSelectorEventLoop._read_from_self()
handle: <Handle BaseSelectorEventLoop._read_from_self()>
Traceback (most recent call last):
  File "C:\Users\Fari\.conda\envs\pcrglob_imod\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Fari\.conda\envs\pcrglob_imod\lib\asyncio\selector_events.py", line 120, in _read_from_self
    data = self._ssock.recv(4096)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
Assertion failed: Connection reset by peer [10054] (D:\bld\zeromq_1594387071337\work\src\signaler.cpp:368)

ifariasg avatar Dec 03 '20 03:12 ifariasg

Follow up, found a workaround by not allowing the VPN to close TCP connections after a connection/reconnection. Far from ideal as it defeats the purpose of a VPN but it works atleast.

ifariasg avatar Dec 03 '20 03:12 ifariasg

https://github.com/zeromq/libzmq/issues/1808

novaya avatar Dec 03 '20 07:12 novaya

Thanks @novaya for pointing that out, I was about to do the same.

@ifariasg, could you run

conda install pyzmq=20

in your environment, revert the changes you did to your VPN client and try again?

That could solve the problem (not really sure from reading that issue though).

ccordoba12 avatar Dec 03 '20 15:12 ccordoba12

Thanks @novaya for pointing that out, I was about to do the same.

@ifariasg, could you run

conda install pyzmq=20

in your environment, revert the changes you did to your VPN client and try again?

That could solve the problem (not really sure from reading that issue though).

@ccordoba12 for some reason I can't even update/install that package.

ifariasg avatar Dec 03 '20 17:12 ifariasg

Could you post the errors you're getting? That package became available a few days ago.

ccordoba12 avatar Dec 03 '20 17:12 ccordoba12

@ccordoba12 endless loop of

(pcrglob_imod) C:\Users\Fari>conda install pyzmq=20
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.

Also when trying to update directly from anaconda navigator, even though it shows a package available, it shows as "up to date" when trying to install.

ifariasg avatar Dec 03 '20 17:12 ifariasg

Ok, it seems you need to create a new environment for that:

conda create -n vpn-issue python=3.8 pyzmq=20 spyder

ccordoba12 avatar Dec 03 '20 18:12 ccordoba12

Ok, it seems you need to create a new environment for that:

conda create -n vpn-issue python=3.8 pyzmq=20 spyder

Ok, did this and could install the package. Reverted the VPN changes and repeated the process of my original post. Spyder no longer crashes but the console shows that there is still something wrong as I get an infinite loop of:

Exception in callback BaseSelectorEventLoop._read_from_self()
handle: <Handle BaseSelectorEventLoop._read_from_self()>
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\vpn-issue\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "C:\ProgramData\Anaconda3\envs\vpn-issue\lib\asyncio\selector_events.py", line 120, in _read_from_self
    data = self._ssock.recv(4096)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
Exception in callback BaseSelectorEventLoop._read_from_self()
handle: <Handle BaseSelectorEventLoop._read_from_self()>
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\vpn-issue\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "C:\ProgramData\Anaconda3\envs\vpn-issue\lib\asyncio\selector_events.py", line 120, in _read_from_self
    data = self._ssock.recv(4096)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
Exception in callback BaseSelectorEventLoop._read_from_self()
handle: <Handle BaseSelectorEventLoop._read_from_self()>
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\vpn-issue\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "C:\ProgramData\Anaconda3\envs\vpn-issue\lib\asyncio\selector_events.py", line 120, in _read_from_self
    data = self._ssock.recv(4096)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

And when I say infinite I mean it, its generating 1-4 errors per millisecond of excecution.

ifariasg avatar Dec 04 '20 18:12 ifariasg

Spyder no longer crashes

Ok, those are good news (hard crashes are the worst).

but the console shows that there is still something wrong as I get an infinite loop of

Ok, that means the ports we use need to be changed from tcp to ipc. However, that's not something we control but it depends on some projects maintained by the Jupyter team. So I don't know when/if it's going to be addressed by them.

ccordoba12 avatar Dec 04 '20 20:12 ccordoba12