Opened 14 years ago

Closed 14 years ago

#538 closed defect (fixed)

Upgrade to more recent SWIG

Reported by: Dan Owned by: Olly Betts
Priority: normal Milestone: 1.2.6
Component: Xapian-bindings Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description

When importing _xapian, the Python bindings segfault. Here's the output from valgrind. It's a little more useful than gdb's backtrace, but I'm still unsure why its happening there. All other tests in core indicate that this should work.

==2484== Invalid free() / delete / delete[]
==2484==    at 0x10022D541: operator delete(void*) (vg_replace_malloc.c:387)
==2484==    by 0x100AC01E7: std::string::reserve(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==2484==    by 0x1010D60D1: Xapian::Query::~Query() (in /Users/dcolish/local/xapian/lib/libxapian.22.dylib)
==2484==    by 0x1002538D3: __cxa_finalize (in /usr/lib/libSystem.B.dylib)
==2484==    by 0x1002537EB: exit (in /usr/lib/libSystem.B.dylib)
==2484==    by 0x1000014B8: _start (in /Users/dcolish/local/py27/bin/python)
==2484==    by 0x1000013D0: (below main) (in /Users/dcolish/local/py27/bin/python)
==2484==  Address 0x100ea27b0 is 0 bytes inside a block of size 26 free'd
==2484==    at 0x10022D541: operator delete(void*) (vg_replace_malloc.c:387)
==2484==    by 0x10128114F: DebugLogger::~DebugLogger() (in /Users/dcolish/local/xapian/lib/libxapian.22.dylib)
==2484==    by 0x1002538D3: __cxa_finalize (in /usr/lib/libSystem.B.dylib)
==2484==    by 0x1002537EB: exit (in /usr/lib/libSystem.B.dylib)
==2484==    by 0x1000014B8: _start (in /Users/dcolish/local/py27/bin/python)
==2484==    by 0x1000013D0: (below main) (in /Users/dcolish/local/py27/bin/python)
==2484== 

In this process I also worked on bumping the swig bindings to 2.0.2. Python needed the attached patch to get it building.

Attachments (2)

swig-2.0.2.diff (421 bytes ) - added by Dan 14 years ago.
XapianPINVOKE.diff (412 bytes ) - added by Greg 14 years ago.
A patch requested by Olly in xapian-devel for C# string issues.

Download all attachments as: .zip

Change History (7)

by Dan, 14 years ago

Attachment: swig-2.0.2.diff added

comment:1 by Dan, 14 years ago

Component: OtherXapian-bindings (Python)
Owner: changed from Olly Betts to Richard Boulton

comment:2 by Olly Betts, 14 years ago

Component: Xapian-bindings (Python)Xapian-bindings
Milestone: 1.2.x
Owner: changed from Richard Boulton to Olly Betts
Summary: Python Bindings SegaultUpgrade to more recent SWIG

The segfault is fixed by r15380 + r15381 (it looks like an OS X limitation which prevents std::string members of static objects, but I didn't investigate that as I don't have OS X and the patched version seems better anyway).

Let's make this ticket about upgrading SWIG, since it has a patch for that already.

I think PHP didn't work last time I tried a more recent SWIG.

Suitable for 1.2.x, provided we're careful (usually we compare the generated code for each language before and after, which means we should spot potential issues).

comment:3 by Olly Betts, 14 years ago

Milestone: 1.2.x1.2.6

Apparently newer SWIG will fix issues with C# (reported by "Greg" on xapian-devel) - this is the SWIG ticket:

http://sourceforge.net/tracker/?func=detail&aid=2957375&group_id=1645&atid=101645

So there's a growing list of reasons to do this, and it'll get more painful the longer we leave it. So let's try to sort this out for 1.2.6.

by Greg, 14 years ago

Attachment: XapianPINVOKE.diff added

A patch requested by Olly in xapian-devel for C# string issues.

comment:4 by Olly Betts, 14 years ago

Status: newassigned

Working on this.

All the languages look good, except PHP which fails "make check", and java-swig which just eats memory trying to run the tests (but it always seems to on atreus, so that's not a new thing).

comment:5 by Olly Betts, 14 years ago

Resolution: fixed
Status: assignedclosed

Updated to current SWIG trunk in r15487.

Note: See TracTickets for help on using tickets.