ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "ioquatix (Samuel Williams) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "ioquatix (Samuel Williams)" <noreply@ruby-lang.org>
Subject: [ruby-core:119124] [Ruby master Bug#20723] `IO#close` is broken on Ruby 3.3+ when using the Fiber scheduler.
Date: Wed, 11 Sep 2024 09:42:15 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-20723.20240911094215.3344@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-20723.20240911094215.3344@ruby-lang.org>

Issue #20723 has been reported by ioquatix (Samuel Williams).

----------------------------------------
Bug #20723: `IO#close` is broken on Ruby 3.3+ when using the Fiber scheduler.
https://bugs.ruby-lang.org/issues/20723

* Author: ioquatix (Samuel Williams)
* Status: Open
* Assignee: kjtsanaktsidis (KJ Tsanaktsidis)
* Backport: 3.3: REQUIRED
----------------------------------------
The following program seems to work okay on Ruby 3.2 but hangs on Ruby 3.3:

```ruby
#!/usr/bin/env ruby

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'async'
end

require 'socket'

def close_while_reading(io)
  thread = Thread.new do
    Thread.current.report_on_exception = false
    io.wait_readable
  end
  
  # Wait until the thread is blocked on read:
  Thread.pass until thread.status == "sleep"
  
  Async do
    io.close
  end
  
  thread.join
end

begin
  client, server = Socket.pair(:UNIX, :STREAM)
  close_while_reading(client)
rescue => error
  $stderr.puts error.full_message
end
```



-- 
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/

       reply	other threads:[~2024-09-11  9:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11  9:42 ioquatix (Samuel Williams) via ruby-core [this message]
2024-09-11  9:44 ` [ruby-core:119125] " ioquatix (Samuel Williams) via ruby-core
2024-09-11 10:49 ` [ruby-core:119126] " ioquatix (Samuel Williams) via ruby-core
2024-09-13  7:45 ` [ruby-core:119169] " kjtsanaktsidis (KJ Tsanaktsidis) via ruby-core
2024-09-23  0:29 ` [ruby-core:119279] " kjtsanaktsidis (KJ Tsanaktsidis) via ruby-core
2024-11-04 22:23 ` [ruby-core:119704] " k0kubun (Takashi Kokubun) via ruby-core

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-20723.20240911094215.3344@ruby-lang.org \
    --to=ruby-core@ml.ruby-lang.org \
    --cc=noreply@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).