-
Notifications
You must be signed in to change notification settings - Fork 57
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
"localhost refused to connect" for some files #74
Comments
Same problem here (Win10, Python 3.8.6). Did work yesterday, stopped working today. Didn't notice any updates being installed. If I run "nbopen filename" in shell or double click in explorer, the browser opens (so something happens), but then there is no python.exe or pythonw.exe running. So the webservice immediately stopped, leading to such message (connection refused etc.). Quick test with some notebook in another folder: Does open, pythonw.exe stays running. Quick test deleting checkpoints folder within the problematic folder: Did not help. What else is there folder related? Quick test moving all else outside problem folder (maybe created files with too long names or spaces while webservise was running fine yesterday): Problem still exists. Quick test copying problematic notebook to a new folder: Problem still exists. |
nbopen looks for an existing notebook server running on the directory containing the notebook (or any parent directory), and only opens a new server if it can't find one. But if a server has crashed, it may think that one still exists (potentially even after a restart). You can see the list of notebook servers it thinks are running by running |
As suddenly as it did appear, it also went away. No problems if I try today. If it reappesars one might try to check Every system has hickups like this every now and then. I don't think this is a nbopen issue. |
IIRC, the code in Jupyter checks the process ID of servers from those saved JSON files. So if there's another process now using the same PID, Nbopen thinks the notebook server is still running, and tries to use it. If that PID happens not to be in use, it realises the file is a leftover and deletes it. So it resolves itself eventually, but not predictably. I guess nbopen could try to make an HTTP request to the server to check it's there before opening a notebook with it. That would slightly delay opening a notebook with an existing server, but avoid most cases like this where it tries to use a server that's no longer there. |
This seems to be a really rare problem. Although I wouldn't mind a slighly slower but more stable start, others might prefer speed. Maybe a cmd parameter like From what you explained, I could fix it manually today, but maybe not in a few months when it happens again and I don't immediately find this issue to refresh my knowledge :D |
I'll leave this open and might get round to addressing it over Christmas. I might make it optional, depending on how long the check takes, but I'm inclined to make the slower, more robust option the default (i.e. opt out of the extra check, not opt in), because users shouldn't have to know about it if they don't want to. Hopefully it will just be a small fraction of a second.
That kind of solution sounds tempting, but software that does different things based on the time and what you did before can be confusing. 😉 If the check is slow enough to be a problem before opening the notebook, one option would be to check after opening it, and delete the nbserver json file if it's invalid, so it doesn't have the same problem next time - still a bit mysterious, but simpler than something involving time. But 🤞 it's quick enough that checking before opening the browser is easy. |
I can open all my files using
jupyter notebook
by opening it throughcmd
but SOME FILES are leading to this error of "localhost refused to connect" when I double-click on them, while others are opening fine using double-click.Please help. It is very inconvenient.
Edit: It seems to be only happening to all the files in a specific folder.
The text was updated successfully, but these errors were encountered: