improved process limit detection

This commit is contained in:
roberto@quantal64
2012-09-07 14:54:57 +02:00
parent d932a4feae
commit f2e27f5154
2 changed files with 11 additions and 1 deletions
+1
View File
@@ -1112,6 +1112,7 @@ void sanitize_args() {
uwsgi.ignore_write_errors = 1;
}
if (uwsgi.cheaper_count > 0 && uwsgi.cheaper_count >= uwsgi.numproc) {
uwsgi_log("invalid cheaper value: must be lower than processes\n");
exit(1);
+10 -1
View File
@@ -1938,6 +1938,16 @@ int uwsgi_start(void *v_argv) {
uwsgi_error("setrlimit()");
}
}
if (!getrlimit(RLIMIT_NPROC, &uwsgi.rl_nproc)) {
if (uwsgi.rl_nproc.rlim_cur != RLIM_INFINITY) {
uwsgi_log("your processes number limit is %d\n", (int) uwsgi.rl_nproc.rlim_cur);
if ((int)uwsgi.rl_nproc.rlim_cur < uwsgi.numproc+uwsgi.master_process) {
uwsgi.numproc = uwsgi.rl_nproc.rlim_cur - 1;
uwsgi_log("!!! number of workers adjusted to %d due to system limits !!!\n", uwsgi.numproc);
}
}
}
#endif
#ifndef __OpenBSD__
@@ -1970,7 +1980,6 @@ int uwsgi_start(void *v_argv) {
}
#endif
uwsgi_log_initial("your memory page size is %d bytes\n", uwsgi.page_size);
if (uwsgi.buffer_size > 65536) {