segfaults python

Bug #1070772 reported by Dimitri John Ledkov on 2012-10-24
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python2.7 (Ubuntu)
python3.2 (Ubuntu)
shiboken (Debian)
Fix Released
shiboken (Ubuntu)

Bug Description

python2.7, 3.2 and 3.3. Quantal and Raring.

# cleanup ints: 22 unfreed ints
# <int at 0x1c139f0, refcnt=1, val=65536>
# <int at 0x1c13a08, refcnt=1, val=640>
# <int at 0x1ba4848, refcnt=1, val=590923713>
# <int at 0x1ba4860, refcnt=1, val=907133923>
# <int at 0x1ba4878, refcnt=1, val=69069>
# <int at 0x1ba4890, refcnt=1, val=3644798167>
# <int at 0x1ba48a8, refcnt=1, val=89869747>
# <int at 0x1ba48c0, refcnt=1, val=1927868237>
# <int at 0x1b52540, refcnt=2, val=30>
# <int at 0x1b525e8, refcnt=2, val=23>
# <int at 0x1b52690, refcnt=5, val=16>
# <int at 0x1b52708, refcnt=3, val=11>
# <int at 0x1b52720, refcnt=5, val=10>
# <int at 0x1b52738, refcnt=4, val=9>
# <int at 0x1b52750, refcnt=3, val=8>
# <int at 0x1b52768, refcnt=4, val=7>
# <int at 0x1b52798, refcnt=5, val=5>
# <int at 0x1b527c8, refcnt=12, val=3>
# <int at 0x1b527e0, refcnt=20, val=2>
# <int at 0x1b527f8, refcnt=41, val=1>
# <int at 0x1b52810, refcnt=67, val=0>
# <int at 0x1b52828, refcnt=9, val=-1>
# cleanup floats
Segmentation fault (core dumped)

Reported upstream at

Dimitri John Ledkov (xnox) wrote :
Changed in shiboken (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Dimitri John Ledkov (xnox) wrote :

Debian's python2.7 and python3.2 do not segfault.

Matthias Klose (doko) wrote :

debian/rules ignores the value of the test runs with the debug interpreters. why? same problem which is hidden by the non-debug build?

Barry Warsaw (barry) on 2012-10-25
Changed in shiboken (Ubuntu):
assignee: nobody → Barry Warsaw (barry)
Barry Warsaw (barry) on 2012-10-26
Changed in shiboken (Ubuntu):
assignee: Barry Warsaw (barry) → nobody
importance: High → Undecided
Steve Langasek (vorlon) on 2012-10-26
Changed in shiboken (Ubuntu):
importance: Undecided → High
Barry Warsaw (barry) wrote :

<slangasek> fwiw if someone (ScottK?) considers not having pyside installable
            a problem and feels that it's better to have shiboken skipping the
            test suite and building with a known bug, I don't object [14:47]
<slangasek> I just don't think we should do that as non-users of the package

Didier Raboud (odyx) wrote :

Does it also happen with the latest upstream release (1.1.2) ?

Didier Raboud (odyx) on 2012-10-27
description: updated

On Oct 27, 2012, at 11:33 AM, Didier Raboud wrote:

>Does it also happen with the latest upstream release (1.1.2) ?

Yes, in exactly the same way.

Didier Raboud (odyx) on 2012-10-29
no longer affects: python-numpy (Ubuntu)
Changed in python3.2 (Ubuntu):
importance: Undecided → Medium
Changed in python2.7 (Ubuntu):
importance: Undecided → Medium
Julian Taylor (jtaylor) wrote :

it segfaults for all pythons now, including the -dbg versions.

the problematic code part looks pretty broken:
    //Python Object is not destroyed yet
    if (cppData && Shiboken::BindingManager::instance().hasWrapper(cppData)) {
        self->d->hasOwnership = false;
        // the cpp object instance was deleted
        delete[] self->d->cptr;
        self->d->cptr = 0;

it decrefs self to zero and then dereferences members again, before a certain commit the comment:
// After this point the object can be death do not use the self pointer bellow
was below the decref instead of at the end of the function, so this code is very likely broken.

unfortunately this is not even the cause of the crash, it already crashes on the decref above, exchanging the order of the code segments does not fix it.

commenting the decref (introducing a memleak) fixes python2 but python 3 still fails:
  70 - sample_duck_punching (SEGFAULT)
 150 - sample_static_nonstatic_methods (SEGFAULT)

Julian Taylor (jtaylor) wrote :

filed for the other failing tests
it also includes a hacky patch

Julian Taylor (jtaylor) wrote :

also filed for the python multiarch path issue

Matthias Klose (doko) on 2013-02-23
tags: added: ftbfs
Julian Taylor (jtaylor) wrote :

I prepared a debdiff which fixes the build
the segfault is "fixed" by exchanging it by a memleak, ugly but I don't know how to fix it

tags: added: patch
Changed in shiboken (Debian):
status: Unknown → New
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package shiboken - 1.1.2-2ubuntu1

shiboken (1.1.2-2ubuntu1) raring; urgency=low

  * python3.3-and-multiarch.patch:
    add python3.3 to list of python versions and deal with multiarch
    include paths
  * memleak-instead-crash.patch:
    to avoid crash on dereferencing object in tests introduce an intentional
    memleak until we have a proper fix (LP: #1070772)
  * static-override-fix.patch:
    fix broken static/non-static overloads in python3
  * update debian/shiboken-dbg.install and debian/rules makeshlibs override
    for new python abi suffixes not having "u"
 -- Julian Taylor <email address hidden> Sat, 23 Feb 2013 12:24:37 +0100

Changed in shiboken (Ubuntu):
status: Confirmed → Fix Released
Changed in shiboken (Debian):
status: New → Fix Released
Matthias Klose (doko) on 2013-09-18
Changed in python3.2 (Ubuntu):
status: New → Invalid
Changed in python2.7 (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.