diff --git a/core/async.c b/core/async.c index 110c211c..558c4e79 100644 --- a/core/async.c +++ b/core/async.c @@ -2,6 +2,13 @@ extern struct uwsgi_server uwsgi; +void uwsgi_async_queue_is_full(time_t now) { + if (now > uwsgi.async_queue_is_full) { + uwsgi_log_verbose("[DANGER] async queue is full !!!\n"); + uwsgi.async_queue_is_full = now; + } +} + void uwsgi_async_init() { int i; @@ -262,7 +269,7 @@ void async_loop() { int is_a_new_connection; int proto_parser_status; - uint64_t now, last_now = 0; + uint64_t now; static struct uwsgi_async_request *current_request = NULL, *next_async_request = NULL; @@ -340,10 +347,7 @@ void async_loop() { uwsgi.wsgi_req = find_first_available_wsgi_req(); if (uwsgi.wsgi_req == NULL) { - if (now > last_now) { - uwsgi_log("async queue is full !!!\n"); - last_now = now; - } + uwsgi_async_queue_is_full((time_t)now); break; } diff --git a/plugins/coroae/coroae.c b/plugins/coroae/coroae.c index f48bead1..fc7c0643 100644 --- a/plugins/coroae/coroae.c +++ b/plugins/coroae/coroae.c @@ -36,10 +36,12 @@ static struct wsgi_request *coroae_current_wsgi_req(void) { } } uwsgi_log("[BUG] current_wsgi_req NOT FOUND !!!\n"); + // TODO allow to survive api call error as in the python plugin exit(1); } +// create a new coro SV * coroae_coro_new(CV *block) { SV *newobj = NULL; dSP; @@ -179,7 +181,7 @@ edge: wsgi_req = find_first_available_wsgi_req(); if (wsgi_req == NULL) { - uwsgi_log("async queue is full !!!\n"); + uwsgi_async_queue_is_full(uwsgi_now()); goto clear; } diff --git a/plugins/gevent/gevent.c b/plugins/gevent/gevent.c index 2af8e404..2bb785b1 100644 --- a/plugins/gevent/gevent.c +++ b/plugins/gevent/gevent.c @@ -144,7 +144,7 @@ edge: wsgi_req = find_first_available_wsgi_req(); if (wsgi_req == NULL) { - uwsgi_log("async queue is full !!!\n"); + uwsgi_async_queue_is_full(uwsgi_now()); goto clear; } diff --git a/uwsgi.h b/uwsgi.h index d30bdbff..2de2abf3 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -1956,6 +1956,8 @@ struct uwsgi_server { int async_queue; int async_nevents; + time_t async_queue_is_full; + int max_vars; int vec_size; @@ -3846,6 +3848,8 @@ int uwsgi_exceptions_catch(struct wsgi_request *); uint64_t uwsgi_worker_exceptions(int); struct uwsgi_exception_handler *uwsgi_register_exception_handler(char *, int (*)(struct uwsgi_exception_handler_instance *, char *, size_t)); +void uwsgi_async_queue_is_full(time_t); + #define uwsgi_response_add_connection_close(x) uwsgi_response_add_header(x, "Connection", 10, "close", 5) #define uwsgi_response_add_content_type(x, y, z) uwsgi_response_add_header(x, "Content-Type", 12, y, z)