Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logthrdestdrv: process flush result after worker thread exits #2402

Merged
merged 1 commit into from Nov 13, 2018

Conversation

lbudai
Copy link
Collaborator

@lbudai lbudai commented Nov 9, 2018

The messages are ACKed by the _process_result() method.
UnACKed messages are move back to the queue to be sent by syslog-ng
later.

Problems the patch fixes in batching mode:

  1. when a queue contains unsent items during a stop request, worker
    threads are blocked until the batch timer not elapsed

  2. when the queue contains items during reload (less then a batch_lines), then we perform a flush after the worker thread exits, but as the result was not processed, these messages are never ACKed, so they were moved back to the queue, and could be sent multiple times

Signed-off-by: Laszlo Budai laszlo.budai@balabit.com

The messages are ACKed by the _process_result() method.
UnACKed messages are move back to the queue to be sent by syslog-ng
later.

Problems the patch fixes in batching mode:
1) when a queue contains unsent items during a stop request, worker
threads are blocked until the batch timer not elapsed

2) when the queue contains items during reload (less then a batch_size), then we perform a flush after the worker thread exits, but as the result was not processed, these messages are never ACKed, so they were move back to the queue, and could be sent multiple times

Signed-off-by: Laszlo Budai <laszlo.budai@balabit.com>
@kira-syslogng
Copy link
Contributor

Build SUCCESS

@Kokan Kokan self-requested a review November 10, 2018 14:29
@@ -639,7 +639,8 @@ _worker_thread(gpointer arg)
_schedule_restart(self);
iv_main();

log_threaded_dest_worker_flush(self);
worker_insert_result_t result = log_threaded_dest_worker_flush(self);
_process_result(self, result);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the _process_result has a few drawback, as it could trigger _disconnect or _rewind_batch. Although they are fine, as both of them should handle consecutive calls.

But it has also a tricky side effect about logs. The logs in the _process_result was not composed to use in this case.
For example, if the destination is not connected while the thread is in shutdown, this is going to print on info level the following: Server disconnected while preparing messages for sending, trying again. That could be confusing to see.

I did not requested change, as I think the issue it solves outweights the above small inconveniences.

@lbudai lbudai added this to the OSE 3.19 milestone Nov 12, 2018
@pzoleex
Copy link
Collaborator

pzoleex commented Nov 13, 2018

@kira-syslogng test this please test branch=pzolee-splunk;

@kira-syslogng
Copy link
Contributor

Build SUCCESS

@Kokan Kokan merged commit 8ea6121 into syslog-ng:master Nov 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants