comparison t/memcached-keepalive.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 8d8eaaf07663
children 489c5d4318ff
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(16) 23 my $t = Test::Nginx->new()->has('rewrite')->has_daemon('memcached')->plan(17)
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 master_process off;
29 daemon off; 28 daemon off;
30 29
31 events { 30 events {
32 } 31 }
33 32
200 199
201 is($memd1->stats()->{total}->{total_connections} + 200 is($memd1->stats()->{total}->{total_connections} +
202 $memd2->stats()->{total}->{total_connections}, $total + 2, 201 $memd2->stats()->{total}->{total_connections}, $total + 2,
203 'connection per backend'); 202 'connection per backend');
204 203
205 ############################################################################### 204 $t->stop();
205
206 like(`grep -F '[alert]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no alerts');
207
208 ###############################################################################