Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test segfault on arm64: test_key_used_for_id_field #16

Open
panlinux opened this issue Sep 12, 2019 · 1 comment
Open

test segfault on arm64: test_key_used_for_id_field #16

panlinux opened this issue Sep 12, 2019 · 1 comment

Comments

@panlinux
Copy link

Hi,

the test test_key_used_for_id_field is segfaulting on arm64:

RUBYLIB=. GEM_PATH= ruby2.5 debian/ruby-tests.rb
/tmp/autopkgtest.emjxzb/build.gxX/src/test/unit/index/tc_index.rb:467: warning: key "0" is duplicated and overwritten on line 468
/tmp/autopkgtest.emjxzb/build.gxX/src/test/unit/index/tc_index.rb:469: warning: key "1" is duplicated and overwritten on line 470
/tmp/autopkgtest.emjxzb/build.gxX/src/test/unit/index/tc_index.rb:482: warning: key "0" is duplicated and overwritten on line 483
/tmp/autopkgtest.emjxzb/build.gxX/src/test/unit/index/tc_index.rb:507: warning: key "0" is duplicated and overwritten on line 508
/tmp/autopkgtest.emjxzb/build.gxX/src/test/unit/index/tc_index.rb:507: warning: key "0" is duplicated and overwritten on line 511
Loading once
Loaded suite debian/ruby-tests
Started
..................................................N
===============================================================================
Notification: <IndexTest#test_index_key_delete_batch0> was redefined [test_index_key_delete_batch0(IndexTest)]
/tmp/autopkgtest.emjxzb/build.gxX/src/test/unit/index/tc_index.rb:531:in `<class:IndexTest>'
===============================================================================
...Stack trace:
Not available
E
===============================================================================
Error: test_key_used_for_id_field(IndexTest):
  StandardError: Signal occurred at <global.c>:422 in sighandler_crash
  Exiting on signal SIGSEGV (11)
/tmp/autopkgtest.emjxzb/build.gxX/src/test/unit/index/tc_index.rb:202:in `new'
/tmp/autopkgtest.emjxzb/build.gxX/src/test/unit/index/tc_index.rb:202:in `test_key_used_for_id_field'
     199:   def test_key_used_for_id_field
     200:     fs_path = File.expand_path(File.join(File.dirname(__FILE__), '../../temp/fsdir'))
     201: 
  => 202:     index = Index.new(:path => fs_path, :key => :my_id, :create => true)
     203:     [
     204:       {:my_id => "three", :id => "me"},
     205:       {:my_id => "one", :field2 => "three"},
===============================================================================

Contents of debian/ruby-tests.rb are:

require 'test/unit'

Dir.glob("test/unit/t[cs]*.rb").each { |f| require f }

I can reproduce this by just:

export RUBYLIB=.
ruby2.5 debian/ruby-tests.rb

Under gdb, that gives me (just the top most 4 stack traces, the full stack has 85 frames):

#0  0x0000ffffbf5a0744 in generic_ivar_get (undef=52, id=85987, obj=<optimized out>) at variable.c:990
        iv_index_tbl = <error reading variable iv_index_tbl (Cannot access memory at address 0x0)>
        index = 187649994730992
        ivtbl = 0xaaaaab472df0
        ivtbl = <optimized out>
        iv_index_tbl = <optimized out>
        index = <optimized out>
        ret = <optimized out>
#1  rb_ivar_lookup (obj=<optimized out>, id=id@entry=85987, undef=undef@entry=52) at variable.c:1205
        val = <optimized out>
        ptr = <optimized out>
        iv_index_tbl = <optimized out>
        len = <optimized out>
        index = 187649994730992
#2  0x0000ffffbf5a15e0 in rb_ivar_lookup (undef=52, id=85987, obj=<optimized out>) at variable.c:1184
        val = <optimized out>
        len = <optimized out>
        ptr = <optimized out>
        iv_index_tbl = <optimized out>
        index = <optimized out>
        val = <optimized out>
        ptr = <optimized out>
        iv_index_tbl = <optimized out>
        len = <optimized out>
        index = <optimized out>
#3  rb_ivar_get (obj=<optimized out>, id=85987) at variable.c:1214
        iv = <optimized out>
#4  0x0000ffffbeb1c12c in frb_fsdir_new (argc=<optimized out>, argv=<optimized out>, klass=<optimized out>) at r_store.c:375
        ref_cnt = <optimized out>
        self = 187649991850960
        rpath = 187649996041280
        rcreate = <optimized out>
        store = 0xaaaaab697d10
        create = <optimized out>
        verify = <optimized out>

If I change the test_key_used_for_id_field test in test/unit/index/tc_index.rb to use another directory, then the test passes, but that is probably just masking the bug:

-    fs_path = File.expand_path(File.join(File.dirname(__FILE__), '../../temp/fsdir'))
+    fs_path = File.expand_path(File.join(File.dirname(__FILE__), '../../temp/fsdir2'))
@panlinux
Copy link
Author

Debian is patching this package a bit, and if I remove this hunk from this patch file, then there is no segfault, hmm...

https://salsa.debian.org/ruby-team/ruby-ferret/blob/master/debian/patches/disable_load_path_manipulation.patch#L18

lucaskanashiro added a commit to lucaskanashiro/ferret that referenced this issue Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant