Search code examples
djangosegmentation-faultdjango-south

Django South Seg Fault


I just updated from Ubuntu 12.04 to 13.04, and I am having issues migrating some code that used to work. Googling does not reveal anything that obviously looks related except some obscure R references, and though my project does use R I would not expect it to crop up in migrations. I have never dealt with debugging seg faults before, much less in 3rd party code. How should I proceed?

(project)ben@Watt:~/Projects/project/project$ python project/manage.py migrate
Error: 'rho' must be an environment not NULL: detected in C-level eval
Segmentation fault (core dumped)

EDIT: It looks like a problem with rpy2, found using the ltrace from the answer below. Still wondering how that came up in migrate.

EDIT2: My R version had been updated beyond what Rpy2 likes. Reverting fixed things. How this came up in ./manage.py migrate is mysterious to me.


Solution

  • I would start by using strace since that's already installed on many systems. That might enable you to narrow down which module is currently executing based on the system calls made. eg

    $ strace -o ~/tmp/strace.log -f python project/manage.py migrate
    

    or, install ltrace and view the sequence of calls.

    $ sudo apt-get install ltrace
    $ ltrace python project/manage.py migrate
    

    Failing that, since the core has been dumped, you can use gdb on the core to see exactly where the problem occurred

    $ gdb core
    

    The use commands such as bt to show a stack trace. To make this easier, you may need to find executables/libraries that have debugging symbols available.