Audit log hangs when trying to write log record of length audit_log_buffer_size

Bug #1588439 reported by Sergei Glushchenko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Fix Released
High
Sergei Glushchenko
5.6
Fix Released
High
Sergei Glushchenko
5.7
Fix Released
High
Sergei Glushchenko

Bug Description

It is a bug in audit_log_buffer_write:

loop:
  if (log->write_pos + len < log->flush_pos + log->size)
  {
    size_t wrlen= min(len, log->size -
                              (log->write_pos % log->size));
    memcpy(log->buf + (log->write_pos % log->size), buf, wrlen);
    if (wrlen < len)
      memcpy(log->buf, buf + wrlen, len - wrlen);
    log->write_pos= log->write_pos + len;
    DBUG_ASSERT(log->write_pos >= log->flush_pos);
  }
  else
  {
    if (!log->drop_if_full)
    {
      mysql_cond_wait(&log->flushed_cond, &log->mutex);
      goto loop;
    }
  }

When len equals to log->size and both log->flush_pos == log->write_pos == 0 (buffer is fully flushed) this is going to be infinite loop.

Tags: audit
summary: - Audit log hands when trying to write log record of length
+ Audit log hangs when trying to write log record of length
audit_log_buffer_size
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

Nobody has probably seen it because minimum value for audit_log_buffer_size is 4K, when log record was limited to 1K and even less (see Bug 1557293).

tags: added: audit
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-987

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.