Item9090: Segmentation fault when running search with certain words

pencil
Priority: Normal
Current State: New
Released In:
Target Release: n/a
Applies To: Extension
Component: NativeSearchContrib
Branches:
Reported By: MartinKaufmann
Waiting For: Main.MartinKaufmann
Last Change By: MartinKaufmann

System

Error Description

NativeSearchContrib fails with a segmentation fault using certain search term (e.g. resolver) in one particular web.

The Apache error.log contains the following entry:

[Wed Jun 02 10:28:23 2010] [notice] child pid 9445 exit signal Segmentation fault (11)
with PID 9445 being Apache itself.

It also segfaults when running from the shell:
$ cd tools/native_search
$ perl test.pl -i -l resolver /home/httpd/foswiki/data/Technology/*
Segmentation fault

Debugging

Compiled using cc -c   -g    -DVERSION=\"\" -DXS_VERSION=\"\" -fPIC "-I/usr/lib/perl/5.10/CORE"   FoswikiNativeSearch.c

Run gdb:
$ /home/httpd/foswiki/tools/native_search# gdb /usr/bin/perl
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) run ./test.pl -i -l resolver  /home/httpd/foswiki/data/Technology/*
Starting program: /usr/bin/perl ./test.pl -i -l resolver  /home/httpd/foswiki/data/Technology/*
(no debugging symbols found)
(no debugging symbols found)
(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)
[New Thread 0x7fc7dd42c6e0 (LWP 26576)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fc7dd42c6e0 (LWP 26576)]
0x00007fc7dc080aaa in XS_pack_charPtrPtr (st=0x606fe8, s=0xffffffffd4001b60, n=0) at FoswikiNativeSearch.xs:73
73              for(c = s; *c; c++){
(gdb) bt
#0  0x00007fc7dc080aaa in XS_pack_charPtrPtr (st=0x606fe8, s=0xffffffffd4001b60, n=0) at FoswikiNativeSearch.xs:73
#1  0x00007fc7dc080e5f in XS_FoswikiNativeSearch_cgrep (my_perl=0x607fb8, cv=0x6892e8) at FoswikiNativeSearch.c:166
#2  0x00007fc7dcf5deb0 in Perl_pp_entersub () from /usr/lib/libperl.so.5.10
#3  0x00007fc7dcf5c392 in Perl_runops_standard () from /usr/lib/libperl.so.5.10
#4  0x00007fc7dcf575df in perl_run () from /usr/lib/libperl.so.5.10
#5  0x0000000000400d0c in main ()

-- MartinKaufmann - 02 Jun 2010

Is there any chance that "resolver" has no results in that web? By code inspection I can see a possible error when the search returns no results that might be worth further investigation.

-- CrawfordCurrie - 03 Jun 2010

No, there is one topic which contains the word resolver.

Some additional information:
  • It only segfaults if I search for all topics in this particular web (data/Technology/*).
  • It doesn't segfault if I search only one particular topic (data/Technology/WebHome) or a subset (data/Technology/Web*) even if these topics don't contain the search term.
  • Searching all of my other webs also doesn't lead to a segfault (data/System/* or data/General/*) although these other webs don't contain the search term.
  • Some topic names contain umlauts - but also in webs where the search doesn't segfault.
  • On the assumption that there might be a topic which contains strange/broken content, I went over subsets of topics in the Technology web (data/Technology/A* to Z*) without getting a segfault.

-- MartinKaufmann - 03 Jun 2010

It did some more tests using subsets of topics with very strange results (I did these tests on a copy of the original web):

root@wiki:/home/httpd/foswiki/tools/native_search# perl test.pl -i -l resolver /scratch/temp/Technology/T*
RESULT
/scratch/temp/Technology/TestTopic.txt
/scratch/temp/Technology/TestTopic.txt,v
root@wiki:/home/httpd/foswiki/tools/native_search# perl test.pl -i -l resolver /scratch/temp/Technology/[A-T]*
Segmentation fault
root@wiki:/home/httpd/foswiki/tools/native_search# perl test.pl -i -l resolver /scratch/temp/Technology/[S-T]*
RESULT
/scratch/temp/Technology/TestTopic.txt
/scratch/temp/Technology/TestTopic.txt,v
root@wiki:/home/httpd/foswiki/tools/native_search# perl test.pl -i -l resolver /scratch/temp/Technology/[R-T]*
RESULT
/scratch/temp/Technology/TestTopic.txt
/scratch/temp/Technology/TestTopic.txt,v
root@wiki:/home/httpd/foswiki/tools/native_search# perl test.pl -i -l resolver /scratch/temp/Technology/[Q-T]*
RESULT
/scratch/temp/Technology/TestTopic.txt
/scratch/temp/Technology/TestTopic.txt,v
root@wiki:/home/httpd/foswiki/tools/native_search# perl test.pl -i -l resolver /scratch/temp/Technology/[P-T]*
Segmentation fault

-- MartinKaufmann - 03 Jun 2010

See also Item2631.

-- MartinKaufmann - 06 Sep 2010

 

ItemTemplate edit

Summary Segmentation fault when running search with certain words
ReportedBy MartinKaufmann
Codebase 1.0.9
SVN Range
AppliesTo Extension
Component NativeSearchContrib
Priority Normal
CurrentState New
WaitingFor MartinKaufmann
Checkins
TargetRelease n/a
ReleasedIn
Topic revision: r8 - 06 Sep 2010, MartinKaufmann
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy