Backport #1785

ObjectSpace::define_finalizer on Fixnum segfaults with recent ruby

Added by Pascal Terjan over 2 years ago. Updated 10 months ago.

[ruby-core:24395]
Status:Closed Start date:07/17/2009
Priority:Normal Due date:
Assignee:Kirk Haines % Done:

100%

Category:-
Target version:-

Description

$ ruby -e 'ObjectSpace::define_finalizer(4, proc {})'
-e:1:in `define_finalizer': cannot define finalizer for Fixnum (ArgumentError)
	from -e:1
-e:1: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-12 patchlevel 174) [i586-linux]

Abandon

It does not give error and does not crash on my other machine with ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]

Associated revisions

Revision 28235
Added by wyhaines over 1 year ago

Backport #1785 [ruby-core:24395]; check to make sure finalizer_table isn't null before trying to run finalizers.

History

Updated by Kirk Haines over 2 years ago

On Thu, Jul 16, 2009 at 3:42 PM, Pascal Terjan<redmine@ruby-lang.org> wrote:
> Bug #1785: ObjectSpace::define_finalizer on Fixnum segfaults with recent ruby
> http://redmine.ruby-lang.org/issues/show/1785
>
> Author: Pascal Terjan
> Status: Open, Priority: Normal
> ruby -v: ruby 1.8.7 (2009-06-12 patchlevel 174) [i586-linux]
>
> $ ruby -e 'ObjectSpace::define_finalizer(4, proc {})'
> -e:1:in `define_finalizer': cannot define finalizer for Fixnum (ArgumentError)
>        from -e:1
> -e:1: [BUG] Segmentation fault
> ruby 1.8.7 (2009-06-12 patchlevel 174) [i586-linux]

I can confirm that this error occurs on 1.8.6 at least with pl368 and
up.  I have not had a chance to check other patch levels.


Kirk Haines

Updated by Ryan Davis over 2 years ago

On Jul 16, 2009, at 15:08 , Kirk Haines wrote:

> On Thu, Jul 16, 2009 at 3:42 PM, Pascal Terjan<redmine@ruby- 
> lang.org> wrote:
>> Bug #1785: ObjectSpace::define_finalizer on Fixnum segfaults with  
>> recent ruby
>> http://redmine.ruby-lang.org/issues/show/1785
>>
>> Author: Pascal Terjan
>> Status: Open, Priority: Normal
>> ruby -v: ruby 1.8.7 (2009-06-12 patchlevel 174) [i586-linux]
>>
>> $ ruby -e 'ObjectSpace::define_finalizer(4, proc {})'
>> -e:1:in `define_finalizer': cannot define finalizer for Fixnum  
>> (ArgumentError)
>>        from -e:1
>> -e:1: [BUG] Segmentation fault
>> ruby 1.8.7 (2009-06-12 patchlevel 174) [i586-linux]
>
> I can confirm that this error occurs on 1.8.6 at least with pl368 and
> up.  I have not had a chance to check other patch levels.

Both 1.8.7-p160, 1.8.6-p368 segfault. 1.9.1 is listed as a failure,  
but that is only based on exit code, so it shouldn't be counted as  
incorrect:

502 % multiruby -e 'ObjectSpace::define_finalizer(4, proc {})'

VERSION = 1.8.6-p287
CMD     = ~/.multiruby/install/1.8.6-p287/bin/ruby -e  
ObjectSpace::define_finalizer(4, proc {})


RESULT = 0

VERSION = 1.8.6-p368
CMD     = ~/.multiruby/install/1.8.6-p368/bin/ruby -e  
ObjectSpace::define_finalizer(4, proc {})

-e:1:in `define_finalizer': cannot define finalizer for Fixnum  
(ArgumentError)
	from -e:1
-e:1: [BUG] Bus Error
ruby 1.8.6 (2009-03-31) [i686-darwin9.7.0]


RESULT = 6

VERSION = 1.8.7-p160
CMD     = ~/.multiruby/install/1.8.7-p160/bin/ruby -e  
ObjectSpace::define_finalizer(4, proc {})

-e:1:in `define_finalizer': cannot define finalizer for Fixnum  
(ArgumentError)
	from -e:1
-e:1: [BUG] Bus Error
ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-darwin9.7.0]


RESULT = 6

VERSION = 1.8.7-p72
CMD     = ~/.multiruby/install/1.8.7-p72/bin/ruby -e  
ObjectSpace::define_finalizer(4, proc {})


RESULT = 0

VERSION = 1.9.1-p129
CMD     = ~/.multiruby/install/1.9.1-p129/bin/ruby -e  
ObjectSpace::define_finalizer(4, proc {})

-e:1:in `define_finalizer': cannot define finalizer for Fixnum  
(ArgumentError)
	from -e:1:in `<main>'

RESULT = 256

TOTAL RESULT = 3 failures out of 5

Passed: 1.8.6-p287, 1.8.7-p72
Failed: 1.9.1-p129, 1.8.7-p160, 1.8.6-p368

Updated by Shyouhei Urabe over 2 years ago

  • Assignee set to Kirk Haines
Applied in changeset r24178.  Should be backported to 1.8.6.

Updated by Kirk Haines over 1 year ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
This issue was solved with changeset r28235.
Pascal, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Also available in: Atom PDF