netlink
netlink copied to clipboard
high cpu usage after 916f9685fa42fc711f76a7f48d058e2656f7edf6 which changed Subscribe to nonblocking mode
in the following code snippets
for {
msgs, from, err := s.Receive()
if err != nil {
if err == syscall.EAGAIN {
continue
}
if cberr != nil {
cberr(fmt.Errorf("Receive failed: %v",
err))
if the socket baking s is changed to non blocking mode as the commit 916f9685fa42fc711f76a7f48d058e2656f7edf6 did, when there is no event in the socket, kernel will always return EAGAIN which cause the goroutine to a busy loop.
Looks like the bad commit was reverted here 1e68b2710dc35a6ac34bcd7f27a70a0655d7a45d