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

F/clone cow correction #1230

Merged
merged 2 commits into from Oct 19, 2016
Merged

Conversation

juhaszviktor
Copy link
Collaborator

@juhaszviktor juhaszviktor commented Oct 14, 2016

Optimization in the log_msg_clone_cow breaks the acknowledgment counting

This optimization try to avoid referencing the clone message, in case of it has no own payload.
But it is not correct because it breaks the acknowledgment counting.

Why?
Let's see the following situation:

  • There is an original message: O
  • There is clone of O: O'

O' has no own payload, sdata, etc.. (so the cow is not executed on this clone)
We are creating a clone from O': O''.
The original of O'' will be the O, not the O'.
This causes the problem, because the acknowledgment will be called for O not for O',
but it should be called for O', because it waits for this acknowledgment

The result is, that the original message (O) get more acknowledgment, than it expects, causing assertion

…gment counting

This optimization try to avoid referencing the clone message,
in case of it has no own payload.
But it is not correct because it breaks the acknowledgment counting.

Why?
Let's see the following situation:
 * There is an original message: O
 * There is clone of O: O'
O' has no own payload, sdata, etc.. (so the cow is not executed on this clone)
We are creating a clone from O': O''. The original of O'' will be the O, not the O'.
This causes the problem, because the acknowledgment will be called for O not for O',
but it should be called for O', because we it waits for this acknowledgment

The result is, that the original message (O) get more acknowledgment,
than it expects causing assertion.

This unit test brings up the issue

Signed-off-by: Viktor Juhasz <viktor.juhasz@balabit.com>
It breaks the acknowledgment counting, described in the previous path.
With this patch the test_logmsg_ack unit test passes.

Signed-off-by: Viktor Juhasz <viktor.juhasz@balabit.com>
Copy link
Collaborator

@bazsi bazsi left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Collaborator

@MrAnno MrAnno left a comment

Choose a reason for hiding this comment

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

👍 Thanks.

@MrAnno MrAnno merged commit 260840c into syslog-ng:master Oct 19, 2016
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

3 participants