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):
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):
```
[Unit]
Description=newt Container Service
Wants=network.target
After=pangolin.service
Requires=pangolin.service
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
ExecStartPre=-/usr/bin/podman rm -f newt
ExecStartPre=/bin/sleep 15
ExecStart=/usr/bin/podman run --name newt \
--rm \
--label "io.containers.autoupdate=image" \
--user 1501:100 \
--env NEWT_ID=<redacted> \
--env NEWT_SECRET=<redacted> \
--env PANGOLIN_ENDPOINT=<redacted> \
docker.io/fosrl/newt:latest
ExecStop=/usr/bin/podman rm -f newt
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=newt
[Install]
WantedBy=multi-user.target default.target
```
GiteaMirror
added the bug label 2026-07-13 14:34:55 -05:00
@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.
<!-- gh-comment-id:2614036503 -->
@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.
I did a few more tests. A systemctl restart pangolin on 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"
INFO: 2025/01/25 12:51:18 Started tcp proxy from 100.89.128.8:62587 to 192.168.2.210:9000
ERROR: 2025/01/26 13:36:18 Ping failed: use of closed network connection
INFO: 2025/01/26 13:36:18 Sent registration message
INFO: 2025/01/26 13:36:18 Received registration message
INFO: 2025/01/26 13:36:18 Already connected! But I will send a ping anyway...
INFO: 2025/01/26 13:36:18 Ping attempt 1 of 5
INFO: 2025/01/26 13:36:18 Pinging 100.89.128.1
WARN: 2025/01/26 13:36:28 Ping attempt 1 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/01/26 13:36:30 Ping attempt 2 of 5
INFO: 2025/01/26 13:36:30 Pinging 100.89.128.1
INFO: 2025/01/26 13:36:30 Ping latency: 35.659279ms
ERROR: 2025/01/26 14:04:48 Ping failed: use of closed network connection
ERROR: 2025/01/26 14:05:08 Failed to connect: failed to get token: failed to request new token: Post "https://<redacted>/api/v1/auth/newt/get-token": dial tcp <redacted>:443: connect: connection refused. Retrying in 10s...
ERROR: 2025/01/26 14:05:18 Failed to connect: failed to get token: failed to request new token: Post "https://<redacted>/api/v1/auth/newt/get-token": dial tcp <redacted>:443: connect: connection refused. Retrying in 10s...
INFO: 2025/01/26 14:05:28 Sent registration message
INFO: 2025/01/26 14:05:29 Received registration message
INFO: 2025/01/26 14:05:29 Already connected! But I will send a ping anyway...
INFO: 2025/01/26 14:05:29 Ping attempt 1 of 5
INFO: 2025/01/26 14:05:29 Pinging 100.89.128.1
WARN: 2025/01/26 14:05:39 Ping attempt 1 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/01/26 14:05:41 Ping attempt 2 of 5
INFO: 2025/01/26 14:05:41 Pinging 100.89.128.1
WARN: 2025/01/26 14:05:51 Ping attempt 2 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/01/26 14:05:53 Ping attempt 3 of 5
INFO: 2025/01/26 14:05:53 Pinging 100.89.128.1
WARN: 2025/01/26 14:06:03 Ping attempt 3 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/01/26 14:06:05 Ping attempt 4 of 5
INFO: 2025/01/26 14:06:05 Pinging 100.89.128.1
WARN: 2025/01/26 14:06:15 Ping attempt 4 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/01/26 14:06:17 Ping attempt 5 of 5
INFO: 2025/01/26 14:06:17 Pinging 100.89.128.1
WARN: 2025/01/26 14:06:27 Ping attempt 5 failed: failed to read ICMP packet: i/o timeout
WARN: 2025/01/26 14:06:27 Failed to ping 100.89.128.1: all ping attempts failed after 5 tries, last error: failed to read ICMP packet: i/o timeout
WARN: 2025/01/26 14:06:27 HINT: Do you have UDP port 51280 (or the port in config.yml) open on your Pangolin server?
<!-- gh-comment-id:2614442235 -->
@wkulhanek commented on GitHub (Jan 26, 2025):
I did a few more tests. A `systemctl restart pangolin` on 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"
```
INFO: 2025/01/25 12:51:18 Started tcp proxy from 100.89.128.8:62587 to 192.168.2.210:9000
ERROR: 2025/01/26 13:36:18 Ping failed: use of closed network connection
INFO: 2025/01/26 13:36:18 Sent registration message
INFO: 2025/01/26 13:36:18 Received registration message
INFO: 2025/01/26 13:36:18 Already connected! But I will send a ping anyway...
INFO: 2025/01/26 13:36:18 Ping attempt 1 of 5
INFO: 2025/01/26 13:36:18 Pinging 100.89.128.1
WARN: 2025/01/26 13:36:28 Ping attempt 1 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/01/26 13:36:30 Ping attempt 2 of 5
INFO: 2025/01/26 13:36:30 Pinging 100.89.128.1
INFO: 2025/01/26 13:36:30 Ping latency: 35.659279ms
ERROR: 2025/01/26 14:04:48 Ping failed: use of closed network connection
ERROR: 2025/01/26 14:05:08 Failed to connect: failed to get token: failed to request new token: Post "https://<redacted>/api/v1/auth/newt/get-token": dial tcp <redacted>:443: connect: connection refused. Retrying in 10s...
ERROR: 2025/01/26 14:05:18 Failed to connect: failed to get token: failed to request new token: Post "https://<redacted>/api/v1/auth/newt/get-token": dial tcp <redacted>:443: connect: connection refused. Retrying in 10s...
INFO: 2025/01/26 14:05:28 Sent registration message
INFO: 2025/01/26 14:05:29 Received registration message
INFO: 2025/01/26 14:05:29 Already connected! But I will send a ping anyway...
INFO: 2025/01/26 14:05:29 Ping attempt 1 of 5
INFO: 2025/01/26 14:05:29 Pinging 100.89.128.1
WARN: 2025/01/26 14:05:39 Ping attempt 1 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/01/26 14:05:41 Ping attempt 2 of 5
INFO: 2025/01/26 14:05:41 Pinging 100.89.128.1
WARN: 2025/01/26 14:05:51 Ping attempt 2 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/01/26 14:05:53 Ping attempt 3 of 5
INFO: 2025/01/26 14:05:53 Pinging 100.89.128.1
WARN: 2025/01/26 14:06:03 Ping attempt 3 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/01/26 14:06:05 Ping attempt 4 of 5
INFO: 2025/01/26 14:06:05 Pinging 100.89.128.1
WARN: 2025/01/26 14:06:15 Ping attempt 4 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/01/26 14:06:17 Ping attempt 5 of 5
INFO: 2025/01/26 14:06:17 Pinging 100.89.128.1
WARN: 2025/01/26 14:06:27 Ping attempt 5 failed: failed to read ICMP packet: i/o timeout
WARN: 2025/01/26 14:06:27 Failed to ping 100.89.128.1: all ping attempts failed after 5 tries, last error: failed to read ICMP packet: i/o timeout
WARN: 2025/01/26 14:06:27 HINT: Do you have UDP port 51280 (or the port in config.yml) open on your Pangolin server?
```
@oschwartz10612 commented on GitHub (Jan 26, 2025):
on the cloud instance killed the newt instance on the cloud instance
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.
The logs say it attempted to ping the pangolin server 5 times and then it gave up. I guess it needs to keep trying?
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!
<!-- gh-comment-id:2614459101 -->
@oschwartz10612 commented on GitHub (Jan 26, 2025):
> on the cloud instance killed the newt instance on the cloud instance
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](https://docs.fossorial.io/Pangolin/without-tunneling).
> The logs say it attempted to ping the pangolin server 5 times and then it gave up. I guess it needs to keep trying?
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!
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. :-)
<!-- gh-comment-id:2614460278 -->
@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. :-)
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:
newt | ERROR: 2025/02/04 01:42:31 Failed to connect: failed to get token: failed to request new token: Post "https://<<domain>>/api/v1/auth/newt/get-token": dial tcp <<ip>>:443: connect: connection refused. Retrying in 10s...
newt | ERROR: 2025/02/04 01:42:41 Failed to connect: failed to get token: failed to request new token: Post "https://<<domain>>/api/v1/auth/newt/get-token": dial tcp <<ip>>:443: connect: connection refused. Retrying in 10s...
newt | ERROR: 2025/02/04 01:42:51 Failed to connect: failed to get token: failed to request new token: Post "https://<<domain>>/api/v1/auth/newt/get-token": dial tcp <<ip>>:443: connect: connection refused. Retrying in 10s...
I am able to ping <<domain>> just fine from the host machine that's running the Newt container, and can curl the 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 have ping/curl/wget.
Restarting the Newt container on its own did not help, though when I made the entire docker compose stack go down then up again, 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!
<!-- gh-comment-id:2632958472 -->
@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:
```log
newt | ERROR: 2025/02/04 01:42:31 Failed to connect: failed to get token: failed to request new token: Post "https://<<domain>>/api/v1/auth/newt/get-token": dial tcp <<ip>>:443: connect: connection refused. Retrying in 10s...
newt | ERROR: 2025/02/04 01:42:41 Failed to connect: failed to get token: failed to request new token: Post "https://<<domain>>/api/v1/auth/newt/get-token": dial tcp <<ip>>:443: connect: connection refused. Retrying in 10s...
newt | ERROR: 2025/02/04 01:42:51 Failed to connect: failed to get token: failed to request new token: Post "https://<<domain>>/api/v1/auth/newt/get-token": dial tcp <<ip>>:443: connect: connection refused. Retrying in 10s...
```
I am able to ping `<<domain>>` just fine from the host machine that's running the Newt container, and can `curl` the 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 have `ping`/`curl`/`wget`.
Restarting the Newt container on its own did not help, though when I made the entire docker compose stack go `down` then `up` again, 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.
```log
(...snip...)
newt | ERROR: 2025/02/04 06:00:27 Ping failed: use of closed network connection
newt | INFO: 2025/02/04 06:00:27 Sent registration message
newt | INFO: 2025/02/04 06:00:27 Received registration message
newt | INFO: 2025/02/04 06:00:27 Already connected! But I will send a ping anyway...
newt | INFO: 2025/02/04 06:00:27 Ping attempt 1 of 5
newt | INFO: 2025/02/04 06:00:27 Pinging 100.89.128.1
newt | WARN: 2025/02/04 06:00:37 Ping attempt 1 failed: failed to read ICMP packet: i/o timeout
newt | INFO: 2025/02/04 06:00:39 Ping attempt 2 of 5
newt | INFO: 2025/02/04 06:00:39 Pinging 100.89.128.1
newt | WARN: 2025/02/04 06:00:49 Ping attempt 2 failed: failed to read ICMP packet: i/o timeout
newt | INFO: 2025/02/04 06:00:51 Ping attempt 3 of 5
newt | INFO: 2025/02/04 06:00:51 Pinging 100.89.128.1
newt | INFO: 2025/02/04 06:00:51 Ping latency: 4.604098ms
```
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!
Closing because we cannot reproduce. Please add to this issue in the future if it's still a problem.
<!-- gh-comment-id:2727643194 -->
@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.
@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.
INFO: 2025/03/20 15:12:26 Started tcp proxy from 100.89.128.12:41618 to 192.168.2.101:8040
ERROR: 2025/03/21 09:53:56 Ping failed: use of closed network connection
ERROR: 2025/03/21 09:54:07 Failed to connect: failed to get token: failed to request new token: Post "https://<redacted>/api/v1/auth/newt/get-token": dial tcp <redacted>:443: connect: connection refused. Retrying in 10s...
ERROR: 2025/03/21 09:54:17 Failed to connect: failed to get token: failed to request new token: Post "https://<redacted>/api/v1/auth/newt/get-token": dial tcp <redacted>:443: connect: connection refused. Retrying in 10s...
ERROR: 2025/03/21 09:54:27 Failed to connect: failed to get token: failed to request new token: Post "https://<redacted>/api/v1/auth/newt/get-token": dial tcp <redacted>:443: connect: connection refused. Retrying in 10s...
ERROR: 2025/03/21 09:54:39 Failed to save config: open /.config/newt-client/config.json: no such file or directory
2025/03/21 09:54:39 Failed to create config directory: mkdir /.config: permission denied
INFO: 2025/03/21 09:54:39 Sent registration message
INFO: 2025/03/21 09:54:39 Received registration message
INFO: 2025/03/21 09:54:39 Already connected! But I will send a ping anyway...
INFO: 2025/03/21 09:54:39 Ping attempt 1 of 5
INFO: 2025/03/21 09:54:39 Pinging 100.89.128.1
WARN: 2025/03/21 09:54:49 Ping attempt 1 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/03/21 09:54:51 Ping attempt 2 of 5
INFO: 2025/03/21 09:54:51 Pinging 100.89.128.1
WARN: 2025/03/21 09:55:01 Ping attempt 2 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/03/21 09:55:03 Ping attempt 3 of 5
INFO: 2025/03/21 09:55:03 Pinging 100.89.128.1
WARN: 2025/03/21 09:55:13 Ping attempt 3 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/03/21 09:55:15 Ping attempt 4 of 5
INFO: 2025/03/21 09:55:15 Pinging 100.89.128.1
WARN: 2025/03/21 09:55:25 Ping attempt 4 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/03/21 09:55:27 Ping attempt 5 of 5
INFO: 2025/03/21 09:55:27 Pinging 100.89.128.1
WARN: 2025/03/21 09:55:37 Ping attempt 5 failed: failed to read ICMP packet: i/o timeout
WARN: 2025/03/21 09:55:37 Failed to ping 100.89.128.1: all ping attempts failed after 5 tries, last error: failed to read ICMP packet: i/o timeout
WARN: 2025/03/21 09:55:37 HINT: Do you have UDP port 51820 (or the port in config.yml) open on your Pangolin server?
<!-- gh-comment-id:2742884977 -->
@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.
```
INFO: 2025/03/20 15:12:26 Started tcp proxy from 100.89.128.12:41618 to 192.168.2.101:8040
ERROR: 2025/03/21 09:53:56 Ping failed: use of closed network connection
ERROR: 2025/03/21 09:54:07 Failed to connect: failed to get token: failed to request new token: Post "https://<redacted>/api/v1/auth/newt/get-token": dial tcp <redacted>:443: connect: connection refused. Retrying in 10s...
ERROR: 2025/03/21 09:54:17 Failed to connect: failed to get token: failed to request new token: Post "https://<redacted>/api/v1/auth/newt/get-token": dial tcp <redacted>:443: connect: connection refused. Retrying in 10s...
ERROR: 2025/03/21 09:54:27 Failed to connect: failed to get token: failed to request new token: Post "https://<redacted>/api/v1/auth/newt/get-token": dial tcp <redacted>:443: connect: connection refused. Retrying in 10s...
ERROR: 2025/03/21 09:54:39 Failed to save config: open /.config/newt-client/config.json: no such file or directory
2025/03/21 09:54:39 Failed to create config directory: mkdir /.config: permission denied
INFO: 2025/03/21 09:54:39 Sent registration message
INFO: 2025/03/21 09:54:39 Received registration message
INFO: 2025/03/21 09:54:39 Already connected! But I will send a ping anyway...
INFO: 2025/03/21 09:54:39 Ping attempt 1 of 5
INFO: 2025/03/21 09:54:39 Pinging 100.89.128.1
WARN: 2025/03/21 09:54:49 Ping attempt 1 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/03/21 09:54:51 Ping attempt 2 of 5
INFO: 2025/03/21 09:54:51 Pinging 100.89.128.1
WARN: 2025/03/21 09:55:01 Ping attempt 2 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/03/21 09:55:03 Ping attempt 3 of 5
INFO: 2025/03/21 09:55:03 Pinging 100.89.128.1
WARN: 2025/03/21 09:55:13 Ping attempt 3 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/03/21 09:55:15 Ping attempt 4 of 5
INFO: 2025/03/21 09:55:15 Pinging 100.89.128.1
WARN: 2025/03/21 09:55:25 Ping attempt 4 failed: failed to read ICMP packet: i/o timeout
INFO: 2025/03/21 09:55:27 Ping attempt 5 of 5
INFO: 2025/03/21 09:55:27 Pinging 100.89.128.1
WARN: 2025/03/21 09:55:37 Ping attempt 5 failed: failed to read ICMP packet: i/o timeout
WARN: 2025/03/21 09:55:37 Failed to ping 100.89.128.1: all ping attempts failed after 5 tries, last error: failed to read ICMP packet: i/o timeout
WARN: 2025/03/21 09:55:37 HINT: Do you have UDP port 51820 (or the port in config.yml) open on your Pangolin server?
```
@oschwartz10612 commented on GitHub (Mar 21, 2025):
Increased the ping to 15 in 9d80161. Will release soon - might help. Let us know.
<!-- gh-comment-id:2744476347 -->
@oschwartz10612 commented on GitHub (Mar 21, 2025):
Increased the ping to 15 in [9d80161](https://github.com/fosrl/newt/commit/9d80161ab7bc86c4be1ab1a4fc1f5f0671dc0360). Will release soon - might help. Let us know.
Unless they were in the very latest tag I still see this behavior if my pangolin is offline for too long.
<!-- gh-comment-id:4423185665 -->
@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.
Could you try the latest newt? Some improvements were made.
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. (:
<!-- gh-comment-id:4434055106 -->
@Snocember commented on GitHub (May 12, 2026):
> Could you try the latest newt? Some improvements were made.
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. (:
@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.
<!-- gh-comment-id:4569569474 -->
@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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.