<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre wrap="">Summary: logrotation time of -1 causes hang

<a class="moz-txt-link-freetext"
 href="https://bugzilla.redhat.com/show_bug.cgi?id=304161">https://bugzilla.redhat.com/show_bug.cgi?id=304161</a>


</pre>
<table cellpadding="0" cellspacing="0">
  <tbody>
    <tr>
      <td><a name="c0"
 href="https://bugzilla.redhat.com/show_bug.cgi?id=304161#c0">Opened by</a>
Ulf Weltman (<a href="mailto:ulf@cup.hp.com">ulf@cup.hp.com</a>)</td>
      <td> on 2007-09-24 17:48 EST</td>
      <td>
      <script type="text/javascript" language="JavaScript"><!--
            addReplyLink(0);
      //--></script>[<a
 href="https://bugzilla.redhat.com/show_bug.cgi?id=304161#add_comment"
 onclick="replyToComment(0);">reply</a>]</td>
      <td nowrap="nowrap"> <input name="when-0" value="20070924174857"
 type="hidden"> <input name="oisprivate-0" value="0" type="hidden"> <input
 name="isprivate-0" id="isprivate0" value="1" type="checkbox"><label
 for="isprivate0">Private</label></td>
    </tr>
  </tbody>
</table>
<pre wrap="">Someone set nsslapd-auditlog-logrotationtime to -1, and when log rotation time
comes around we spin forever here in log.c:
           while (loginfo.log_audit_rotationsyncclock &lt;= loginfo.log_au
dit_ctime) {
                  loginfo.log_audit_rotationsyncclock += loginfo.log_audit
_rotationtime_secs;
           }

(gdb) print loginfo.log_audit_rotationsyncclock
$7 = -1
(gdb) print loginfo.log_audit_ctime
$8 = 1190782632
(gdb) print loginfo.log_audit_rotationtime_secs
$9 = -86400

-1 is obviously not a valid configuration but if someone is bored they could add
some boundary checking there.

------- Additional Comments From <a class="moz-txt-link-abbreviated"
 href="mailto:nhosoi@redhat.com">nhosoi@redhat.com</a>  2007-10-03 15:07 EST -------
Created an attachment (id=214931)
 --&gt; (<a class="moz-txt-link-freetext"
 href="https://bugzilla.redhat.com/attachment.cgi?id=214931&amp;action=view">https://bugzilla.redhat.com/attachment.cgi?id=214931&amp;action=view</a>)
cvs diff ldapserver/ldap/servers/slapd/log.c

Thank you, Ulf, for finding out an interesting bug!

It's not good to wait forever in the while loops...

Change description:
1. slapd_log_audit_proc, slapd_log_error_proc_internal, and log_flush_buffer:
use absolute value of rotationtime_secs to calculate the rotationsyncclock.
2. when the result of "atoi" for nsslapd-XXX-logrotationtime is 0 due to the
invalid setting, logrotation time is reset to -1 (no rotation).
3. if nsslapd-XXX-logrotationtime and nsslapd-XXX-logexpirationtime is large
(near MAXINT) and calculated rotationtime_secs and/or exptime_secs is
overflown, set MAXINT to the sec value.

Thanks,
--noriko
</pre>
</body>
</html>