Cannot open a notebook until I list them with "jupyter notebook list"


I run into a strange behaviour I don’t understand. Our jupyter notebook servers run on a VM and we connect to them through our desktop computers. They’re all running but every time I start my computer, I cannot connect to them (ERR_CONNECTION_REFUSED). Now, when I open a session on the VM and run the command “jupyter notebook list” which is only supposed to list running servers, then I can connect to them! Can someone explain me what’s happening?


That’s very strange indeed!

jupyter notebook list launches NbserverListApp which mostly calls list_running_servers, which does only 2 things:

  1. parse JSON files
  2. check if a PID is running

So it is strange that this would cause things to be responsive. My guess is that it’s a coincidence.

How is it that you try to connect to the servers and how is it that you create the session to call jupyter notebook list? And how do you launch the servers in the VM? Is it possible that it’s establishing the shell conenction itself that gets things working? What do things like ps aux get you in the VM while it’s not working, or lsof -i? Can you make requests to the servers from within the VM, e.g. with curl?

Thanks for your reply. Well, I can reproduce this behaviour everytime.

The connection to the VM is initiated through a SSH tunnel by VSCode, which also runs a Shell terminal. I suspect VSCode to do something behind the hood, such as opening TCP ports when I run the command… I’m not the one who starts the jupyter servers, they’re running 24 hours a day. I can try to list the processes, but how do I find them? Could you give me the appropriate command? Same with curl.