args-fdexhaustion-sighup.pl revision 1.2
1# The syslogd is started with reduced file descriptor limits.
2# The syslogd config is reread after SIGHUP.
3# The client writes a message to Sys::Syslog native method.
4# The syslogd writes it into a file and through a pipe.
5# The syslogd passes it via UDP to the loghost.
6# The server receives the message on its UDP socket.
7# Find the message in client, file, pipe, syslogd, server log.
8# Check the error messages and multiple log file content.
9
10use strict;
11use warnings;
12use Cwd;
13
14my $objdir = getcwd();
15
16our %args = (
17    client => {
18	func => sub { write_between2logs(shift, sub {
19	    my $self = shift;
20	    ${$self->{server}}->loggrep("Signal", 8)
21		or die ref($self), " no 'Signal' between logs";
22	})},
23	loggrep => { get_between2loggrep() },
24    },
25    syslogd => {
26	conf => join("", map { "*.*\t$objdir/file-$_.log\n" } 0..19),
27	rlimit => {
28	    RLIMIT_NOFILE => 30,
29	},
30	loggrep => {
31	    # If not in startup, each failed PRIV_OPEN_LOG is logged
32	    # to tty, so PRIV_OPEN_TTY fails again.
33	    qr/syslogd: receive_fd: recvmsg: Message too long/ => 4+2*3,
34	    # During first initialization the lockpipe is open.  When
35	    # SIGHUP happens it is closed and one more file can be opened.
36	    qr/X FILE:/ => 1+16+1+17,
37	    qr/X UNUSED:/ => 4+3,
38	},
39    },
40    server => {
41	func => sub { read_between2logs(shift, sub {
42	    my $self = shift;
43	    ${$self->{syslogd}}->kill_syslogd('HUP');
44	    ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
45		or die ref($self), " no 'syslogd: restarted' between logs";
46	    print STDERR "Signal\n";
47	})},
48	loggrep => {
49	    get_between2loggrep(),
50	    qr/Signal/ => 1,
51	    qr/Accepted/ => 1,
52	},
53    },
54    multifile => [
55	(map { { loggrep => get_testgrep() } } 0..16),
56	(map { { loggrep => { qr/./s => 0 } } } 17..19),
57    ],
58);
59
601;
61