Ich versuche, einen Shell-Befehl auszuführen und es mit Python Signal Modul zu töten.ValueError: Signal funktioniert nur im Haupt-Thread - Django - mod_wsgi
Ich weiß Signale arbeiten nur mit Haupt-Thread, so dass ich laufen die Entwicklung Django-Server mit,
python manage.py runserver --nothreading --noreload
und es funktioniert gut.
Aber wenn ich die django-Anwendung mit Apache/mod_wsgi bereitstellen, zeigt es die folgenden Fehler:
[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
Hier ist meine Apache Virtualhost-Einstellung:
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}
Ich habe auch die folgenden Einstellungen außerhalb Virtualhost in httpd.conf:
WSGIRestrictSignal Off
WSGISocketPrefix /var/run/wsgi
Here is the link auf die pro Gramm, das Signal verwendet und das, das ich in meiner Django-Anwendung verwende.
Jede Hilfe wäre willkommen.