syslog-ng icon indicating copy to clipboard operation
syslog-ng copied to clipboard

Increasing `disk-buf-size()` can make the disk-buffer file corrupt

Open alltilla opened this issue 2 years ago • 0 comments

syslog-ng

Version of syslog-ng

3.33 and upwards

Platform

Not platform specific

Issue

Failure

Increasing disk-buf-size() can make the disk-buffer file corrupt if the disk-buffer file is in "wrapped" state.

Steps to reproduce

  1. Use the config below
  2. Start syslog-ng with rm -rf ./var/syslog-ng* ; ./sbin/syslog-ng -Fe
  3. Send messages with loggen: ./bin/loggen -S --rate 10000 --active-connections 10 localhost 12345
  4. Wait for disk-buffer full messages to arrive, then stop loggen: Destination reliable queue full, dropping message;
  5. Open the listener server, and close it quickly, when messages start to arrive, so we only read a couple of messages: netcat -l localhost 12346
  6. Repeat steps 3 and 4
  7. Change the disk-buf-size() in the config to 200MiB
  8. Reload syslog-ng: ./sbin/syslog-ng-ctl reload
  9. Open the listener server netcat -l localhost 12346
  10. Observe the error message: Error reading disk-queue file, cannot read record-length;

Configuration

@version: 3.37

source s_network {
  network(port(12345));
};

destination d_network {
  network(
    "localhost"
    port(12346)
    time-reopen(2)
    disk-buffer(
      reliable(yes)
      disk-buf-size(100MiB)
      # disk-buf-size(200MiB)
    )
  );
};

log {
  source(s_network);
  destination(d_network);
};

Input and output logs

[2022-07-06T10:27:48.388516] Error reading disk-queue file, cannot read record-length; error='short read', filename='/home/alltilla/Work/install/OSE/var/syslog-ng-00000.rqf', offset='104858032'
[2022-07-06T10:27:48.388527] Cannot read correct message from disk-queue file; filename='/home/alltilla/Work/install/OSE/var/syslog-ng-00000.rqf', read_head='104858032'
[2022-07-06T10:27:48.388530] Error reading from disk-queue file, dropping disk queue; filename='/home/alltilla/Work/install/OSE/var/syslog-ng-00000.rqf'

alltilla avatar Jul 06 '22 08:07 alltilla