I've got a WSGI app that calls _mssql.connect() (pymssql package) to connect to an MS SQL database for reading. It was working fine with an older version of pymssql but with recent versions the call to connect() hangs. The httpd/mod_wsgi process is stalled until I restart Apace. So I'm looking for help figuring out what is going wrong.
I've created a trivial program that calls _mssql.connect() with both WSGI and shell wrappers. It works fine from the python shell but hangs every time when run in mod_wsgi.
When I watch the mod_wsgi process with strace I see it connecting to the MS SQL Server host over a socket and sending some traffic. It then calls futex() and hangs; nothing more happens until the process gets SIGKILL.
Here is the context.
OS: Red Hat Enterprise Linux 6.4, 64bit
Python: 2.7.5, built from source, multi-threading enabled, shared libraries enabled.
mod_wsgi: version 3.4, built from source, against Python 2.7.5 (above).
Apache: 2.2.5, from RHEL 6. Neither mod_php nor mod_python is installed.
freetds: 0.91 from RHEL 6.
pymssql: Various versions. The latest stable, 2.0.1 from pip, fails. Revision 221 from
https://code.google.com/p/pymssql is the most recent one that I've found to work.
Python configuration: installed into virtualenv.
mod_wsgi configuration: embedded mode. WSGIPythonHome set to a virtualenv.