Radicale icon indicating copy to clipboard operation
Radicale copied to clipboard

Crashes eventually if disconnected from the internet

Open infinity0 opened this issue 1 year ago • 0 comments

Radicale tries to resolve its own server hostnames at startup, bypassing the C standard library functions (getaddrinfo etc) which first check /etc/hosts, and instead going straight to DNS. This fails to resolve localhost - the default value from Radicale's configs - when disconnected from the internet, causing Radicale to crash and quit.

This is problematic for servers on unreliable home networks, especially those that are on a long restart loop - such as Debian's Radicale, whose logrotate configuration will restart Radicale every week. If Radicale is disconnected from the internet during a restart, it will fail and not be restarted for another week, even if internet access comes back up in the meantime.

The fix is extremely simple, namely to use getaddrinfo(1) (whatever the Python equivalent is) - the same as common system utilities such as ping(1) and getent hosts, which both can resolve localhost even when disconnected from the internet.

infinity0 avatar Jun 23 '23 19:06 infinity0