[groonga-dev,00206] Re: TokenMecabを指定してレコードを追加するとSEGVが発生する

Back to archive index

morit****@razil***** morit****@razil*****
2009年 9月 22日 (火) 17:21:25 JST


森です。

ruby-groongaでは、exit()が呼ばれたときにatexit()で設定した
finish_groonga()関数が呼び出されるようにしているのですが、
exit実行時にまずMeCab::MemoryPoolのデストラクタが先に呼ばれ、
その後にfinish_groonga()が呼び出されているために、
MeCabの内部で資源が二重に解放されて問題が起きているようです。

grn_fin()をexit()以前に呼べると良いのですが。。

>>> SHIDARA Yoji さんは書きました:
> daraです。
> 
> TokenMecabを使っている状態でレコードを追加すると
> SEGVが発生するようです。
> 
> バージョンは以下の通りです:
> mecab of 0.97
> groonga commit 1bbbfe8a65a386b2ae07a3f00e2069ef430f2d9a
> Ruby/groonga r668
> 
> 以下のスクリプトで確認しています。
> 
> #!/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")
>   end
>   schema.create_table("terms",
>                       :type => :patricia_trie,
>                       :key_normalize => true,
>                       :default_tokenizer => "TokenMecab") do |table|
>     table.index("data.text")
>                       end
> end
> 
> data = Groonga::Context.default['data']
> data.add('1', :text => "test one two")
> 
> 実行結果は以下の通りです。
> 
> dara @ buzztter:~/groonga_test$ gdb --args ruby mecabtokenizer.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 mecabtokenizer.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)
> [New Thread 0x7f63951076e0 (LWP 10066)]
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7f63951076e0 (LWP 10066)]
> 0x00007f6393690e67 in MeCab::Connector::close () from
> /usr/local/lib/libmecab.so.1
> Current language:  auto; currently asm
> (gdb) bt
> #0  0x00007f6393690e67 in MeCab::Connector::close () from
> /usr/local/lib/libmecab.so.1
> #1  0x00007f63936b8a8e in MeCab::TaggerImpl::~TaggerImpl () from
> /usr/local/lib/libmecab.so.1
> #2  0x00007f63936d9261 in mecab_destroy () from /usr/local/lib/libmecab.so.1
> #3  0x00007f6393b65428 in grn_token_fin () at token.c:499
> #4  0x00007f6393ab07ba in grn_fin () at ctx.c:615
> #5  0x00007f6393ffb9cd in exit () from /lib/libc.so.6
> #6  0x00007f6394c39220 in ruby_stop () from /usr/lib/libruby1.8.so.1.8
> #7  0x00007f6394c40711 in ruby_run () from /usr/lib/libruby1.8.so.1.8
> #8  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




groonga-dev メーリングリストの案内
Back to archive index