FreeBSD 13: Permanent 100% CPU Usage on One Core After Fresh Install
While setting up a client’s server I came across an annoying bug. After a successful installation, one of four cores was permanently spinning at 100% load.
As there was no visible process using that much resources, running
revealed the system process responsible:
20 root 1 -16 - 0B 16K - 3 0:01 100.00% [rand_harvestq]
Additionally, I noticed an issue with the server hanging after successfully shutting down, never completing a reboot.
Searching the web for
rand_harvestq revealed the following two FreeBSD bug
- virtio_random: random_harvestq spinning on a CPU with Q35 virtio random device
- virtio_random on Vultr/qemu - FreeBSD 13.0 hangs after shutdown / reboot / halt commands
The server in question is indeed a virtual server using virtio drivers. There appears to be an issue with the Qemu Q35 chipset, which it uses, being a Hetzner CPX series cloud server. The issue has been reported to occur on the Vultr service as well.
The solution for the time being is blacklisting the kernel extension:
# /etc/rc.conf devmatch_blacklist="virtio_random.ko"
Additionally, if you don’t want to restart immediately, you can unload the kernel extension:
After a reboot, the issue should disappear and reboots work reliably again.