[Xapian-discuss] apache + perl + xapian = segmentation fault (and corrupt stack)

Olly Betts olly at survex.com
Wed Jun 14 13:19:54 BST 2006


On Wed, Jun 14, 2006 at 10:32:19AM +0100, James Aylett wrote:
> On Tue, Jun 13, 2006 at 08:47:18PM -0400, Rocco Caputo wrote:
> 
> > Has anyone ever run into a case where xapian dumps a core without a  
> > viable backtrace?

The first unknown function seems to be where things start to go wrong:

> #552 0x0000000b in ?? ()

You didn't say what processor this was on, but I don't think anything
common runs code that low.

> Not with Xapian, but I've seen it in various guises with, as you say,
> stack corruption.

I've seen similar things to.  Sometimes running under valgrind's
memcheck tool helps catch the bug before everything gets screwy
(assuming you're on a platform valgrind supports).

But one thing to check if you're building the perl bindings with a
recent GCC is that -fno-strict-aliasing is used.  Perl's XS mechanism
isn't aliasing safe, so not using this can generate bad code.  It should
automatically be added from the flags Perl was built with, but it's
worth checking this has happened.

Another thing to try is compiling everything without optimisation (-O0 for
GCC).  If the code still fails you may get a saner backtrace.  If it
doesn't fail then the bug is optimisation related - either invalid code
which happens to work with less aggressive optimisation, or a compiler
code generation bug.

Cheers,
    Olly



More information about the Xapian-discuss mailing list