[exim-dev] [Bug 1893] New: exim invoked as sendmail keeps lo…

Top Page
Delete this message
Reply to this message
Author: admin
Date:  
To: exim-dev
Subject: [exim-dev] [Bug 1893] New: exim invoked as sendmail keeps log file open for ever
https://bugs.exim.org/show_bug.cgi?id=1893

            Bug ID: 1893
           Summary: exim invoked as sendmail keeps log file open for ever
           Product: Exim
           Version: 4.87
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Logging
          Assignee: nigel@???
          Reporter: arekm@???
                CC: exim-dev@???


Real live scenario:

        |-crond(3647)-+-run-parts(3650)---cmd.py(5905,nobody)
        |             `-sendmail(3710,exim)



crond starts a process that never ends. cmd.py can be working for months or
years (it is supposed to do so).

cmd.py outputs some data to stdout and crond starts sendmail process to
deliver that output via mail.

The problem is that exim when invoked as sendmail keeps log file open. log
file which is later rotated and deleted but sendmail keeps it open:

sendmail   3710           exim    4w      REG              254,0   5572399
33635911 /var/log/archive/exim/main.log-20160906 (deleted)


main.log is logrotated via logrotate:
/var/log/exim/main.log {
    olddir /var/log/archive/exim
    create 640 exim exim
    daily
    delaycompress
}


Sending HUP doesn't help:

# lsof 2>&1 | grep 3710 |grep delete
sendmail   3710           exim    4w      REG              254,0   5572399
33635911 /var/log/archive/exim/main.log-20160906 (deleted)
# kill -HUP 3710
# lsof 2>&1 | grep 3710 |grep delete
sendmail   3710           exim    4w      REG              254,0   5572399
33635911 /var/log/archive/exim/main.log-20160906 (deleted)


Maybe exim should reopen log if it is rotated?

Like solution seen in WatchedFileHandler in python logging. It simply checks
few things:
if not sres or sres[ST_DEV] != self.dev or sres[ST_INO] != self.ino:
... reopen


Not sure how to approach this (of course I could try to change cmd.py to don't
output anything to stdout/stderr but what cmd.py does currently is perfectly
valid/allowed scenario)

--
You are receiving this mail because:
You are on the CC list for the bug.