Repository navigation
[event-loop] Add epoll backend - #131
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughThe PR adds a Linux-specific epoll backend and refactors the existing poll backend. Backend selection now routes Linux to epoll, with a new module implementing full asynchronous I/O orchestration. The poll backend receives event mask calculation optimizations and improved poll queue cleanup. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/event/backend.zig(1 hunks)src/event/backends/epoll.zig(1 hunks)src/event/backends/poll.zig(4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-10T05:59:17.087Z
Learnt from: lalinsky
Repo: lalinsky/zio PR: 41
File: src/udp.zig:79-82
Timestamp: 2025-10-10T05:59:17.087Z
Learning: In UDP socket operations (src/udp.zig), error.Canceled from result_data.result represents OS/IO-level cancellation (e.g., io_uring), not user-requested cancellation. User cancellation is handled by waitForXevCompletion() via try. OS-level error.Canceled should be mapped to error.Unexpected as it represents an unexpected system event.
Applied to files:
src/event/backends/epoll.zig
🔇 Additional comments (1)
src/event/backends/poll.zig (1)
97-114: Caching the op mask here is a good call.Precomputing
op_eventskeeps the pollfd updates tidy and avoids repeating the switch every time we touch the same completion.
Check return values from epoll_ctl(CTL_DEL) and epoll_ctl(CTL_MOD) to prevent internal state from diverging from kernel state. - CTL_DEL: Only remove from poll_queue if epoll_ctl succeeds - CTL_MOD: Only update entry.events if epoll_ctl succeeds - Log errors when epoll_ctl fails Co-authored-by: Lukáš Lalinský <[email protected]>
Instead of logging errors and returning early, propagate epoll_ctl failures up the call stack so they can be handled properly. This ensures internal bookkeeping stays in sync with the kernel's epoll state. Co-authored-by: Lukáš Lalinský <[email protected]>
No description provided.