[#25936] [Bug:1.9] [rubygems] $LOAD_PATH includes bin directory — Nobuyoshi Nakada <nobu@...>

Hi,

10 messages 2009/10/05

[#25943] Disabling tainting — Tony Arcieri <tony@...>

Would it make sense to have a flag passed to the interpreter on startup that

16 messages 2009/10/05

[#26028] [Bug #2189] Math.atanh(1) & Math.atanh(-1) should not raise an error — Marc-Andre Lafortune <redmine@...>

Bug #2189: Math.atanh(1) & Math.atanh(-1) should not raise an error

14 messages 2009/10/10

[#26222] [Bug #2250] IO::for_fd() objects' finalization dangerously closes underlying fds — Mike Pomraning <redmine@...>

Bug #2250: IO::for_fd() objects' finalization dangerously closes underlying fds

11 messages 2009/10/22

[#26244] [Bug #2258] Kernel#require inside rb_require() inside rb_protect() inside SysV context fails — Suraj Kurapati <redmine@...>

Bug #2258: Kernel#require inside rb_require() inside rb_protect() inside SysV context fails

24 messages 2009/10/22

[#26361] [Feature #2294] [PATCH] ruby_bind_stack() to embed Ruby in coroutine — Suraj Kurapati <redmine@...>

Feature #2294: [PATCH] ruby_bind_stack() to embed Ruby in coroutine

42 messages 2009/10/27

[#26371] [Bug #2295] segmentation faults — tomer doron <redmine@...>

Bug #2295: segmentation faults

16 messages 2009/10/27

[ruby-core:26168] [Bug #2235] Segmentation fault with PTY.spawn

From: Sundar Vasan <redmine@...>
Date: 2009-10-19 19:12:51 UTC
List: ruby-core #26168
Bug #2235: Segmentation fault with PTY.spawn
http://redmine.ruby-lang.org/issues/show/2235

Author: Sundar Vasan
Status: Open, Priority: Normal
Category: ext
ruby -v: ruby 1.9.1p281 (2009-08-09 revision 24476) [i386-darwin9.8.0]

Running (on ruby 1.9.1 branch) this script :

*** Begin script ***
#!/usr/bin/env ruby
require 'pty'

r, w, pid = PTY.spawn("echo 'hello world'; sleep 1")

puts "sleeping"
sleep 5
puts "done"

***** End script *****

causes this segmentation fault (run it a few times if it doesn't at first try):

*** Begin output ****
[BUG] Segmentation fault
ruby 1.9.1p281 (2009-08-09 revision 24476) [i386-darwin9.8.0]

-- control frame ----------
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP   
---------------------------
-- Ruby level backtrace information-----------------------------------------

-- C level backtrace information -------------------------------------------
0x1179d2 0   ruby                                0x001179d2 rb_vm_bugreport + 82
0x2c46c 1   ruby                                0x0002c46c rb_warning + 444
0x2c4cb 2   ruby                                0x0002c4cb rb_bug + 43
0xbdcd8 3   ruby                                0x000bdcd8 rb_enable_interrupt + 232
0x90e042bb 4   libSystem.B.dylib                   0x90e042bb _sigtramp + 43
0xffffffff 5   ???                                 0xffffffff 0x0 + 4294967295
0x103986 6   ruby                                0x00103986 rb_get_method_body + 38
0x107615 7   ruby                                0x00107615 rb_funcall + 229
0x4235ab 8   pty.bundle                          0x004235ab 0x0 + 4339115
0x423686 9   pty.bundle                          0x00423686 0x0 + 4339334
0x11d556 10  ruby                                0x0011d556 rb_exec_recursive + 1030
0x11d591 11  ruby                                0x0011d591 rb_exec_recursive + 1089
0x90dc9155 12  libSystem.B.dylib                   0x90dc9155 _pthread_start + 321
0x90dc9012 13  libSystem.B.dylib                   0x90dc9012 thread_start + 34

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap

***** End output ***

The problem is caused by the fact that pty_getpty allocates pty info struct on the stack (line 453) and then passes them to pty_syswait which is run on a new thread. One fix would be to just xcalloc them. But there is also a secondary design problem in that when this is fixed, PTY throws a asynchronous exception when the process finishes.  That the process finished in not an exception and making it async means the exception could happen anywhere in  my main code which is hard to handle. Both of these are fixed on trunk.  The segfault by itself should definitely be fixed but it would be great if the changes on trunk were merged into 1.9.1 branch.  (I personally think both should be fixed). Any chances of that?


----------------------------------------
http://redmine.ruby-lang.org

In This Thread

Prev Next