DHCP4_CONFIG_LOAD_FAIL - "getNextRow failed" with MySQL
Kea Version: 1.7
The server runs fine but occasionally after rebooting the kea dhcp4 server fails to start. I am receiving failure to load config errors, which is a bit ambiguous because the issue is actually a MySQL issue.
The error message is as follows: ERROR [kea-dhcp4.dhcp4/89345] DHCP4_CONFIG_LOAD_FAIL configuration error using file: /usr/local/etc/kea/kea-dhcp4.conf, reason: Error while processing command 'config-set':getNextRow failed for <SELECT subnet_id, state, leases as state_count FROM lease4_stat ORDER BY subnet_id, state>, reason: (error code 0),
This error can be tracked to the lease4_stat table. It is occurring because some leases are negative.
It can be solved by running the following mysql query: DELETE FROM lease4_stat WHERE leases<1;
That being said this is not something that should be happening.
Your own triggers decrement the leases and it is feasible that they reach negative. Obviously either, the triggers or code should handle when the leases<1, or just don't let it go past 0.
More documentation on people having this issue spanning from versions 1.4-1.7: