HA hook in Kea 2.6.x causes validation failure with `-T` option
With this simple configuration:
{
"Dhcp4": {
"hooks-libraries": [
{
"library": "/usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_ha.so",
"parameters": {
"high-availability": [
{
"this-server-name": "primary",
"mode": "hot-standby",
"peers": [
{
"name": "primary",
"role": "primary",
"url": "http://192.0.2.2:8000/",
"auto-failover": true
},
{
"name": "standby",
"url": "http://192.0.2.3:8000/",
"role": "standby",
"auto-failover": true
}
]
}
]
}
},
{
"library": "/usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_lease_cmds.so"
}
]
}
}
Performing a -T
test fails as shown:
$ sudo /usr/local/kea/2.6.0/sbin/kea-dhcp4 -T kea-dhcp4-test-ha-bigT-2-6.json
2024-08-15 14:27:40.625 INFO [kea-dhcp4.hosts/246341.281473731309584] HOSTS_BACKENDS_REGISTERED the following host backend types are available: mysql postgresql
2024-08-15 14:27:40.625 WARN [kea-dhcp4.dhcpsrv/246341.281473731309584] DHCPSRV_MT_DISABLED_QUEUE_CONTROL disabling dhcp queue control when multi-threading is enabled.
2024-08-15 14:27:40.625 WARN [kea-dhcp4.dhcp4/246341.281473731309584] DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED Multi-threading is enabled and host reservations lookup is always performed first.
2024-08-15 14:27:40.627 INFO [kea-dhcp4.hooks/246341.281473731309584] HOOKS_LIBRARY_CLOSED hooks library /usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_ha.so successfully closed
2024-08-15 14:27:40.627 INFO [kea-dhcp4.hooks/246341.281473731309584] HOOKS_LIBRARY_CLOSED hooks library /usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_lease_cmds.so successfully closed
2024-08-15 14:27:40.628 INFO [kea-dhcp4.hooks/246341.281473731309584] HOOKS_LIBRARY_CLOSED hooks library /usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_stat_cmds.so successfully closed
2024-08-15 14:27:40.628 INFO [kea-dhcp4.dhcpsrv/246341.281473731309584] DHCPSRV_MEMFILE_DB opening memory file lease database: persist=false type=memfile universe=4
2024-08-15 14:27:40.628 WARN [kea-dhcp4.dhcpsrv/246341.281473731309584] DHCPSRV_MEMFILE_NO_STORAGE running in non-persistent mode, leases will be lost after restart
2024-08-15 14:27:40.629 INFO [kea-dhcp4.ha-hooks/246341.281473731309584] HA_CONFIGURATION_SUCCESSFUL HA hook library has been successfully configured
2024-08-15 14:27:40.629 INFO [kea-dhcp4.ha-hooks/246341.281473731309584] HA_INIT_OK loading High Availability hooks library successful
2024-08-15 14:27:40.629 INFO [kea-dhcp4.hooks/246341.281473731309584] HOOKS_LIBRARY_LOADED hooks library /usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_ha.so successfully loaded
2024-08-15 14:27:40.630 INFO [kea-dhcp4.lease-cmds-hooks/246341.281473731309584] LEASE_CMDS_INIT_OK loading Lease Commands hooks library successful
2024-08-15 14:27:40.630 INFO [kea-dhcp4.hooks/246341.281473731309584] HOOKS_LIBRARY_LOADED hooks library /usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_lease_cmds.so successfully loaded
2024-08-15 14:27:40.630 INFO [kea-dhcp4.stat-cmds-hooks/246341.281473731309584] STAT_CMDS_INIT_OK loading Stat Commands hooks library successful
2024-08-15 14:27:40.630 INFO [kea-dhcp4.hooks/246341.281473731309584] HOOKS_LIBRARY_LOADED hooks library /usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_stat_cmds.so successfully loaded
2024-08-15 14:27:40.630 INFO [kea-dhcp4.ha-hooks/246341.281473731309584] HA_LOCAL_DHCP_DISABLE local DHCP service is disabled while the primary is in the WAITING state
2024-08-15 14:27:40.630 INFO [kea-dhcp4.ha-hooks/246341.281473731309584] HA_SERVICE_STARTED primary: started high availability service in hot-standby mode as primary server
Error encountered: Error initializing hooks: CmdHttpListener cannot be started when multi-threading is disabled
2024-08-15 14:27:40.631 INFO [kea-dhcp4.stat-cmds-hooks/246341.281473731309584] STAT_CMDS_DEINIT_OK unloading Stat Commands hooks library successful
2024-08-15 14:27:40.631 INFO [kea-dhcp4.lease-cmds-hooks/246341.281473731309584] LEASE_CMDS_DEINIT_OK unloading Lease Commands hooks library successful
2024-08-15 14:27:40.631 INFO [kea-dhcp4.ha-hooks/246341.281473731309584] HA_DEINIT_OK unloading High Availability hooks library successful
2024-08-15 14:27:40.631 INFO [kea-dhcp4.hooks/246341.281473731309584] HOOKS_LIBRARY_CLOSED hooks library /usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_stat_cmds.so successfully closed
2024-08-15 14:27:40.631 INFO [kea-dhcp4.hooks/246341.281473731309584] HOOKS_LIBRARY_CLOSED hooks library /usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_lease_cmds.so successfully closed
2024-08-15 14:27:40.631 INFO [kea-dhcp4.hooks/246341.281473731309584] HOOKS_LIBRARY_CLOSED hooks library /usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_ha.so successfully closed
with the error: Error encountered: Error initializing hooks: CmdHttpListener cannot be started when multi-threading is disabled
The same error appears when slightly adjusting the configuration to be a DHCPv6 configuration and using the kea-dhcp6
daemon instead.
Adjusting the configuration slightly and using the Kea 2.4.0 daemon does not emit the above error.
Adding this multi-threading section in the HA configuration does not fix the error:
"multi-threading": {
"enable-multi-threading": true,
"http-dedicated-listener": true
},
NOTE Setting both of the above parameters to false DOES fix the error.
It does not help to explicitly set multi-threading true in the global configuration area either. This configuration still results in the error as shown above:
{
"Dhcp6": {
"multi-threading": {
"enable-multi-threading": true,
"thread-pool-size": 4,
"packet-queue-size": 16
},
"hooks-libraries": [
{
"library": "/usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_ha.so",
"parameters": {
"high-availability": [
{
"this-server-name": "primary",
"mode": "hot-standby",
"multi-threading": {
"enable-multi-threading": true,
"http-dedicated-listener": true
},
"peers": [
{
"name": "primary",
"role": "primary",
"url": "http://192.0.2.2:8000/",
"auto-failover": true
},
{
"name": "standby",
"url": "http://192.0.2.3:8000/",
"role": "standby",
"auto-failover": true
}
]
}
]
}
},
{
"library": "/usr/local/kea/2.6.0/lib/kea/hooks/libdhcp_lease_cmds.so"
}
]
}
}