Possible race in DEP8 test

Bug #2008932 reported by Andreas Hasenack
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
isc-kea (Ubuntu)
Fix Released
Undecided
Andreas Hasenack

Bug Description

isc-kea has a new DEP8 test that brings up the DHCP server on a bridge, and a DHCP client on an interface connected to that bridge.

Every now and then, this test fails due to the client not obtaining an IP address, even after 60s.

Here is such a failure:
https://autopkgtest.ubuntu.com/results/autopkgtest-lunar/lunar/amd64/i/isc-kea/20230228_174511_21e70@/log.gz

According to these logs, it looks like the `keabr0` bridge took 3s to become ready, but by then the kea dhcp4 server already had given up:

From dmesg:
```
[Tue Feb 28 17:43:46 2023] keabr0: port 1(p1) entered blocking state
[Tue Feb 28 17:43:46 2023] keabr0: port 1(p1) entered disabled state
[Tue Feb 28 17:43:46 2023] device p1 entered promiscuous mode
[Tue Feb 28 17:43:49 2023] IPv6: ADDRCONF(NETDEV_CHANGE): client0: link becomes ready
[Tue Feb 28 17:43:49 2023] IPv6: ADDRCONF(NETDEV_CHANGE): p1: link becomes ready
[Tue Feb 28 17:43:49 2023] keabr0: port 1(p1) entered blocking state
[Tue Feb 28 17:43:49 2023] keabr0: port 1(p1) entered forwarding state
[Tue Feb 28 17:43:49 2023] IPv6: ADDRCONF(NETDEV_CHANGE): keabr0: link becomes ready
```

And kea's dhcp4 server logs:
Feb 28 17:43:46 autopkgtest kea-dhcp4[1242]: 2023-02-28 17:43:46.838 WARN [kea-dhcp4.dhcpsrv/1242.139918289109120] DHCPSRV_OPEN_SOCKET_FAIL failed to open socket: the interface keabr0 is not running

Feb 28 17:43:46 autopkgtest kea-dhcp4[1242]: 2023-02-28 17:43:46.838 INFO [kea-dhcp4.dhcp4/1242.139918289109120] DHCP4_OPEN_SOCKETS_FAILED maximum number of open service sockets attempts: 0, has been exhausted without success
Feb 28 17:43:46 autopkgtest kea-dhcp4[1242]: 2023-02-28 17:43:46.838 WARN [kea-dhcp4.dhcpsrv/1242.139918289109120] DHCPSRV_NO_SOCKETS_OPEN no interface configured to listen to DHCP traffic
Feb 28 17:43:46 autopkgtest kea-dhcp4[1242]: 2023-02-28 17:43:46.839 WARN [kea-dhcp4.dhcp4/1242.139918289109120] DHCP4_MULTI_THREADING_INFO enabled: no, number of threads: 0, queue size: 0
Feb 28 17:43:46 autopkgtest kea-dhcp4[1242]: 2023-02-28 17:43:46.839 INFO [kea-dhcp4.dhcp4/1242.139918289109120] DHCP4_STARTED Kea DHCPv4 server version 2.2.0 started

We either need to loop over the status of `keabr0` and only restart kea-dhcp4 when the bridge is ready, or maybe there is a config option for kea-dhcp4 to retry a few more times, as there is a hint that such a mechanism exists, given the "attempts: 0" text from the log.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Yep, there is such an option[1] in kea-dhcp4:

```
Sometimes, immediate interruption isn't a good choice. The port can be unavailable only temporary. In this case, retrying the opening may resolve the problem. Kea provides two options to specify the retrying: service-sockets-max-retries and service-sockets-retry-wait-time.

The first defines a maximal number of retries that Kea makes to open a socket. The zero value (default) means that the Kea doesn't retry the process.

The second defines a wait time (in milliseconds) between attempts. The default value is 5000 (5 seconds).
```

1. https://kea.readthedocs.io/en/latest/arm/dhcp4-srv.html?highlight=attempt#interface-configuration

Revision history for this message
Paride Legovini (paride) wrote :
Changed in isc-kea (Ubuntu):
status: New → In Progress
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This is in lunar-proposed now.

Changed in isc-kea (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package isc-kea - 2.2.0-5

---------------
isc-kea (2.2.0-5) unstable; urgency=medium

  [ Paride Legovini ]
  * d/control: update to Standards-Version 4.6.2, no changes needed

  [ Andreas Hasenack ]
  * d/t/kea-dhcp4.conf.template: retry opening a socket. Sometimes the
    `keabr0` bridge used in the DEP8 test takes a while to become ready, and
    kea-dhcp4 fails to open a socket on it. Add configuration options to
    kea-dhcp4 to retry opening the socket a few times before giving up.
    (LP: #2008932)

 -- Athos Ribeiro <email address hidden> Thu, 02 Mar 2023 14:00:17 -0300

Changed in isc-kea (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.