netlink icon indicating copy to clipboard operation
netlink copied to clipboard

high cpu usage after 916f9685fa42fc711f76a7f48d058e2656f7edf6 which changed Subscribe to nonblocking mode

Open fortitudepub opened this issue 11 months ago • 1 comments

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.

fortitudepub avatar Mar 22 '24 09:03 fortitudepub

Looks like the bad commit was reverted here 1e68b2710dc35a6ac34bcd7f27a70a0655d7a45d

fasaxc avatar Jul 12 '24 10:07 fasaxc