mirror of
https://github.com/fosrl/newt.git
synced 2026-07-15 21:16:40 -05:00
[GH-ISSUE #7] Newt doesn't automatically reconnect to Pangolin if Pangolin is restarted #8603
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).
Original GitHub issue: https://github.com/fosrl/newt/issues/7
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.
@Snocember commented on GitHub (May 10, 2026):
I also have this issue for a while now.
Reproducible on:
Pangolin host:
linux/arm64
Rocky Linux 10.1 (6.12.0-124.52.1.el10_1.aarch64)
podman version 5.6.0
fosrl/pangolin:latest (1.18.3, sha256:94e04ae48eec8a2f2c9925f1f12b8016abe5093f41f6f9829a0fca98e06b7fe0)
Newt client:
linux/amd64
Debian 12.3 (6.1.0-45-amd64) and Rocky Linux 9.7 (5.14.0-611.54.1.el9_7.x86_64)
Docker version 29.4.3, build 055a478
fosrl/newt:latest (sha256:881cd45911cc8a8e5f347edf4a7a278fb93f337af8e588b94f9042465d81c891)
Steps to reproduce:
podman compose downandup -dist usedAll routes to the sites connected with newt now show "Bad Gateway".
When restarting the newt client, the problem resolves.
Logs
Newt client:
After pangolin server restart:
Same time with only INFO enabled I encountered also an error:
Pangolin host:
When newt is restarted:
@oschwartz10612 commented on GitHub (May 11, 2026):
Could you try the latest newt? Some improvements were made.
@wkulhanek commented on GitHub (May 11, 2026):
Unless they were in the very latest tag I still see this behavior if my pangolin is offline for too long.
@Snocember commented on GitHub (May 12, 2026):
Yup, seems to be resolved on pangolin 1.18.3 and newt 1.12.5.
I tested it with a downtime of like 30 seconds.
Great work, keep it up. (:
@Snocember commented on GitHub (May 29, 2026):
I upgraded from pangolin 1.18.3 (with weeks uptime) to 1.18.4 with compose down and up and newt 1.12.5
The issue resurfaced and newt doesn't catch up.
DEBUG similar as the log last post.
however after that with fresh started pangolin and restarted newt, when starting and stopping pangolin from the same version it reconnects
@oschwartz10612 commented on GitHub (May 29, 2026):
Ahh yeah what I think is happening here is it cant talk to the server so
the SendMessageInterval for newt/ping/request times out because the
server does not respond.
This was brought up on the original thread when we discussed this but I
did not have a good solution. Let me revisit this. Basically because the
server is down it does not recover.