Project

General

Profile

Actions

Bug #8669

closed

outbuf can be "temporarily" locked forever in IO#read

Added by Glass_saga (Masaki Matsushita) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.1.0dev (2013-07-23 trunk 42132) [x86_64-linux]
[ruby-core:56121]

Description

Following code make outbuf "temporarily" locked forever.
It is needed to ensure rb_str_unlocktmp().

str = ""
t = Thread.new(str) do |str|
r, = IO.pipe
r.read(nil, str)
end
sleep 1
t.raise
sleep 1
str.clear #=> can't modify string; temporarily locked (RuntimeError)

I have attached two patches.
One fixes io_fread(), another does io_getpartial() and rb_io_sysread().
May I commit these changes?


Files

io_fread.diff (984 Bytes) io_fread.diff for io_fread() Glass_saga (Masaki Matsushita), 07/23/2013 06:06 PM
read_internal.diff (1.85 KB) read_internal.diff for io_getpartial() and rb_io_sysread() Glass_saga (Masaki Matsushita), 07/23/2013 06:06 PM
io_fread_callback.diff (1.77 KB) io_fread_callback.diff for io_fread() with rb_str_locktmp_ensure() Glass_saga (Masaki Matsushita), 07/25/2013 01:59 PM
read_internal_callback.diff (2.7 KB) read_internal_callback.diff for io_getpartial() and rb_io_sysread() with rb_str_locktmp_ensure() Glass_saga (Masaki Matsushita), 07/25/2013 01:59 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0