Welcome! Log In Create A New Profile

Advanced

[nginx] Cache: proper wakeup of subrequests.

Maxim Dounin
December 01, 2014 09:58PM
details: http://hg.nginx.org/nginx/rev/f436e9a60b8f
branches:
changeset: 5929:f436e9a60b8f
user: Maxim Dounin <mdounin@mdounin.ru>
date: Tue Dec 02 05:54:56 2014 +0300
description:
Cache: proper wakeup of subrequests.

In case of a cache lock timeout and in the aio handler we now call
r->write_event_handler() instead of a connection write handler,
to make sure to run appropriate subrequest. Previous code failed to run
inactive subrequests and hence resulted in suboptimal behaviour, see
report by Yichun Zhang:

http://mailman.nginx.org/pipermail/nginx-devel/2013-October/004435.html

(Infinite hang claimed in the report seems impossible without 3rd party
modules, as subrequests will be eventually woken up by the postpone filter.)

diffstat:

src/http/ngx_http_file_cache.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

diffs (32 lines):

diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -462,6 +462,8 @@ ngx_http_file_cache_lock_wait_handler(ng
"http file cache wait: \"%V?%V\"", &r->uri, &r->args);

ngx_http_file_cache_lock_wait(r, r->cache);
+
+ ngx_http_run_posted_requests(c);
}


@@ -505,7 +507,7 @@ wakeup:

c->waiting = 0;
r->main->blocked--;
- r->connection->write->handler(r->connection->write);
+ r->write_event_handler(r);
}


@@ -692,7 +694,9 @@ ngx_http_cache_aio_event_handler(ngx_eve
r->main->blocked--;
r->aio = 0;

- r->connection->write->handler(r->connection->write);
+ r->write_event_handler(r);
+
+ ngx_http_run_posted_requests(c);
}

#endif

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Cache: proper wakeup of subrequests.

Maxim Dounin 488 December 01, 2014 09:58PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 239
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready