I am trying to execute a shell command and kill it with the python signal module.
I know that signals only work with the main thread, so I start the Django development server with
python manage.py runserver --nothreading --noreload
and it works great.
But when I deploy the django application with Apache / mod_wsgi, it shows the following error:
[Fri Sep 12 20:07:00 2014] [error] response = function.call(request, **data) [Fri Sep 12 20:07:00 2014] [error] File "/Site/cloud/lib/python2.6/site-packages/dajaxice/core/Dajaxice.py", line 18, in call [Fri Sep 12 20:07:00 2014] [error] return self.function(*args, **kwargs) [Fri Sep 12 20:07:00 2014] [error] File "/Site/cloud/soc/website/ajax.py", line 83, in execute [Fri Sep 12 20:07:00 2014] [error] data = scilab_run(code, token, book_id, dependency_exists) [Fri Sep 12 20:07:00 2014] [error] File "/Site/cloud/soc/website/helpers.py", line 58, in scilab_run [Fri Sep 12 20:07:00 2014] [error] output = task.run().communicate()[0] [Fri Sep 12 20:07:00 2014] [error] File "/Site/cloud/soc/website/timeout.py", line 121, in run [Fri Sep 12 20:07:00 2014] [error] lambda sig,frame : os.killpg(self.pgid,self.timeoutSignal) ) [Fri Sep 12 20:07:00 2014] [error] ValueError: signal only works in main thread
Here is my apache virtual host setup:
WSGIDaemonProcess testcloud display-name=scilab_cloud user=apache group=apache threads=1 WSGIProcessGroup testcloud WSGIScriptAlias / /Site/cloud/soc/soc/wsgi.py WSGIImportScript /Site/cloud/soc/soc/wsgi.py process-group=testcloud application-group=%{GLOBAL}
I also have the following settings outside virtualhost in httpd.conf:
WSGIRestrictSignal Off WSGISocketPrefix /var/run/wsgi
Here is a link to a program that uses a signal and one that I use in my django application.
Any help would be greatly appreciated.
python django signals apache mod-wsgi
Jayaram r pai
source share