Bug #9780

sysread blocks when reading some files (AIX)

Added by Kevin Burge 10 months ago. Updated 10 months ago.

[ruby-core:62198]
Status:Open
Priority:Normal
Assignee:-
ruby -v:ruby 2.1.1p76 (2014-02-24 revision 45161) [powerpc-aix7.1.0.0] Backport:2.0.0: REQUIRED, 2.1: REQUIRED

Description

This hangs when running on AIX 7 build of Ruby 2.1.1:

test_sysread:

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.

History

#1 Updated by Eric Wong 10 months ago

kcburge@gmail.com wrote:

Ruby 1.9.3-p286 does not do this.

Sorry, I might have introduced this bug in 2.0
Can you try the following patch? Thanks.

http://80x24.org/0001-io.c-try-to-fix-9780.patch

#2 Updated by Nobuyoshi Nakada 10 months ago

  • Description updated (diff)
  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED

Also available in: Atom PDF