Comment 2 for bug 1385464

Revision history for this message
James Hunt (jamesodhunt) wrote :

To be clear, this issue was observed on Touch.

Interestingly, we already have a fix for this, but it hasn't landed in the archive or on Tocuh; the upstart session init has a logrotate job (/usr/share/upstart/sessions/logrotate.conf) which is used to rotate the users session init log files. I'd noticed the corruption issue and put a fix in the tip of lp:ubuntu/upstart. Essentially, the solution is to remove the status file as it will be regenerated on next logrotate run. However, if the status file is corrupt, logrotate will never rewrite it and as such, no logrotation occurs leading to unlimited logfile growth.

Here's the fix from the upstart job:

__________

# Sometimes the state file can become corrupt (probably caused by
# logrotate updating it on shutdown). In these cases the file ends in
# nul bytes which causes a subsequent logrotate run (even a forced run)
# to refuse to process it meaning no files get rotated.
#
# Hence, if nul bytes are detected, reset the state file to allow logrotate
# to work.
[ -e "$statefile" ] && egrep '[^[:print:]]' "$statefile" && rm "$statefile"

__________