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

How to Release a Port Being Listened by Viser in Jupyter Without Restarting the Kernel #311

Closed
JintaoLee-Roger opened this issue Nov 1, 2024 · 2 comments

Comments

@JintaoLee-Roger
Copy link

Hi,

I have been using Viser in Jupyter notebooks and encountered an issue related to port management:

When I run a Viser program, it starts the server on http://0.0.0.0:8080 by default. If that port is occupied, it switches to 8081, and so on. However, when I interrupt the notebook, it seems that the original port (e.g., 8080) isn’t released properly, so running the cell again results in the use of the next available port (e.g., 8081).

Is there a way to explicitly release or close the listening state of the port (e.g., 8080) without needing to kill the entire Python kernel or restart the Jupyter environment? I am looking for a method that can programmatically clean up and release the port, ensuring that the original port can be reused in subsequent runs.

Any guidance or suggestions on how to manage port cleanup in such cases would be highly appreciated!

Thank you for your help!

@JintaoLee-Roger
Copy link
Author

This question should be repeated, see #310

@brentyi
Copy link
Collaborator

brentyi commented Nov 2, 2024

To free up the port more generally there's also a ViserServer.stop() method, but it looks like this is actually broken in the recent releases. I have a fix in #313.

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

No branches or pull requests

2 participants