This is now officially off-topic since the problem is in the Python
SQLite wrappers and Apache instead of the SQLite C code.  Regardless, I
would like to post the cause and solution so that anybody who ends up
here while doing a web search will know the solution.

> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1208731424 (LWP 20956)] PyDict_GetItem 
> (op=0x0, key=0xb7c25e4c) at Objects/dictobject.c:571
> 571             if (!PyDict_Check(op))
> (gdb) bt full
> #0  PyDict_GetItem (op=0x0, key=0xb7c25e4c) at 
> Objects/dictobject.c:571
>         hash = 5854612
>         ep = (dictentry *) 0x595594
>         tstate = (PyThreadState *) 0x0
> #1  0x0058da34 in ?? ()
> No symbol table info available.
> #2  0x00000000 in ?? ()
> No symbol table info available.
> 
> Since SQLite works fine at the command line and fine with the 
> Python interpreter, but fails when invoked with mod_python 
> and mod_wsgi through Apache, then I'm assuming that there is 
> either an odd threading issue or something is not being setup 
> correctly in the Apache/mod_* chain.

Background
----------

I installed SQLite, Python, mod_python, and mod_wsgi from source and
started getting the segmentation faults.  Recompiling Apache from the
http.spec source solved the segmentation fault.  Now I was able to get a
more sane SystemError response when connecting to the SQLite database
(either file-based or memory based).

System Information
------------------
RHEL AS 4
Apache Version: 2.0.52
SQLite Version: 3.5.9
SQLite Threadsafety: 1
Python Version: 2.5.2
PySQLite Version: 2.3.2
Mod_python Version: 3.3.1
Mod_wsgi Version: 2.0

Executing this code
-------------------
con = sqlite3.connect(':memory:')

Results in the following error
------------------------------
SystemError: NULL result without error in PyObject_Call

Cause & Solution
----------------
It turns out that this was a symbol clash between the SQLite library
built into Python 2.5 (PySQLite version 2.3.2) and Apache's
mod_mem_cache module.  There are several possible solutions:

 1. Disable the mod_cache and associated mod_*_cash modules in Apache
 2. Install a newer version of PySQLite > 2.3.2 and then do the
following changes

# Change this
import sqlite3

# to this
from pysqlite2 import dbapi2 as sqlite3

 3. Remove the existing sqlite3 module in Python 2.5 and replace it with
a module that does a from pysqlite2.dbapi2 import *

See the following trouble ticket for more info:
 * http://oss.itsystementwicklung.de/trac/pysqlite/ticket/146


I hope this helps somebody out there.

Regards,

Eric Holmberg
Applications Engineer, Arrow Electronics
Denver, Colorado


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to