From: dsh0416@... Date: 2020-12-21T11:55:38+00:00 Subject: [ruby-core:101582] [Ruby master Bug#17415] IO read blocking with Fiber Scheduler on Windows Issue #17415 has been reported by dsh0416 (Delton Ding). ---------------------------------------- Bug #17415: IO read blocking with Fiber Scheduler on Windows https://bugs.ruby-lang.org/issues/17415 * Author: dsh0416 (Delton Ding) * Status: Open * Priority: Normal * ruby -v: ruby 3.0.0rc1 * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- Here is the given example code for reproduction the bug: ```ruby rd, wr = IO.pipe scheduler = Evt::Scheduler.new # Any scheduler including the test scheduler in the ruby repo could reproduce the same problem. message = nil Fiber.set_scheduler scheduler Fiber.schedule do wr.write(MESSAGE) wr.close end Fiber.schedule do message = rd.read(20) rd.close end scheduler.run assert_equal MESSAGE, message assert rd.closed? assert wr.closed? ``` When running under Linux, FreeBSD or macOS, the code works fine. But when running under Windows: ```ruby #... Fiber.schedule do message = rd.read(20) # !!! -> Got blocked here rd.close end #... ``` Since some of the files don't support non-blocking on Windows, I double checked with the following code: ```ruby a, b = IO.pipe b.write_nonblock("Test") a.read_nonblock(4) # => "Test" ``` which works totally fine on Windows. I suppose some kind of IO non-blocking setup is not working properly under Windows. Still investigating the details for patching... -- https://bugs.ruby-lang.org/ Unsubscribe: