From: nagachika00@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:81966] [Ruby trunk Bug#13632] Not processable interrupt queue for a thread after it's notified that FD is closed in some other thread.
Date: Sat, 08 Jul 2017 02:21:41 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-65689.20170708022140.3c5e247108aca244@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-13632.20170605161653@ruby-lang.org
Issue #13632 has been updated by nagachika (Tomoyuki Chikanaga).
Backport changed from 2.2: UNKNOWN, 2.3: DONE, 2.4: REQUIRED to 2.2: UNKNOWN, 2.3: DONE, 2.4: DONE
ruby_2_4 r59286 merged revision(s) 58284,58812,59028.
----------------------------------------
Bug #13632: Not processable interrupt queue for a thread after it's notified that FD is closed in some other thread.
https://bugs.ruby-lang.org/issues/13632#change-65689
* Author: nvashchenko (Nikolay Vashchenko)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.2.x, 2.3.x, 2.4.x, 2.5.x
* Backport: 2.2: UNKNOWN, 2.3: DONE, 2.4: DONE
----------------------------------------
In the bugfix for https://bugs.ruby-lang.org/issues/13076 has been introduced another bug, caused by a busy waiting in rb_notify_fd_close method, while the FD is being released. During this waiting, it pumps huge amounts of the ruby_error_stream_closed errors into thread's interrupt queue, which almost all stay there unprocessed. It can be up for several hundred of exceptions in the queue, depending on circumstances.
```
a = []
t = []
10.times do
r,w = IO.pipe
a << [r,w]
t << Thread.new do
while r.gets
end rescue IOError
# Interrupt queue is full and all IO is broken
Thread.current.pending_interrupt? # Expected to be false, because it's already rescued
IO.sysopen ("/dev/tty") # Expected not to throw an error. On each such call, it dequeues the next item from interrupt queue until there's none
end
end
a.each do |r,w|
w.puts "test"
w.close
r.close
end
t.each do |th|
th.join
end
```
Output:
``` text
Traceback (most recent call last):
1: from test2.rb:9:in `block (2 levels) in <main>'
test2.rb:9:in `sysopen': stream closed in another thread (IOError)
```
--
https://bugs.ruby-lang.org/
next prev parent reply other threads:[~2017-07-08 2:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-13632.20170605161653@ruby-lang.org>
2017-06-05 16:16 ` [ruby-core:81581] [Ruby trunk Bug#13632] Not processable interrupt queue for a thread after it's notified that FD is closed in some other thread sir.nickolas
2017-06-05 21:51 ` [ruby-core:81584] " Eric Wong
2017-06-06 0:20 ` [ruby-core:81585] " Eric Wong
2017-06-07 20:05 ` [ruby-core:81613] " Eric Wong
2017-07-08 2:21 ` nagachika00 [this message]
2017-07-17 4:23 ` [ruby-core:82085] " sir.nickolas
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-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-65689.20170708022140.3c5e247108aca244@ruby-lang.org \
--to=ruby-core@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 read-only IMAP folder(s) and NNTP newsgroup(s).