Skip to content

Emulated Netlink sockets cause infinite busy loops under event-loop#112

Open
doanbaotrung wants to merge 1 commit into
sysprog21:mainfrom
open-sources-port:fix/emulated_netlink_sockets
Open

Emulated Netlink sockets cause infinite busy loops under event-loop#112
doanbaotrung wants to merge 1 commit into
sysprog21:mainfrom
open-sources-port:fix/emulated_netlink_sockets

Conversation

@doanbaotrung

@doanbaotrung doanbaotrung commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

When guest applications (such as avahi-daemon)
run event loops that wait for netlink messages
using ppoll() or select(), the emulated descriptor
immediately returns POLLIN because the write
end is closed. The application's subsequent
recvmsg or read call returns 0 bytes.

Because no sender credentials can be resolved
from a 0-byte read, the application ignores the
read and immediately queries ppoll() again.
This causes the guest application to spin in
an infinite busy-loop consuming 100% CPU.

Implement a non-blocking self-pipe signaling
mechanism inside src/syscall/netlink.c


Summary by cubic

Fixes infinite busy loops in emulated Netlink sockets when apps use select/ppoll by signaling readiness only when data exists and returning -EAGAIN otherwise. This prevents 100% CPU spin in services like avahi-daemon.

  • Bug Fixes
    • Added a per-socket non-blocking self-pipe; keep the write end open and signal on buffered responses.
    • Drain the pipe when buffers are fully read; empty reads now return -EAGAIN to avoid 0-byte reads with POLLIN.
    • Set pipe fds to non-blocking via fd_set_nonblock, include utils.h, and clean up the write end on close.

Written for commit 4abb867. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant