morit****@razil*****
morit****@razil*****
2009年 9月 15日 (火) 03:03:00 JST
森です。
Groonga::Contextが完了した(grn_ctx_fin)後に、
そこから払い出されたobjectがclose(grn_obj_close)されているために、
free済みのメモリ領域が破壊されているようです。
この事象がいつもrubyが終了するタイミングで出るのであれば、
それが原因かも知れません。
うーん。。
>>> SHIDARA Yoji さんは書きました:
> しだらです。
>
> 度々すみません。
> 条件が特定できていない状態で恐縮なのですが、
> 以下のようなコードで SEGV するようです。
> groonga commit 09bac5da6afc413b6909c3f659f256e94854efa9
> ruby/groonga r664
> で試しています。
>
>
> #!/usr/bin/env ruby
> $KCODE='u'
> require 'groonga'
>
> Groonga::Database.create(:path => 'db/groonga')
> Groonga::Schema.define do |schema|
> schema.create_table("data", :type => :hash) do |table|
> table.text("text")
> table.time("time")
> end
> schema.create_table("terms",
> :type => :patricia_trie,
> :key_normalize => true,
> :default_tokenizer => "TokenBigram") do |table|
> table.index("data.text")
> end
> end
>
> data = Groonga::Context.default['data']
> data.add('1', :text => "test one two", :time => 0)
>
> 1000.times do |i|
> results = data.select { |r| r['text'].match 'test' }
> results.sort([["time", "descending"]])
> results.each do |record|
> [record.key.key, record['text']]
> end
> end
>
>
> gdbから実行した結果は以下の通りでした(お役にたてばよいのですが、、、):
>
> dara @ buzztter:~/groonga_test$ gdb --args ruby -v groonga_segvtest.rb
> GNU gdb 6.8-debian
> Copyright (C) 2008 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 "x86_64-linux-gnu"...
> (no debugging symbols found)
> (gdb) r
> Starting program: /usr/bin/ruby -v groonga_segvtest.rb
> (no debugging symbols found)
> (no debugging symbols found)
> (no debugging symbols found)
> (no debugging symbols found)
> [Thread debugging using libthread_db enabled]
> (no debugging symbols found)
> (no debugging symbols found)
> (no debugging symbols found)
> (no debugging symbols found)
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> [New Thread 0x7f5eb2d0b6e0 (LWP 31279)]
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7f5eb2d0b6e0 (LWP 31279)]
> 0x00007f5eb1c40dcc in ?? () from /lib/libc.so.6
> (gdb) bt
> #0 0x00007f5eb1c40dcc in ?? () from /lib/libc.so.6
> #1 0x00007f5eb1c42a78 in malloc () from /lib/libc.so.6
> #2 0x00007f5eb16d75e9 in grn_malloc_default (ctx=0x7f5eb19acee0, size=136,
> file=0x7f5eb1798de3 "hash.c", line=1494, func=0x7f5eb17991d0
> "grn_hash_cursor_open")
> at ctx.c:1288
> #3 0x00007f5eb16e71fd in grn_hash_cursor_open (ctx=0x7f5eb19acee0,
> hash=0x7b5a30, min=0x0,
> min_size=0, max=0x0, max_size=0, offset=0, limit=0, flags=0) at hash.c:1494
> #4 0x00007f5eb16d3213 in grn_ctx_fin (ctx=0x7f5eb19acee0) at ctx.c:402
> #5 0x00007f5eb16d3c3b in grn_fin () at ctx.c:586
> #6 0x00007f5eb1bff9cd in exit () from /lib/libc.so.6
> #7 0x00007f5eb283d220 in ruby_stop () from /usr/lib/libruby1.8.so.1.8
> #8 0x00007f5eb2844711 in ruby_run () from /usr/lib/libruby1.8.so.1.8
> #9 0x00000000004008b3 in main ()
> (gdb)
>
> --
> SHIDARA Yoji
> 本を書きました! http://www.amazon.co.jp/dp/4798119881
>
> _______________________________________________
> groonga-dev mailing list
> groon****@lists*****
> http://lists.sourceforge.jp/mailman/listinfo/groonga-dev
>
--
morita