mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-08-19 12:06:36 +00:00
prepare for 2.0-rc1
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
||||
[uwsgi]
|
||||
main_plugin = python,gevent,psgi,lua,php,rack,jvm,jwsgi,ring,mono,transformation_toupper,coroae,v8,cgi,xslt,webdav,ssi,ldap,gccgo,rados,pypy
|
||||
main_plugin = python,gevent,psgi,lua,php,rack,jvm,jwsgi,ring,mono,transformation_toupper,coroae,v8,cgi,xslt,webdav,ssi,ldap,gccgo,rados,pypy,zabbix,curl_cron,tornado,tuntap,pty,mongrel2,alarm_curl,router_radius,airbrake
|
||||
inherit = base
|
||||
|
||||
+10
-6
@@ -222,7 +222,7 @@ static void get_linux_unbit_SIOBKLGQ(struct uwsgi_socket *uwsgi_sock) {
|
||||
|
||||
static void master_check_listen_queue() {
|
||||
|
||||
uint64_t load = 0;
|
||||
uint64_t backlog = 0;
|
||||
struct uwsgi_socket *uwsgi_sock = uwsgi.sockets;
|
||||
while(uwsgi_sock) {
|
||||
if (uwsgi_sock->family == AF_INET) {
|
||||
@@ -236,8 +236,8 @@ static void master_check_listen_queue() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (uwsgi_sock->queue > load) {
|
||||
load = uwsgi_sock->queue;
|
||||
if (uwsgi_sock->queue > backlog) {
|
||||
backlog = uwsgi_sock->queue;
|
||||
}
|
||||
if (uwsgi_sock->queue > 0 && uwsgi_sock->queue >= uwsgi_sock->max_queue) {
|
||||
uwsgi_log_verbose("*** uWSGI listen queue of socket \"%s\" (fd: %d) full !!! (%llu/%llu) ***\n", uwsgi_sock->name, uwsgi_sock->fd, (unsigned long long) uwsgi_sock->queue, (unsigned long long) uwsgi_sock->max_queue);
|
||||
@@ -245,16 +245,20 @@ static void master_check_listen_queue() {
|
||||
uwsgi_sock = uwsgi_sock->next;
|
||||
}
|
||||
|
||||
uwsgi.shared->load = load;
|
||||
// TODO load should be something more advanced based on different values
|
||||
uwsgi.shared->load = backlog;
|
||||
|
||||
uwsgi.shared->backlog = backlog;
|
||||
|
||||
if (uwsgi.vassal_sos_backlog > 0 && uwsgi.has_emperor) {
|
||||
if (uwsgi.shared->load >= (uint64_t) uwsgi.vassal_sos_backlog) {
|
||||
if (uwsgi.shared->backlog >= (uint64_t) uwsgi.vassal_sos_backlog) {
|
||||
// ask emperor for help
|
||||
char byte = 30;
|
||||
if (write(uwsgi.emperor_fd, &byte, 1) != 1) {
|
||||
uwsgi_error("write()");
|
||||
}
|
||||
else {
|
||||
uwsgi_log_verbose("asking Emperor for reinforcements (backlog: %llu)...\n", (unsigned long long) uwsgi.shared->load);
|
||||
uwsgi_log_verbose("asking Emperor for reinforcements (backlog: %llu)...\n", (unsigned long long) uwsgi.shared->backlog);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -332,7 +332,7 @@ int uwsgi_cheaper_algo_backlog(int can_spawn) {
|
||||
|
||||
int i;
|
||||
#ifdef __linux__
|
||||
int backlog = uwsgi.shared->load;
|
||||
int backlog = uwsgi.shared->backlog;
|
||||
#else
|
||||
int backlog = 0;
|
||||
#endif
|
||||
@@ -728,9 +728,9 @@ struct uwsgi_stats *uwsgi_master_generate_stats() {
|
||||
goto end;
|
||||
|
||||
#ifdef __linux__
|
||||
if (uwsgi_stats_keylong_comma(us, "listen_queue", (unsigned long long) uwsgi.shared->load))
|
||||
if (uwsgi_stats_keylong_comma(us, "listen_queue", (unsigned long long) uwsgi.shared->backlog))
|
||||
goto end;
|
||||
if (uwsgi_stats_keylong_comma(us, "listen_queue_errors", (unsigned long long) uwsgi.shared->load))
|
||||
if (uwsgi_stats_keylong_comma(us, "listen_queue_errors", (unsigned long long) uwsgi.shared->backlog_errors))
|
||||
goto end;
|
||||
#endif
|
||||
|
||||
|
||||
+1
-1
@@ -1656,7 +1656,7 @@ static char *uwsgi_route_var_uwsgi(struct wsgi_request *wsgi_req, char *key, uin
|
||||
}
|
||||
|
||||
else if (!uwsgi_strncmp(key, keylen, "lq", 2)) {
|
||||
ret = uwsgi_num2str(uwsgi.shared->load);
|
||||
ret = uwsgi_num2str(uwsgi.shared->backlog);
|
||||
*vallen = strlen(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -222,8 +222,8 @@ static void uwsgi_airbrake_loop(struct uwsgi_thread *ut) {
|
||||
// ARGH !!!
|
||||
if (!curl) return;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]);
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, uwsgi.socket_timeout);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, uwsgi.socket_timeout);
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, NULL);
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, ut);
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1L);
|
||||
|
||||
@@ -146,8 +146,8 @@ static void uwsgi_alarm_curl_loop(struct uwsgi_thread *ut) {
|
||||
// ARGH !!!
|
||||
if (!curl) return;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]);
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, uwsgi.socket_timeout);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, uwsgi.socket_timeout);
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, uwsgi_alarm_curl_read_callback);
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, ut);
|
||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
|
||||
@@ -17,7 +17,7 @@ int cheaper_backlog2_algo(int can_spawn) {
|
||||
|
||||
int i;
|
||||
#ifdef __linux__
|
||||
int backlog = uwsgi.shared->options[UWSGI_OPTION_BACKLOG_STATUS];
|
||||
int backlog = uwsgi.socket_timeout;
|
||||
#else
|
||||
int backlog = 0;
|
||||
#endif
|
||||
|
||||
@@ -164,7 +164,7 @@ int cheaper_busyness_algo(int can_spawn) {
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
int backlog = uwsgi.shared->load;
|
||||
int backlog = uwsgi.shared->backlog;
|
||||
#endif
|
||||
|
||||
uint64_t now = uwsgi_micros();
|
||||
|
||||
@@ -10,7 +10,7 @@ static void curl_cron_func(struct uwsgi_cron *uc, time_t now) {
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, uc->command);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]);
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, uwsgi.socket_timeout);
|
||||
// use 1 minute as the cron resolution
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 60);
|
||||
uwsgi_log("[uwsgi-curl-cron] requesting %s\n", uc->command);
|
||||
|
||||
@@ -25,7 +25,7 @@ extern "C" void uwsgi_imperial_monitor_mongodb(struct uwsgi_emperor_scanner *ues
|
||||
// the connection object (will be automatically destroyed at each cycle)
|
||||
mongo::DBClientConnection c;
|
||||
// set the socket timeout
|
||||
c.setSoTimeout(uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]);
|
||||
c.setSoTimeout(uwsgi.socket_timeout);
|
||||
// connect
|
||||
c.connect(uems->address);
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ static void uwsgi_glusterfs_add_mountpoint(char *arg, size_t arg_len) {
|
||||
static void uwsgi_glusterfs_setup() {
|
||||
|
||||
if (!uglusterfs.timeout) {
|
||||
uglusterfs.timeout = uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT];
|
||||
uglusterfs.timeout = uwsgi.socket_timeout;
|
||||
}
|
||||
|
||||
struct uwsgi_string_list *usl = uglusterfs.mountpoints;
|
||||
|
||||
@@ -169,7 +169,7 @@ static struct uwsgi_gridfs_mountpoint *uwsgi_gridfs_add_mountpoint(char *arg, si
|
||||
ugm->timeout = atoi(ugm->timeout_str);
|
||||
}
|
||||
else {
|
||||
ugm->timeout = uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT];
|
||||
ugm->timeout = uwsgi.socket_timeout;
|
||||
}
|
||||
|
||||
if (ugm->prefix) {
|
||||
|
||||
+1
-1
@@ -292,7 +292,7 @@ static int uwsgi_pty_client() {
|
||||
uwsgi.restore_tc = 1;
|
||||
}
|
||||
|
||||
upty.server_fd = uwsgi_connect(remote, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT], 0);
|
||||
upty.server_fd = uwsgi_connect(remote, uwsgi.socket_timeout, 0);
|
||||
if (upty.server_fd < 0) {
|
||||
uwsgi_error("uwsgi_pty_client()/connect()");
|
||||
exit(1);
|
||||
|
||||
@@ -104,7 +104,7 @@ static uint16_t uwsgi_radius_auth(struct uwsgi_radius_conf *urc, char *auth, siz
|
||||
}
|
||||
|
||||
// now wait for the response
|
||||
int ret = uwsgi.wait_read_hook(fd, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]);
|
||||
int ret = uwsgi.wait_read_hook(fd, uwsgi.socket_timeout);
|
||||
if (ret <= 0) goto end;
|
||||
|
||||
ssize_t rlen = read(fd, access_request, access_request_len);
|
||||
|
||||
@@ -40,7 +40,7 @@ extern "C" void stats_pusher_mongodb(struct uwsgi_stats_pusher_instance *uspi, t
|
||||
// the connection object (will be automatically destroyed at each cycle)
|
||||
mongo::DBClientConnection c;
|
||||
// set the socket timeout
|
||||
c.setSoTimeout(uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]);
|
||||
c.setSoTimeout(uwsgi.socket_timeout);
|
||||
// connect
|
||||
c.connect(spmc->address);
|
||||
c.insert(spmc->collection, b);
|
||||
|
||||
@@ -20,8 +20,8 @@ static void uwsgi_opt_setup_tornado(char *opt, char *value, void *null) {
|
||||
|
||||
// set async mode
|
||||
uwsgi_opt_set_int(opt, value, &uwsgi.async);
|
||||
if (uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT] < 30) {
|
||||
uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT] = 30;
|
||||
if (uwsgi.socket_timeout < 30) {
|
||||
uwsgi.socket_timeout = 30;
|
||||
}
|
||||
// set loop engine
|
||||
uwsgi.loop = "tornado";
|
||||
@@ -234,8 +234,8 @@ PyObject *py_uwsgi_tornado_accept(PyObject *self, PyObject *args) {
|
||||
wsgi_req->start_of_request_in_sec = wsgi_req->start_of_request/1000000;
|
||||
|
||||
// enter harakiri mode
|
||||
if (uwsgi.shared->options[UWSGI_OPTION_HARAKIRI] > 0) {
|
||||
set_harakiri(uwsgi.shared->options[UWSGI_OPTION_HARAKIRI]);
|
||||
if (uwsgi.harakiri_options.workers > 0) {
|
||||
set_harakiri(uwsgi.harakiri_options.workers);
|
||||
}
|
||||
|
||||
uwsgi.async_proto_fd_table[wsgi_req->fd] = wsgi_req;
|
||||
@@ -322,7 +322,7 @@ static void tornado_loop() {
|
||||
uwsgi_log("!!! Running tornado without threads IS NOT recommended, enable them with --enable-threads !!!\n");
|
||||
}
|
||||
|
||||
if (uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT] < 30) {
|
||||
if (uwsgi.socket_timeout < 30) {
|
||||
uwsgi_log("!!! Running tornado with a socket-timeout lower than 30 seconds is not recommended, tune it with --socket-timeout !!!\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -500,7 +500,7 @@ void tuntaprouter_send_stats(struct uwsgi_tuntap_router *uttr) {
|
||||
size_t remains = us->pos;
|
||||
off_t pos = 0;
|
||||
while(remains > 0) {
|
||||
int ret = uwsgi_waitfd_write(client_fd, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]);
|
||||
int ret = uwsgi_waitfd_write(client_fd, uwsgi.socket_timeout);
|
||||
if (ret <= 0) {
|
||||
goto end0;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ end:
|
||||
|
||||
if (error) return;
|
||||
|
||||
int fd = uwsgi_connect(zn->addr, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT], 0);
|
||||
int fd = uwsgi_connect(zn->addr, uwsgi.socket_timeout, 0);
|
||||
if (fd < 0) {
|
||||
uwsgi_error("stats_pusher_zabbix()/connect()");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user