Issue #9780 has been updated by Nobuyoshi Nakada.

Description updated
Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED

----------------------------------------
Bug #9780: sysread blocks when reading some files (AIX)
https://bugs.ruby-lang.org/issues/9780#change-46356

* Author: Kevin Burge
* Status: Open
* Priority: Normal
* Assignee: 
* Category: core
* Target version: 
* ruby -v: ruby 2.1.1p76 (2014-02-24 revision 45161) [powerpc-aix7.1.0.0]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
This hangs when running on AIX 7 build of Ruby 2.1.1:

test_sysread:

~~~ruby
filename = "/proc/#{Process.pid}/as"
File.open(filename, 'rb') do |f|
  p f.sysread(4)
end
~~~

Ruby 1.9.3-p286 does not do this.  If I simply change f.sysread to f.read, it does not block.

~~~
gdb `which ruby`
GNU gdb (GDB) 7.4.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "powerpc-ibm-aix5.1.0.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/ruby211/bin/ruby...done.
(gdb) set args test_sysread
(gdb) r
Starting program: /usr/local/ruby211/bin/ruby test_sysread
[New Thread 1]
[New Thread 258]
^C
Program received signal SIGINT, Interrupt.
[Switching to Thread 1]
0x00000000 in ?? ()
(gdb) bt full
#0  0x00000000 in ?? ()
No symbol table info available.
(gdb) thread 1
[Switching to thread 1 (process 20512950)]
#0  0xd02380d4 in __fd_poll () from /usr/lib/threads/libc.a(shr.o)
(gdb) bt full
#0  0xd02380d4 in __fd_poll () from /usr/lib/threads/libc.a(shr.o)
No symbol table info available.
#1  0x1012e6f4 in thread_timer (p=0x20092570) at thread.c:1541
        result = -1
        pollfds = {{fd = 5, events = 1, revents = 0}, {fd = 7, events = 1, revents = 0}}
#2  0xd04fac88 in _pthread_body () from /usr/lib/libpthread.a(shr_xpg5.o)
No symbol table info available.
#3  0x00000000 in ?? ()
No symbol table info available.
(gdb) thread 3
[Switching to thread 3 (Thread 258)]
#0  0xd02380d4 in __fd_poll () from /usr/lib/threads/libc.a(shr.o)
(gdb) bt full
#0  0xd02380d4 in __fd_poll () from /usr/lib/threads/libc.a(shr.o)
No symbol table info available.
#1  0x1012e6f4 in thread_timer (p=0x20092570) at thread.c:1541
        result = -1
        pollfds = {{fd = 5, events = 1, revents = 0}, {fd = 7, events = 1, revents = 0}}
#2  0xd04fac88 in _pthread_body () from /usr/lib/libpthread.a(shr_xpg5.o)
No symbol table info available.
#3  0x00000000 in ?? ()
No symbol table info available.
~~~



-- 
https://bugs.ruby-lang.org/