Bug 20908 - Problem with sighup
Problem with sighup
Status: CLOSED RAWHIDE
Product: Red Hat Powertools
Classification: Retired
Component: exim (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
:
: 35076 (view as bug list)
Depends On:
Blocks: 35436
  Show dependency treegraph
 
Reported: 2000-11-15 11:10 EST by Need Real Name
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-05-02 16:52:32 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
exim config (16.49 KB, patch)
2001-04-10 11:48 EDT, Need Real Name
no flags Details | Diff

  None (edit)
Description Need Real Name 2000-11-15 11:10:40 EST
It sometimes happens that SIGHUP does not restart
exim, but just kills it.
It may be some possible race during processing of the signal or something
else.
This is the part of the log
2000-11-15 03:38:22 13vy5F-0003hL-00 Completed
2000-11-15 04:02:01 pid 12098: SIGHUP received: re-exec daemon

And this is it, nothing in log any more.
In most situations the restart is OK, no such problem happens
2000-11-14 04:02:01 pid 10388: SIGHUP received: re-exec daemon
2000-11-14 04:02:01 exim 3.16 daemon started: pid=12098, -q1h, listening
for SMTP on port 25
2000-11-14 04:02:01 Start queue run: pid=12099

The exim version I use is exim-3.16-12
This is basically RedHat powertools version upgraded to exim 3.16
Comment 1 Need Real Name 2000-11-15 11:17:49 EST
Note that the /etc/logrotate.d/exim
is
/var/log/exim/exim_*log {
        missingok
  notifempty
  sharedscripts
  postrotate
    /bin/kill -HUP `cat /var/run/exim.pid 2>/dev/null` 2> /dev/null || true
  endscript
}

It has "sharedscript". This means exim receives a single SIGHUP, not 
one for each log file.
Comment 2 Need Real Name 2000-11-15 11:41:58 EST
This is a part of /var/log/messages
seems nothing special happened at 4:02

Nov 15 03:20:00 imap1 CROND[14200]: (root) CMD (   /sbin/rmmod -as)
Nov 15 03:30:00 imap1 CROND[14204]: (root) CMD (/etc/backup/runbackup
/etc/backup/backup_daily_home)
Nov 15 03:30:00 imap1 CROND[14205]: (root) CMD (   /sbin/rmmod -as)
Nov 15 03:40:00 imap1 CROND[14223]: (root) CMD (   /sbin/rmmod -as)
Nov 15 03:50:00 imap1 CROND[14228]: (root) CMD (   /sbin/rmmod -as)
Nov 15 04:00:00 imap1 CROND[14231]: (root) CMD (   /sbin/rmmod -as)
Nov 15 04:01:00 imap1 CROND[14233]: (root) CMD (run-parts /etc/cron.hourly)
Nov 15 04:02:00 imap1 CROND[14238]: (root) CMD (run-parts /etc/cron.daily)
Nov 15 04:02:00 imap1 anacron[14242]: Updated timestamp for job `cron.daily' to
2000-11-15
Nov 15 04:10:00 imap1 CROND[14373]: (root) CMD (   /sbin/rmmod -as)
Nov 15 04:20:00 imap1 CROND[14376]: (root) CMD (   /sbin/rmmod -as)
Nov 15 04:30:00 imap1 CROND[14379]: (root) CMD (   /sbin/rmmod -as)
Nov 15 04:40:00 imap1 CROND[14382]: (root) CMD (   /sbin/rmmod -as)
Nov 15 04:50:00 imap1 CROND[14385]: (root) CMD (   /sbin/rmmod -as)
Nov 15 05:00:00 imap1 CROND[14388]: (root) CMD (   /sbin/rmmod -as)

Comment 3 Bernhard Rosenkraenzer 2000-11-16 10:14:29 EST
I've sent a bug report to the maintainer of the base package, waiting for his feedback.
Comment 4 Tim Waugh 2001-01-08 12:28:49 EST
Should be fixed in exim-3.20-1.
Comment 5 Tim Waugh 2001-04-07 05:59:20 EDT
*** Bug 35076 has been marked as a duplicate of this bug. ***
Comment 6 Tim Waugh 2001-04-10 05:45:43 EDT
What do you have in /etc/sysconfig/exim?

Also, could you try SIGHUPing it by hand while running strace on it, to see 
what it's up to when it fails?
Comment 7 Need Real Name 2001-04-10 11:46:28 EDT
I tried to send -HUP few times, it seems working every time I do this.
The log during -HUP looks like this one:

2001-04-10 11:02:07 End queue run: pid=24728
2001-04-10 11:45:55 pid 24103: SIGHUP received: re-exec daemon
2001-04-10 11:45:55 exim 3.22 daemon started: pid=24103, -q1h, listening for
SMTP on port 25
2001-04-10 11:45:55 Start queue run: pid=24816
2001-04-10 11:45:55 End queue run: pid=24816

But in sometimes (very seldom) exim just dies.
config file is attached.
Comment 8 Need Real Name 2001-04-10 11:48:18 EDT
Created attachment 15064 [details]
exim config
Comment 9 Tim Waugh 2001-04-11 08:57:34 EDT
When exim is running, what does 'ls /var/run/exim*' say?  I'm expecting there 
to be a /var/run/exim.pid.  What's in that, exactly?  Just one number?
Comment 10 Need Real Name 2001-04-11 12:03:10 EDT
For now I put a kludge in /etc/logrotate.d/exim as 

/etc/rc.d/init.d/exim stop >/dev/null 2>&1
sleep 1
/etc/rc.d/init.d/exim start >/dev/null 2>&1

When testing with SIGHUP it looks as foillowing:

exim is as a process with pid= 606
I give 
kill -HUP `cat /var/run/exim.pid `

then 
ls -lstr /var/run/exim*
   4 -rw-r--r--    1 root     mail            4 Apr 11 11:53 /var/run/exim.pid
(the -HUP changes time of this file, so exim e-writes it,
after next -HUP it look as
4 -rw-r--r--    1 root     mail            4 Apr 11 11:58 /var/run/exim.pid
)

the content of the file is 
hexdump -c /var/run/exim.pid
0000000   6   0   6  \n                                                
0000004

The running exim process has the same pid (606)
ps axuww|grep exim
mail       606  0.0  0.1  4308 1440 ?        S    04:02   0:00 /usr/sbin/exim
-bd -q1h

(date 4:02 because it was restarted from /etc/logrotate.d/exim , see kludge
above)

In /var/log/exim/exim_mainlog
everything is pretty much OK

2001-04-11 11:44:54 14nMnA-0000PH-00 Completed
2001-04-11 11:53:33 pid 606: SIGHUP received: re-exec daemon
2001-04-11 11:53:33 exim 3.22 daemon started: pid=606, -q1h, listening for SMTP
on port 25
2001-04-11 11:53:33 Start queue run: pid=1612
2001-04-11 11:53:33 End queue run: pid=1612

The problem happens once every 2-3 months, it is hard to reproduce it right
away.

On another side - the command
while true ; do kill -HUP `cat /var/run/exim.pid ` ; done

(constantly deliver -HUP) easilly kills exim.

Then exim log looks like
2001-04-11 11:58:28 14nN0I-0000QC-00 Completed
2001-04-11 12:02:17 pid 606: SIGHUP received: re-exec daemon

and nothing else there.
Is there a way when:
1. Several SIGHUPs may be delivererd to exim (like clashes of daily and monthly
logrotate).
2. Exim during restart sends a -HUP to itself.

Comment 11 Need Real Name 2001-04-30 12:27:37 EDT
More Info.
Exim with this logrotate

/etc/rc.d/init.d/exim stop >/dev/null 2>&1
 sleep 1
/etc/rc.d/init.d/exim start >/dev/null 2>&1

Also dies.
This is a part of the log:

2001-04-30 03:34:28 14u8CR-0001Lo-00 Error message sent to email@here.com
2001-04-30 03:34:28 14u8CR-0001Lo-00 Completed
2001-04-30 03:34:29 14u8CS-0001Lq-00 => email@here.com R=lookuphost
T=remote_smtp H=mx2.mail.yahoo.com [216.136.129.17]
2001-04-30 03:34:29 14u8CS-0001Lq-00 Completed
2001-04-30 04:02:28 14u8dX-0001MA-00 <= admin@hostname.com H=hostname.com
(hostname.com) [1.2.3.4] P=esmtp S=1076
id=-955994241.988617617174.JavaMail.servlets@server
2001-04-30 04:02:29 14u8dX-0001MA-00 => colin <email@domain.com> D=localuser
T=local_delivery
2001-04-30 04:02:29 14u8dX-0001MA-00 Completed

And this is it. Exim died after this no more messages in log.
Comment 12 Need Real Name 2001-05-01 03:42:10 EDT
This short patch fixes this problem, I believe:

*** exim-3.22/src/daemon.c  Fri Jan 19 09:32:07 2001
--- daemon.c    Mon Apr 30 16:22:58 2001
***************
*** 1299,1304 ****
--- 1299,1305 ----
      log_write(0, LOG_MAIN, "pid %d: SIGHUP received: re-exec daemon",
        getpid());
      for (sk = 0; sk < listen_socket_count; sk++) close(listen_sockets[sk]);
+     alarm(0);
      sighup_argv[0] = exim_path;
      execv(exim_path, sighup_argv);
      log_write(0, LOG_MAIN|LOG_PANIC_DIE, "pid %d: exec of %s failed: %s",

Comment 13 Tim Waugh 2001-05-02 05:45:11 EDT
Excellent.  Yes, that looks right.

Thanks a lot for the patch.
Comment 14 Tim Waugh 2001-05-02 16:53:29 EDT
Applied in exim-3.22-11.

Note You need to log in before you can comment on or make changes to this bug.