mirror of
https://github.com/fosrl/newt.git
synced 2026-03-09 07:12:28 -05:00
Newt doesn't automatically reconnect to Pangolin if Pangolin is restarted #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @wkulhanek on GitHub (Jan 23, 2025).
Originally assigned to: @oschwartz10612 on GitHub.
It appears that Newt doesn't automatically reconnect to Pangolin if Pangolin is restarted.
I have a Pangolin on a public cloud instance. That public cloud instance has a Newt instance as well. And then I have Newt instance on my private (homelab) machine. Whenever the public cloud instance gets restarted (or even if just the Pangolin service is restarted) I get a "Bad Gateway" when I try to access resources on my homelab. Restarting Newt fixes this.
It would be great if Newt would recognize that Pangolin got restarted and somehow reconnect to the Pangolin instance.
For reference here is my Newt system service (on Fedora Server 41):
@oschwartz10612 commented on GitHub (Jan 25, 2025):
Hi!
I think right now there is logic in Newt that should allow it to reconnect after Gerbil or Pangolin is restarted. I just tested and was able to see this working on my instance.
Could you please try to reproduce the issue and provide logs from Newt from when it can not reconnect? You can use the LOG_LEVEL env var to set to DEBUG to get more detail.
@wkulhanek commented on GitHub (Jan 26, 2025):
I did a few more tests. A
systemctl restart pangolinon the cloud instance killed the newt instance on the cloud instance - which could be because the newt service has a dependency on the pangolin service. The newt instance in my homelab did in fact re-connect successfully.So then I just tried rebooting the cloud instance. That brought pangolin and newt back up on the cloud instance - but the newt instance in my homelab never reconnected. The logs say it attempted to ping the pangolin server 5 times and then it gave up. I guess it needs to keep trying? Any attempt to access a web site behind the newt service in my homelab then ends with "Bad Gateway"
@oschwartz10612 commented on GitHub (Jan 26, 2025):
I am just curious why you have Newt on the cloud instance with Pangolin? Are you trying to proxy to stuff on the VPS itself? If so, you can use "local" sites.
Yep that seems like it! It can handle a short downtime but a longer one means it stops pinging. I will make this change in the next Newt release!
@wkulhanek commented on GitHub (Jan 26, 2025):
My cloud instance is doing double duty as a Pangolin server - but it also has Nextcloud and a few other services on it. I had used Cloudflare tunnels before switching to Pangolin to access these sites. I didn't realize that I don't need Newt for that. :-)
@jibsaram commented on GitHub (Feb 4, 2025):
I'm seeing the same problem with a Newt docker container on one device being unable to reconnect to Pangolin running on another machine (and network), after I updated-and-restarted the Pangolin container from beta 10 to 11.
The Newt container is just showing the same log message over and over:
I am able to ping
<<domain>>just fine from the host machine that's running the Newt container, and cancurlthe URL in question too (I just did a basic GET request that returned a JSON object with "unauthorized" error message, as expected). I could not test this from within the Newt container as it does not haveping/curl/wget.Restarting the Newt container on its own did not help, though when I made the entire docker compose stack go
downthenupagain, it did successfully reconnect to Pangolin. I am not sure if it was due to the down/up step or something else, but thought I'd mention it just in case.Just to see if I could reproduce this I just tried restarting the Pangolin service twice (sans updating, as it's already up-to-date), but the Newt instance was able to successfully reconnect both times. So I'm not quite sure yet what the pattern might be. I did notice that both times it reconnected fine, the first two ping attempts consistently failed. I don't know if this is at all relevant/useful, but I thought I'd mention it just in case.
Please let me know if there is anything more I can provide. Thanks!
Update: Updated from beta 11 to 12 just now whilst following logs of the newt instance and pangolin both, it worked fine and the newt instance automatically reconnected just fine. At least from my end it doesn't appear to be post-upgrade specific behavior. I hope this helps!
@miloschwartz commented on GitHub (Mar 16, 2025):
Closing because we cannot reproduce. Please add to this issue in the future if it's still a problem.
@wkulhanek commented on GitHub (Mar 21, 2025):
@miloschwartz I don't understand - I just had this again. Reboot my cloud instance, local newt tries to reconnect 5 times and then gives up. This is not hard to reproduce.
@oschwartz10612 commented on GitHub (Mar 21, 2025):
Increased the ping to 15 in 9d80161. Will release soon - might help. Let us know.