From: "ioquatix (Samuel Williams) via ruby-core" Date: 2026-05-16T02:53:44+00:00 Subject: [ruby-core:125528] [Ruby Bug#21789] IO#flush doesn't invoke fiber scheduler io_write hook Issue #21789 has been updated by ioquatix (Samuel Williams). Status changed from Open to Closed The linked PR was merged. ---------------------------------------- Bug #21789: IO#flush doesn't invoke fiber scheduler io_write hook https://bugs.ruby-lang.org/issues/21789#change-117346 * Author: noteflakes (Sharon Rosner) * Status: Closed * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- When calling `IO#flush` or closing an IO with unflushed writes, the flushing is done by calling `rb_io_blocking_region_wait` and eventually doing a `write` system call. When done in a non-blocking fiber with an active fiber scheduler, this will invoke the `#blocking_operation_wait` fiber scheduler hook, which will run the system call in a worker thread, and therefore the flushing bypasses the async I/O capabilities of the fiber scheduler. The proposed fix is to test for the presence of a fiber scheduler in `io_flush_buffer_async` and invoke the `#io_write` fiber scheduler hook with the unflushed part of the IO's write buffer. Associated PR here: https://github.com/ruby/ruby/pull/15609 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/