fix: add systemd-networkd ordering and wait-online timeout - #169
Conversation
| StartLimitIntervalSec=10 | ||
| After=systemd-networkd.service | ||
| Wants=systemd-networkd.service | ||
| StartLimitIntervalSec=300 |
There was a problem hiding this comment.
I am worried that changing StartLimitIntervalSec might affect transient failure retires such as IMDS failures. Ie it exhausts all 5 retries and has to wait another 300s to start again in which time it suceeds.
There was a problem hiding this comment.
Good point. Changed to 60: Might be enough to prevent permanent failure from rapid retries while not delaying recovery after transient IMDS failures. I updated the code here in the PR.
| Description=Set up policy routes for %I | ||
| StartLimitIntervalSec=10 | ||
| After=systemd-networkd.service | ||
| Wants=systemd-networkd.service |
There was a problem hiding this comment.
Wants is a little different from After it will try to restart systemd-networkd.service even if it fails. Do you want this?
There was a problem hiding this comment.
You're right, dropped it. The intent is to ensure policy-routes doesn't start before networkd has loaded its .network files, not to pull networkd into the transaction or restart it. After= alone achieves that. PR updated.
ed10586 to
ebbc5f4
Compare
policy-routes@.service can enter an endless retry loop when a DHCP lease is lost during boot (e.g. due to networkctl reload by another service). The systemd-networkd DHCP client may stop requesting rather than retrying, and wait-online blocks indefinitely with no explicit timeout. Changes: - Add After=systemd-networkd.service to ensure networkd is running before policy-routes attempts to wait for the interface - Increase StartLimitIntervalSec from 10 to 60 to prevent permanent failure when wait-online fails quickly in a transient state - Add --timeout=60 to systemd-networkd-wait-online for bounded wait and faster retry cycle Fixes: amazonlinux#168
ebbc5f4 to
4fce925
Compare
Fixes #168
When a DHCP lease is lost during boot (e.g. another service calls
networkctl reload), the systemd-networkd DHCP client may stop requesting rather than retrying.policy-routes@.servicethen loops onsystemd-networkd-wait-onlinewith no explicit timeout, blocking indefinitely.This PR:
After=systemd-networkd.serviceto reduce the race window on boot--timeout=60for bounded wait and faster retry cycleStartLimitIntervalSecfrom 10 to 60 to prevent permanent failure when wait-online fails quickly in a transient stateJournal evidence and full analysis in #168.