[groonga-dev,00194] 長いクエリでSEGVが発生する

Back to archive index

SHIDARA Yoji dara****@shida*****
2009年 9月 15日 (火) 17:19:48 JST


daraです。

"a OR b OR c OR d OR e OR f OR g OR h OR i" のような
長いクエリでselectするとSEGVが発生するようです。

groonga commit 6f1092858e9eafd5bfd954e24a512c91339418e1
Ruby/groonga r667
で試しています。

以下のようなコードで確認しました。

#!/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)
results = data.select { |r| r['text'].match "a OR b OR c OR d OR e OR
f OR g OR h OR i" }

実行結果は以下の通りです。

dara @ buzztter:~/groonga_test$ gdb --args ruby longquery.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 longquery.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 0x7fb31f74e6e0 (LWP 13740)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fb31f74e6e0 (LWP 13740)]
0x00007fb31e141683 in grn_column_index (ctx=0x13afda0, obj=0x147c0c0,
op=GRN_OP_MATCH,
    indexbuf=0x147c188, buf_size=1) at db.c:5822
5822	      grn_obj *target = grn_ctx_at(ctx, data->target);
(gdb) bt
#0  0x00007fb31e141683 in grn_column_index (ctx=0x13afda0,
obj=0x147c0c0, op=GRN_OP_MATCH,
    indexbuf=0x147c188, buf_size=1) at db.c:5822
#1  0x00007fb31e16a95e in scan_info_build (ctx=0x13afda0,
table=0x13f59c0, expr=0x1477a20,
    n=0x7fff2775a6a8, op=GRN_OP_OR) at db.c:7873
#2  0x00007fb31e16be93 in grn_table_select (ctx=0x13afda0,
table=0x13f59c0, expr=0x1477a20,
    res=0x1451c10, op=GRN_OP_OR) at db.c:8091
#3  0x00007fb31e405235 in rb_grn_table_select (argc=<value optimized out>,
    argv=<value optimized out>, self=140407303049400)
    at /home/dara/local/src/ruby-groonga/ext/rb-grn-table.c:1302
#4  0x00007fb31f27a6c2 in ?? () from /usr/lib/libruby1.8.so.1.8
#5  0x00007fb31f27a82a in ?? () from /usr/lib/libruby1.8.so.1.8
#6  0x00007fb31f2747e0 in ?? () from /usr/lib/libruby1.8.so.1.8
#7  0x00007fb31f277f80 in ?? () from /usr/lib/libruby1.8.so.1.8
#8  0x00007fb31f275c02 in ?? () from /usr/lib/libruby1.8.so.1.8
#9  0x00007fb31f28767b in ?? () from /usr/lib/libruby1.8.so.1.8
#10 0x00007fb31f2876c5 in ruby_exec () from /usr/lib/libruby1.8.so.1.8
#11 0x00007fb31f2876f2 in ruby_run () from /usr/lib/libruby1.8.so.1.8
#12 0x00000000004008b3 in main ()

-- 
SHIDARA Yoji
本を書きました! http://www.amazon.co.jp/dp/4798119881




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