diff --git a/plugins/python/pyloader.c b/plugins/python/pyloader.c index eef6c92c..11ec3452 100644 --- a/plugins/python/pyloader.c +++ b/plugins/python/pyloader.c @@ -378,12 +378,9 @@ PyObject *uwsgi_uwsgi_loader(void *arg1) { if (applications && PyDict_Check(applications)) return applications; - uwsgi_log("QUICK CALLABLE = %s\n", quick_callable); applications = PyDict_GetItemString(wsgi_dict, "applications"); if (applications && PyDict_Check(applications)) return applications; - uwsgi_log("QUICK CALLABLE = %s\n", quick_callable); - // quick callable -> thanks gunicorn for the idea // we have extended the concept a bit... if (quick_callable[strlen(quick_callable) -2 ] == '(' && quick_callable[strlen(quick_callable) -1] ==')') { diff --git a/plugins/python/pyutils.c b/plugins/python/pyutils.c index c335f071..21a188a5 100644 --- a/plugins/python/pyutils.c +++ b/plugins/python/pyutils.c @@ -19,6 +19,7 @@ PyObject *python_call(PyObject *callable, PyObject *args, int catch) { if (PyErr_ExceptionMatches(PyExc_MemoryError)) { uwsgi_log("Memory Error detected !!!\n"); } + uwsgi.workers[uwsgi.mywid].exceptions++; if (!catch) { PyErr_Print(); } diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index 83c8460d..32eda062 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -1722,6 +1722,12 @@ clear: } Py_DECREF(zero); + zero = PyInt_FromLong(uwsgi.workers[i + 1].exceptions); + if (PyDict_SetItemString(worker_dict, "exceptions", zero)) { + goto clear; + } + Py_DECREF(zero); + zero = PyInt_FromLong(uwsgi.workers[i + 1].rss_size); if (PyDict_SetItemString(worker_dict, "rss", zero)) { goto clear; diff --git a/plugins/python/wsgi_subhandler.c b/plugins/python/wsgi_subhandler.c index 6f027b98..36f90c63 100644 --- a/plugins/python/wsgi_subhandler.c +++ b/plugins/python/wsgi_subhandler.c @@ -169,6 +169,7 @@ int uwsgi_response_subhandler_wsgi(struct wsgi_request *wsgi_req) { if (PyErr_ExceptionMatches(PyExc_MemoryError)) { uwsgi_log("Memory Error detected !!!\n"); } + uwsgi.workers[uwsgi.mywid].exceptions++; PyErr_Print(); } goto clear; diff --git a/uwsgi.h b/uwsgi.h index 63551bd4..4946b5a5 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -589,6 +589,7 @@ struct wsgi_request { int log_this; + }; struct uwsgi_fmon { @@ -883,6 +884,7 @@ struct uwsgi_server { void *timer_table_lock; void *rpc_table_lock; + }; struct uwsgi_rpc { @@ -1045,6 +1047,8 @@ struct uwsgi_worker { int manage_next_request; + uint64_t exceptions; + }; diff --git a/uwsgicc/templates/index.html b/uwsgicc/templates/index.html index f78dd8df..014304c2 100644 --- a/uwsgicc/templates/index.html +++ b/uwsgicc/templates/index.html @@ -247,6 +247,7 @@ $(document).ready(function() {