Summary:ASTERISK-10196: "logger rotate" leads to logging getting deadlocked and asterisk won't stop
Reporter:Steve Davies . (stevedavies)Labels:
Date Opened:2007-08-29 16:57:48Date Closed:2007-08-30 12:33:37
Versions:Frequency of
Environment:Attachments:( 0) 20070830__bug10598.diff.txt
( 1) asterisk-loggerrotate.diff.txt
Doing a "logger rotate" results in logging getting "stuck".  No new full / messages file is created and Asterisk won't stop.


voipconnect_2*CLI> logger rotate
[Aug 29 23:59:05] Asterisk Event Logger restarted
[Aug 29 23:59:05] Asterisk Queue Logger restarted
voipconnect_2*CLI> exit
voipconnect_2 customers # ls /var/log/asterisk/fu*
/var/log/asterisk/full.0  /var/log/asterisk/full.1.gz  /var/log/asterisk/full.2.gz  /var/log/asterisk/full.4.gz
/var/log/asterisk/full.1  /var/log/asterisk/full.2     /var/log/asterisk/full.3.gz  /var/log/asterisk/full.5.gz

You see that there is no new "full" file created.  Logging isn't going to the old but renamed file either - its going nowhere.

Telling asterisk to stop now doesn't work (or didn't work the couple of times I tried it.  I needed to kill asterisk process)


I'll try to get a coredump so we can see what is where.
Comments:By: James Golovich (jamesgolovich) 2007-08-30 02:47:05

This bug was introduced when the code to not reload unchanged config files was added.  If the config file hasn't been changed then make_logchannel is never executed that will reopen the file.  This is a simple fix to the problem, and mimics the behavior of the other 2 logs that have a hardcoded fopen.

If we want to go this route we probably could not call init_logger_chain on a rotate, the way it is now a rotate implies a reload.

By: Tilghman Lesher (tilghman) 2007-08-30 10:21:23

I think I'd prefer to fix it this way.  What do you think, James?

Reason is, if the logger.conf file was changed AND a logger rotate was issued, then we'd otherwise leak a file descriptor for every channel.

By: James Golovich (jamesgolovich) 2007-08-30 11:46:15

I like it.  I can't see any reason it would cause any problems, unless someone made a change to their logger.conf and didn't want it to take effect right away.  Although we are duplicating previous behavior so I think that is acceptable.

By: Digium Subversion (svnbot) 2007-08-30 12:33:36

Repository: asterisk
Revision: 81387

r81387 | tilghman | 2007-08-30 12:33:35 -0500 (Thu, 30 Aug 2007) | 2 lines

Always force reread of the config when we're rotating the log file (closes issue ASTERISK-10196)