Mercurial > hg > ngx_http_upstream_keepalive
comparison t/stale.t @ 24:2ee28064a04a 0.4
Keepalive: correctly close connections on gracefull shutdown.
On gracefull shutdown nginx calls read handler on all idle connections with
c->close set. Make sure we don't confuse such read handler calls with stale
events and actually close connections. This fixes "open socket ... left
in connection ..." alerts.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 15 Dec 2010 21:12:36 +0300 |
parents | 9a4ee6fe1c6d |
children |
comparison
equal
deleted
inserted
replaced
23:cad8bc39d98d | 24:2ee28064a04a |
---|---|
18 select STDOUT; $| = 1; | 18 select STDOUT; $| = 1; |
19 | 19 |
20 eval { require Cache::Memcached; }; | 20 eval { require Cache::Memcached; }; |
21 plan(skip_all => 'Cache::Memcached not installed') if $@; | 21 plan(skip_all => 'Cache::Memcached not installed') if $@; |
22 | 22 |
23 my $t = Test::Nginx->new()->has('rewrite')->has_daemon('memcached')->plan(1) | 23 my $t = Test::Nginx->new()->has('rewrite')->has_daemon('memcached')->plan(2) |
24 ->write_file_expand('nginx.conf', <<'EOF'); | 24 ->write_file_expand('nginx.conf', <<'EOF'); |
25 | 25 |
26 %%TEST_GLOBALS%% | 26 %%TEST_GLOBALS%% |
27 | 27 |
28 daemon off; | 28 daemon off; |
105 } | 105 } |
106 | 106 |
107 cmp_ok($memd1->stats()->{total}->{total_connections}, '<=', $total + 2, | 107 cmp_ok($memd1->stats()->{total}->{total_connections}, '<=', $total + 2, |
108 'only one connection per worker used'); | 108 'only one connection per worker used'); |
109 | 109 |
110 $t->stop(); | |
111 | |
112 like(`grep -F '[alert]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no alerts'); | |
113 | |
110 ############################################################################### | 114 ############################################################################### |