async icon indicating copy to clipboard operation
async copied to clipboard

gets() hangs on Windows

Open emiltin opened this issue 2 years ago • 6 comments

Hi, Running this on Mac and Linux:

input, output = IO.pipe
Async do
  puts "starting"
  Async do
    puts "reading..."
    line = input.gets
    puts "got #{line.inspect}"
  end
  puts "writting..."
  output.puts "hello"
end

outputs:

starting
reading...
writting...
got "hello\n"

But on Windows it just outputs:

starting
reading...

and then hangs. It seems the call to input.gets()blocks?

I'm running the Windows code in a Github Workflow: Microsoft Windows Server 2022, 10.0.20348 ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt] Using async 2.6.2 Using async-io 1.35.0 Using bundler 2.4.13

emiltin avatar Jun 29 '23 10:06 emiltin

I cannot reproduce this with async 2.6.3, closing.

emiltin avatar Aug 08 '23 09:08 emiltin

Wow great, thanks for reporting back!

ioquatix avatar Aug 08 '23 22:08 ioquatix

It seems I was too quick to close this. The original example at the top still hangs on Windows. As mentioned, I'm running this in a GitHub Action, that runs a Ruby file with the example in.

I'll try to make a PR with a new test.

emiltin avatar Aug 10 '23 09:08 emiltin

Hi, Any plans for adding Windows to the test matrix? This seems still to hang on Windows.

emiltin avatar Jun 12 '24 09:06 emiltin

Yes, but it's slow. I started writing support for IOCP in io-event gem.

ioquatix avatar Jun 12 '24 09:06 ioquatix

Cool, thank you for the response.

emiltin avatar Jun 12 '24 09:06 emiltin