Fix max-connection limit handling/100% cpu usage (fixes #1436)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2387 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.21
Stefan Bühler 2009-02-05 10:53:24 +00:00
parent f0bbc7468c
commit 24d08807c5
2 changed files with 4 additions and 3 deletions

1
NEWS
View File

@ -33,6 +33,7 @@ NEWS
* Allow mod_compress to return 304 (Not Modified); compress ignores the static-file.etags option.(fixes #1884)
* Add option to ignore the "Expect: 100-continue" header instead of returning 417 Expectation failed (closes #1017)
* Use modified etags in mod_compress (fixes #1800)
* Fix max-connection limit handling/100% cpu usage (fixes #1436)
- 1.4.20 - 2008-09-30

View File

@ -1298,7 +1298,7 @@ int main (int argc, char **argv) {
/* our server sockets are disabled, why ? */
if ((srv->cur_fds + srv->want_fds < srv->max_fds * 8 / 10) && /* we have enough unused fds */
(srv->conns->used < srv->max_conns * 0.9) &&
(srv->conns->used <= srv->max_conns * 9 / 10) &&
(0 == graceful_shutdown)) {
for (i = 0; i < srv->srv_sockets.used; i++) {
server_socket *srv_socket = srv->srv_sockets.ptr[i];
@ -1311,7 +1311,7 @@ int main (int argc, char **argv) {
}
} else {
if ((srv->cur_fds + srv->want_fds > srv->max_fds * 9 / 10) || /* out of fds */
(srv->conns->used > srv->max_conns) || /* out of connections */
(srv->conns->used >= srv->max_conns) || /* out of connections */
(graceful_shutdown)) { /* graceful_shutdown */
/* disable server-fds */
@ -1350,7 +1350,7 @@ int main (int argc, char **argv) {
if (graceful_shutdown) {
log_error_write(srv, __FILE__, __LINE__, "s", "[note] graceful shutdown started");
} else if (srv->conns->used > srv->max_conns) {
} else if (srv->conns->used >= srv->max_conns) {
log_error_write(srv, __FILE__, __LINE__, "s", "[note] sockets disabled, connection limit reached");
} else {
log_error_write(srv, __FILE__, __LINE__, "s", "[note] sockets disabled, out-of-fds");