AdguardTeam / AdguardTeam/AdGuardHome

bind: cannot assign requested address

未關閉
#5,790 7 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
waiting for data
主要語言
TypeScript
星號
36.9k
分支
2.5k
PR 合併指標
30 天內沒有已合併 PR

描述

### Prerequisites

- [X] I have checked the [Wiki](https://github.com/AdguardTeam/AdGuardHome/wiki) and [Discussions](https://github.com/AdguardTeam/AdGuardHome/discussions) and found no answer

- [X] I have searched other issues and found no duplicates

- [x] I want to report a bug and not ask a question

### Operating system type

Linux, OpenWrt

### CPU architecture

64-bit ARM

### Installation

Other (please mention in the description)

### Setup

On a router, DHCP is handled by the router

### AdGuard Home version

v0.107.21

### Description

#### Installation
OpenWRT opkg

#### What did you do?
Reboot the router.

#### Expected result
AdGuard Home should start reliably after a system reboot.

#### Actual result
Fairly often, AdGuard Home errors out on reboot. Failed 3 out of 4 times while trying to gather a log file that demonstrates success for this ticket. Failure message is:

> [fatal] couldn't start forwarding DNS server: listening to udp socket: listen udp 127.0.0.1:53: bind: cannot assign requested address

#### Workaround
SSH into the router and restart AdGuard Home through init.d script. This method is 100% successful.
Alternatively, reboot again, which is sometimes successful.

#### Additional information
I've provided three log files for comparison.
1. reboot-success.log - verbose logs following a reboot, where AdGuard Home starts up successfully.
2. reboot-fail.log - verbose logs following a reboot, where AdGuard Home fails to start up.
3. init_d-success.log - verbose logs following a manual restart using the init.d script, where AdGuard Home starts up successfully.

[reboot-success.log](https://github.com/AdguardTeam/AdGuardHome/files/11362133/reboot-success.log)
[reboot-fail.log](https://github.com/AdguardTeam/AdGuardHome/files/11362134/reboot-fail.log)
[init_d-success.log](https://github.com/AdguardTeam/AdGuardHome/files/11362135/init_d-success.log)

#### Observations
I noticed that for the init.d restart instances, there is a 10-second delay between log entries for "Go to http" style messages, and the "Creating the UDP server socket" messages. For instance:

> 2023/04/30 18:36:30.996889 3586#1 [info] Go to http://[fe80::ea9f:80ff:fef0:6a84%wlan1]:8080
> 2023/04/30 18:36:41.302740 3586#34 [info] Creating the UDP server socket

This is interesting, but probably a red herring since there is no delay in either of the failed or success logs for the reboot scenario.

#### Things I've tried
* I tried delaying the start of AdGuard Home by setting "START=99" in the init.d script. ~~This did not help.~~ Actually, the first time I did this I made a mistake and forgot to disable and re-enable the service in order to get the new "S99adguardhome" symlinks in /etc/rc.d/. So, this actually does seems to work.
* Moot point now. ~~My router is using DNSMASQ as an upstream DNS, with port configured to 54, as described here: [https://forum.openwrt.org/t/how-to-updated-2021-installing-adguardhome-on-openwrt-manual-and-opkg-method/113904.](https://forum.openwrt.org/t/how-to-updated-2021-installing-adguardhome-on-openwrt-manual-and-opkg-method/113904) I thought maybe there could be a race condition between DNSMASQ coming up defaulted to port 53 after a reboot, but not seeing anything in logs to corroborate that.~~
* Moot point now. ~~The WAN network of my router is configured to use unencrypted DNS to work around NTP issues as described here: [https://openwrt.org/docs/guide-user/services/dns/adguard-home#bypassing_encrypted_dns_for_ntp.](https://openwrt.org/docs/guide-user/services/dns/adguard-home#bypassing_encrypted_dns_for_ntp)~~

#### Mea Culpa
There is at least some evidence that this issue has been reported, for instance here: [https://github.com/AdguardTeam/AdGuardHome/issues/3760.](https://github.com/AdguardTeam/AdGuardHome/issues/3760) Although I haven't found anything active for OpenWRT, hence the new ticket.

#### A question
So, it seems that inserting a delay in the startup process does help. Is there something else to investigate here to better understand the underlying race condition?

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。