Skip to contentSkip to conversation

common/rc: add default _udev_wait timeout

PATCH In review David Disseldorp 2 participants 2 messages Mar 23 – May 15

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 common/rc: add default _udev_wait timeout

If udevd isn't running then "udevadm wait" loops endlessly. With a --timeout parameter provided, udevadm (udev-254.27) prints to stderr:
Timed out for waiting devices being initialized.

The error message causes test failure via golden output mismatch and is easier to debug than an infinite loop.

The timeout parameter is also compatible with existing args="--removed <dev>" callers. 60 seconds is relatively arbitrary, but should be long enough to avoid premature timeout on regular systems.

---
Changes since v1:
- increase timeout from 10 to 60 seconds

 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +1 -1
index fd4ca964..a490893f 100644
@@ -5544,7 +5544,7 @@ _udev_wait()
 	if [ -z "$UDEV_WAIT_PROG" ]; then
 		$UDEV_SETTLE_PROG >/dev/null 2>&1
 	else
-		$UDEV_WAIT_PROG $args
+		$UDEV_WAIT_PROG --timeout 60 $args
 	fi
 }
 
Signature · 1 line
2.51.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 24 lines · David Disseldorp

If udevd isn't running then "udevadm wait" loops endlessly. With a --timeout parameter provided, udevadm (udev-254.27) prints to stderr:
Timed out for waiting devices being initialized.

The error message causes test failure via golden output mismatch and is easier to debug than an infinite loop.

The timeout parameter is also compatible with existing args="--removed <dev>" callers. 60 seconds is relatively arbitrary, but should be long enough to avoid premature timeout on regular systems.

---
Changes since v1:
- increase timeout from 10 to 60 seconds

 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +0 -0
index fd4ca964..a490893f 100644

common/rc _udev_wait() · line 5547

Quoted 5 lines
common/rc +1 -1
@@ -5544,7 +5544,7 @@ _udev_wait()
 	if [ -z "$UDEV_WAIT_PROG" ]; then
 		$UDEV_SETTLE_PROG >/dev/null 2>&1
 	else
-		$UDEV_WAIT_PROG $args
+		$UDEV_WAIT_PROG --timeout 60 $args

60s is good to me. As there's not more review points from others, let's have this change.

Quoted 7 lines
common/rc +0 -0
 	fi
 }
 
Signature · 1 line
2.51.0