EasyTier / EasyTier

A simple, decentralized mesh VPN with WireGuard support.
https://easytier.top
Apache License 2.0
1.91k stars 191 forks source link

DNS服务器不可用时程序直接Panic #304

Open L-Trump opened 2 months ago

L-Trump commented 2 months ago

复现:

日志:

2024-09-04 12:18:57: new listener added. listener: tcp://0.0.0.0:11010
2024-09-04 12:18:57: new listener added. listener: udp://0.0.0.0:11010
2024-09-04 12:18:57: new listener added. listener: wg://0.0.0.0:11011
2024-09-04 12:18:57: new listener added. listener: ws://0.0.0.0:11011/
2024-09-04 12:18:57: new listener added. listener: wss://0.0.0.0:11012/
2024-09-04 12:18:57: new listener added. listener: udp://[::]:56535
2024-09-04 12:18:57: tun device ready. dev: easytier.ltnet
panic occurred: PanicInfo { payload: Any { .. }, message: Some(called `Result::unwrap()` on an `Err` value: TunnelError(IOError(Custom { kind: Uncategorized, error: "failed to lookup address information: Try again" }))), location: Location { file: "easytier/src/easytier-core.rs", line: 668, col: 22 }, can_unwind: true, force_no_backtrace: false }

fish: Job 1, 'sudo easytier-core -i 10.144.14…' has ended

期望的现象: 程序不Panic,而是进行重连

katyo commented 2 weeks ago

I have similar issue since I switched to using systemd-resolved:

panic occurred: PanicInfo { payload: Any { .. }, message: Some(called `Result::unwrap()` on an `Err` value: TunnelError(IOError(Custom { kind: Uncategorized, error: "failed to lookup address information: Name or service not known" }))), location: Location { file: "easytier/src/easytier-core.rs", line: 668, col: 22 }, can_unwind: true, force_no_backtrace: false }

Have any ideas?

L-Trump commented 2 weeks ago

I have similar issue since I switched to using systemd-resolved:

panic occurred: PanicInfo { payload: Any { .. }, message: Some(called `Result::unwrap()` on an `Err` value: TunnelError(IOError(Custom { kind: Uncategorized, error: "failed to lookup address information: Name or service not known" }))), location: Location { file: "easytier/src/easytier-core.rs", line: 668, col: 22 }, can_unwind: true, force_no_backtrace: false }

Have any ideas?

This is more of a startup order issue, we need to ensure that the network is ready when easytier starts up. So an available workaround is to modify easytier's systemd service to start after nss-lookup.target and made it restart on failure.

[Unit]
After=network-online.target nss-lookup.target
Description=EasyTier Service
Wants=network-online.target nss-lookup.target

[Service]
ExecStart=/nix/store/ns0fdssq7bx8a2pvpi0ni73skc24iyz8-easytier-2.0.3/bin/easytier-core -c /etc/easytier/ltnet.conf --multi-thread
Restart=on-failure
Type=simple

[Install]
WantedBy=multi-user.target
katyo commented 2 weeks ago

@L-Trump In my case panic still occurs each time even if I restart easytier-core manually.