Skip to content

io: detect pollable fds for streaming read/write dispatch#394

Draft
lalinsky wants to merge 6 commits into
mainfrom
nonblocking-streaming
Draft

io: detect pollable fds for streaming read/write dispatch#394
lalinsky wants to merge 6 commits into
mainfrom
nonblocking-streaming

Conversation

@lalinsky
Copy link
Copy Markdown
Owner

On epoll/kqueue backends, pipes/devices should be polled directly instead of going through the thread pool. This PR:

  • Defaults FileOpenFlags.nonblocking and FileCreateFlags.nonblocking to true
  • Removes the supportsNonBlockingFileIo() guard from backends
  • After open/create, detects pollable fds via lseek (POSIX) / GetFileType (Windows)
  • Dispatches streaming reads/writes to PipeRead/PipeWrite for pollable fds, FileReadStreaming/FileWriteStreaming for regular files
  • Adds Runtime.pollable_fds map for caching foreign fds (stdin/stdout/stderr)
  • Same dispatch logic in batch path

- Default FileOpenFlags/FileCreateFlags.nonblocking to true
- Remove supportsNonBlockingFileIo() guard from common.zig backends
- After open/create, detect pollable fds via lseek/GetFileType and set
  Io.File.flags.nonblocking accordingly
- In fileReadStreaming/fileWriteStreaming: pollable fds use PipeRead/PipeWrite
  (epoll/kqueue), regular files use FileReadStreaming/FileWriteStreaming
  (thread pool)
- Add Runtime.pollable_fds map for caching foreign fds (stdin/stdout/stderr)
- Thread Runtime through operate → operateInner → streaming functions
- Same dispatch logic in batch path
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 305e7e34-7f8a-4856-9cdd-d60c4f2e4dd3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nonblocking-streaming

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

lalinsky added 5 commits May 17, 2026 13:48
… open

Keep the default false for FileOpenFlags/FileCreateFlags to avoid
IOCP regressions. After fdIsPollable detection, explicitly set
O_NONBLOCK on POSIX for pollable fds. Restore supportsNonBlockingFileIo
guard in common.zig for io_uring/IOCP backends.
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