args-fdexhaustion-sighup.pl revision 1.5
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;
12
13our %args = (
14    client => {
15	func => sub { write_between2logs(shift, sub {
16	    my $self = shift;
17	    ${$self->{server}}->loggrep("Signal", 8)
18		or die ref($self), " no 'Signal' between logs";
19	})},
20	loggrep => { get_between2loggrep() },
21    },
22    syslogd => {
23	conf => join("", map { "*.*\t\$objdir/file-$_.log\n" } 0..19),
24	rlimit => {
25	    RLIMIT_NOFILE => 30,
26	},
27	loggrep => {
28	    # If not in startup, each failed PRIV_OPEN_LOG is logged
29	    # to tty, so PRIV_OPEN_TTY fails again.
30	    qr/syslogd: receive_fd: recvmsg: Message too long/ => '>='.(4+2*3),
31	    # During first initialization the lockpipe is open.  When
32	    # SIGHUP happens it is closed and one more file can be opened.
33	    qr/X FILE:/ => 1+15+1+16,
34	    qr/X UNUSED:/ => 5+4,
35	},
36    },
37    server => {
38	func => sub { read_between2logs(shift, sub {
39	    my $self = shift;
40	    ${$self->{syslogd}}->kill_syslogd('HUP');
41	    ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
42		or die ref($self), " no 'syslogd: restarted' between logs";
43	    print STDERR "Signal\n";
44	})},
45	loggrep => {
46	    get_between2loggrep(),
47	    qr/Signal/ => 1,
48	    qr/Accepted/ => 1,
49	},
50    },
51    multifile => [
52	(map { { loggrep => get_testgrep() } } 0..15),
53	(map { { loggrep => { qr/./s => 0 } } } 16..19),
54    ],
55    user => {
56	loggrep => {
57	    get_firstlog() => 1,
58	    get_testlog() => 0,
59	}
60    },
61);
62
631;
64