Open derekantrican opened 3 years ago
Unfortunately, this is hard to do. The plugin only has access to the tunnel that the plugin itself created. If a plugin is somehow "orphaned", it is no longer under the control of the plugin, so the plugin can not close it. I will look in to guiding the user to ways to close the tunnel via https://dashboard.ngrok.com
Last time I had this happen to me the ngrok dashboard didn't have an option to close the tunnel. I had to ssh into the pi and kill the process manually. What is preventing the plugin from killing an already-existing ngrok process?
The plugin starts an ngrok process; an external application. That ngrok process spawns a tunnel (or multiple tunnels, if the ngrok account allows it and the plugin would request it). Normally when OctoPrint is shut down, the plugin instructs the ngrok process to shut down, closing the tunnel. If somehow the ngrok process is not shut down, the plugin will start a new ngrok process because it has no access to the old process.
If you have a sure-fire way to orphan a tunnel process, let me know.
The functionality to close a tunnel process from the dashboard is in beta at ngrok.
Can you run terminal commands from the python extension? If so, I would just run killall ngrok
which would kill any currently running ngrok process
ngrok http 3000 --region us
This ngrok issue is getting me a headache... a moment I'm getting a solution...
In windows I killed the process from task manager and run ngrok http 8000
It worker for me.
ngrok http 3000 --region us
I didngrok http 3000 --region eu
This allowed me having more than 1 simultaneous client sessions
There seems to be some situations where restarting octoprint (or maybe other situations) does not kill/close the current ngrok session. If there is an error when trying to create a tunnel similar to "your account is limited to 1 simultaneous ngrok client sessions" then the plugin should kill the running ngrok process then try again.