Skip to content

Hand the scheduler's io_read the caller's part of the read buffer - #9806

Open
sampokuokkanen wants to merge 1 commit into
jruby:masterfrom
sampokuokkanen:scheduler-io-read-window
Open

sampokuokkanen wants to merge 1 commit into
jruby:masterfrom
sampokuokkanen:scheduler-io-read-window

Conversation

@sampokuokkanen

Copy link
Copy Markdown
Contributor

A very simple fix, but MRI has no tests for offset buffers. After this, Async's file/test.rb passes.

readInternal can pass the scheduler hooks a ByteBuffer that starts partway into its array. The hooks wrapped it in an IO::Buffer, which counts from zero, so a scheduler's io_read wrote to the start of the array while the caller looked for the data further in. Under async, File.read returned NUL bytes, as in async's File#flush test.

Slice the ByteBuffer first, so the IO::Buffer starts where the caller's data goes. The pread, write and pwrite hooks get the same fix.

readInternal can pass the scheduler hooks a ByteBuffer that starts partway
into its array. The hooks wrapped it in an IO::Buffer, which counts from
zero, so a scheduler's io_read wrote to the start of the array while the
caller looked for the data further in. Under async, File.read returned
NUL bytes, as in async's File#flush test.

Slice the ByteBuffer first, so the IO::Buffer starts where the caller's
data goes. The pread, write and pwrite hooks get the same fix.
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