#842 Python segfault when pybel & scipy.linalg imported

2.3.x
open
nobody
None
1
2012-11-13
2012-11-12
Anthony Bak
No

The following short python script ends in a segfault. I tested this on three different linux machines running ubuntu and archlinux


#!/usr/bin/env python

import pybel
import scipy.linalg


There is no segfault if you reverse the order of the import.

Some package information:

Package: python-openbabel
Status: install ok installed
Priority: optional
Section: python
Installed-Size: 3119
Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com
Architecture: amd64
Source: openbabel
Version: 2.3.0+dfsg-3ubuntu3
Provides: python2.7-openbabel
Depends: libc6 (>= 2.4), libgcc1 (>= 1:4.1.1), libopenbabel4, libstdc++6 (>= 4.4.0), python2.7, python (>= 2.7.1-0ubuntu2), python (<< 2.8)
Original-Maintainer: Debichem Team debichem-devel@lists.alioth.debian.org
Homepage: http://openbabel.sourceforge.net

Package: python-scipy
Status: install ok installed
Priority: extra
Section: python
Installed-Size: 24106
Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com
Architecture: amd64
Version: 0.9.0+dfsg1-1ubuntu2
Provides: python2.7-scipy
Depends: python-numpy (>= 1:1.6.1), python-numpy-abi9, python2.7, python (>= 2.7.1-0ubuntu2), python (<< 2.8), libblas3gf | libblas.so.3gf | libatlas3gf-base, libc6 (>= 2.14), libgcc1 (>= 1:4.1.1), libgfortran3 (>= 4.6), liblapack3gf | liblapack.so.3gf | libatlas3gf-base, libstdc++6 (>= 4.1.1), libumfpack5.4.0 (>= 1:3.4.0)

Discussion

  • Anthony Bak
    Anthony Bak
    2012-11-12

    Cross posted to the scipy bug tracker since I"m not sure which package is really at fault. http://projects.scipy.org/scipy/ticket/1772

     
  • Noel O'Boyle
    Noel O'Boyle
    2012-11-13

    (Crossposting is a bad idea.)

    The problem is that openbabel.py sets the DL loader flag. Try:
    import sys
    flags = sys.getdlopenflags()
    import pybel
    sys.setdlopenflags(flags)
    import scipy.linalg

     
  • Anthony Bak
    Anthony Bak
    2012-11-13

    Great. This works. Is this a bug or a feature? Meaning - does pybel need those flags set a certain way (so something else will break for me down the line) and if not, why leave them so that it causes problems with other packages? Maybe scipy should be checking something?

     
  • Noel O'Boyle
    Noel O'Boyle
    2012-11-13

    I believe it's needed so that instantiating OBConversion() will work (which loads the plugins). Again, I believe that resetting the flags will not affect anything. If you can test and let me know for sure, then I can look into moving the code inside OBConversion's init itself. At the moment, the code is at the start of openbabel.py.