0

I am trying to use Jupyter notebook via ssh remote connection. The connection and the notebook are working well for small jupyter notebook, but as I add more cells at my jupyter notebook, first it takes longer and longer to start to execute the cells when I press the execute button, and then eventually it disconnects and I need to retype my password every 20 seconds because it keeps disconnecting. I got the following errors/terminal output:

[15:46:43.714] Remote server is listening on 43791
[15:46:43.714] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":43791},"osReleaseId":"opensuse-leap","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/3012","platform":"linux","connectionToken":"aa11aaaa-1a11-1a11-a1a1-11111a1a1aa1"},"serverStartTime":147,"installUnpackCode":""}
[15:46:43.716] Starting forwarding server. localPort 59541 -> socksPort 52328 -> remotePort 43791
[15:46:43.718] Forwarding server listening on 59541
[15:46:43.718] Waiting for ssh tunnel to be ready
[15:46:43.722] Tunneled 43791 to local port 59541
[15:46:43.722] Resolved "ssh-remote+weller1" to "127.0.0.1:59541"
[15:46:43.723] [Forwarding server 59541] Got connection 0
[15:46:43.731] ------




[15:46:43.742] [Forwarding server 59541] Got connection 1
[15:46:43.988] [Forwarding server 59541] Got connection 2
[15:47:01.781] [Forwarding server 59541] Got connection 3
[15:47:01.782] [Forwarding server 59541] Got connection 4
[15:51:35.972] [Forwarding server 59541] Got connection 5
[15:52:28.188] [Forwarding server 59541] Got connection 6
[15:53:31.701] [Forwarding server 59541] Got connection 7
[15:54:04.297] [Forwarding server 59541] Got connection 8
[15:55:16.325] [Forwarding server 59541] Got connection 9
[15:58:21.682] ------




[15:58:21.683] SSH Resolver called for "ssh-remote+weller1", attempt 2, (Reconnection)
[15:58:21.683] SSH Resolver called for host: weller1
[15:58:21.683] Setting up SSH remote "weller1"
[15:58:21.687] Using commit id "7f6ab5485bbc008386c4386d08766667e155244e" and quality "stable" for server
[15:58:21.692] Install and start server if needed
[15:58:21.701] Running script with connection command: ssh -T -D 57477 weller1 bash
[15:58:21.705] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[15:58:22.047] > ]0;C:\WINDOWS\System32\cmd.exe
[15:58:22.048] Got some output, clearing connection timeout
[15:58:23.588] > Password: 
[15:58:23.588] Showing password prompt
[15:58:28.679] Got password response
[15:58:28.680] "install" wrote data to terminal: "*************"
[15:58:28.699] > 
[15:58:31.639] > Password: 
[15:58:31.640] Showing password prompt
[15:58:36.709] Got password response
[15:58:36.710] "install" wrote data to terminal: "**************"
[15:58:36.733] > 
[15:58:42.020] > Password: 
[

I tried to look at this stack overflow questions: VSCode Remote SSH Connection Failed but didn't understand how to fix my issue, I'm really new to vscode and ssh connection, I don't understand the steps that they are telling in the answers.. Could anyone help me please?

Apinorr
  • 166
  • 3
  • 14

2 Answers2

4

Had a similar issue, I didn't get disconnected but everything was extremely slow. After digging into it for a while found out that rendering images (especially high res ones) with plt.imshow makes my client upload a ton of stuff and it messes with my connection, even after the image has been rendered.

I figure it keeps uploading the whole notebook to the server every time I change or do something like execute a cell. Since I have a terrible upload speed it, needing to upload some MB's every time messes with my connection, making everything slow and unresponsive.

My solution was to clear the cell outputs of the rendered images.

I'm guessing the issue is that everytime something changes in the notebook, it needs to get uploaded as a whole for it to get updated. The images make the file some MB's large instead of some KB's and I suppose anything that can make the .ipynb file big will cause the same problem.

iolag
  • 41
  • 3
1

Could you try to increase the memory limitation of the remote machine(wsl or some others)?

Some people have run across the same issue. You can refer to here and here for more details.

Steven-MSFT
  • 7,438
  • 1
  • 5
  • 13
  • Thanks a lot for the reply, it's a good start !! However I tried to increase the memory limit according to the questions you linked me but it's not working... Do you maybe know how to increase the memory in VScode? I'm quite lost with the terminal, bash, VScode, WSL, Jupyter notebook etc... I don't where to type the stuff, I have no informatics background at all it's really hard to understand for me... :/ – Apinorr Sep 27 '21 at 14:45
  • I used this link https://hendisuhardja.medium.com/how-to-add-memory-limit-consumption-for-docker-vmmem-wsl2-db08b00edbf to increase my WSL memory limit and it seems to work a bit bit better but it still disconnects very often and takes a very long time to execute the cells... – Apinorr Sep 30 '21 at 13:00