mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-06-16 02:15:48 +00:00
fixed exception management in python mules and improved uwsgidecorators
This commit is contained in:
+2
-1
@@ -245,7 +245,7 @@ void uwsgi_manage_exception(struct wsgi_request *wsgi_req,int catch) {
|
||||
goto check_catch;
|
||||
}
|
||||
|
||||
if (!wsgi_req) goto log;
|
||||
if (!wsgi_req) goto log2;
|
||||
|
||||
uwsgi.workers[uwsgi.mywid].cores[wsgi_req->async_id].exceptions++;
|
||||
uwsgi_apps[wsgi_req->app_id].exceptions++;
|
||||
@@ -311,6 +311,7 @@ log:
|
||||
uwsgi.p[wsgi_req->uh->modifier1]->exception_log(wsgi_req);
|
||||
}
|
||||
|
||||
log2:
|
||||
if (do_exit) {
|
||||
exit(UWSGI_EXCEPTION_CODE);
|
||||
}
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ void uwsgi_mule(int id) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->mule) {
|
||||
if (uwsgi.p[i]->mule(uwsgi.mules[id - 1].patch) == 1) {
|
||||
// never here
|
||||
// never here ?
|
||||
end_me(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +208,12 @@ PyObject *python_call(PyObject *callable, PyObject *args, int catch, struct wsgi
|
||||
//uwsgi_log("called\n");
|
||||
|
||||
if (PyErr_Occurred()) {
|
||||
uwsgi_manage_exception(wsgi_req, catch);
|
||||
if (wsgi_req) {
|
||||
uwsgi_manage_exception(wsgi_req, catch);
|
||||
}
|
||||
else {
|
||||
PyErr_Print();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UWSGI_DEBUG
|
||||
|
||||
+13
-2
@@ -1,4 +1,5 @@
|
||||
import uwsgi
|
||||
import sys
|
||||
from threading import Thread
|
||||
|
||||
try:
|
||||
@@ -170,7 +171,12 @@ class mule_brain(object):
|
||||
|
||||
def __call__(self):
|
||||
if uwsgi.mule_id() == self.num:
|
||||
self.f()
|
||||
try:
|
||||
self.f()
|
||||
except:
|
||||
exc = sys.exc_info()
|
||||
sys.excepthook(exc[0], exc[1], exc[2])
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
class mule_brainloop(mule_brain):
|
||||
@@ -178,7 +184,12 @@ class mule_brainloop(mule_brain):
|
||||
def __call__(self):
|
||||
if uwsgi.mule_id() == self.num:
|
||||
while True:
|
||||
self.f()
|
||||
try:
|
||||
self.f()
|
||||
except:
|
||||
exc = sys.exc_info()
|
||||
sys.excepthook(exc[0], exc[1], exc[2])
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
class mule(object):
|
||||
|
||||
Reference in New Issue
Block a user