pythonapachemod-wsgipylucenejcc

jcc.initVM() doesn't return when mod_wsgi is configured as daemon mode


I am using mod-wsgi with django, and in django I use pylucene to do full text search.

While mod-wsgi is configured to be embedded mode, there is no problem at all. But when mod-wsgi is configured to be daemon mode, the apache just gets stuck, and the browser just keep loading but nothing appears.

Then I identity the problem to be the jcc.initVM(). Here is my wsgi script:

import os, sys, jcc
sys.stderr.write('jcc.initVM\n')
jcc.initVM()
sys.stderr.write('finished jcc.initVM\n')
....

After I restart my apache, and make a request from my browser, I find that /var/log/apache2/error.log only has:

jcc.initVM

Meaning that it gets stuck at the line jcc.initVM(). (If the mod_wsgi is configured as embedded mode, there is no problem.)

And here is my /etc/apache2/sites-available/default:

WSGIDaemonProcess site user=ross group=ross threads=1
WSGIProcessGroup site
WSGIScriptAlias / /home/ross/apache/django.wsgi

<Directory /home/ross/apache/>
  Order deny,allow
  Allow from all
</Directory>

And finally, I find out that in the source code of jcc (jcc.cpp), it hangs at the function:

JNI_CreateJavaVM(&vm, (void **) &vm_env, &vm_args)

How to solve the problem?

Program versions:

libapache2-mod-wsgi 2.3-1
jcc 2.1
python 2.5
Apache 2.2.9-8ubuntu3
Ubuntu 8.10

Solution

  • The fix for this problem was included in mod_wsgi 2.4.