Skip to content

Conversation

@zwass
Copy link
Member

@zwass zwass commented Jan 21, 2025

Fixes #8524 by ensuring the last events are never expired from a table. Without this change, new event IDs could be unintentionally generated starting from 1, while optimizations tell the generate function to look at a higher ID. All of those newer events would then never be logged.

Fixes osquery#8524 by ensuring the last events are never expired from a table. Without this change, new event IDs could be unintentionally generated starting from 1, while optimizations tell the generate function to look at a higher ID. All of those newer events would then never be logged.
@zwass zwass added bug events Related to osquery's evented tables or eventing subsystem labels Jan 21, 2025
@zwass zwass requested a review from alessandrogario January 21, 2025 18:25
@zwass zwass requested review from a team as code owners January 21, 2025 18:25
Comment on lines +364 to +366
// Events are expired after being queried (except for last valid event --
// optimize should take care of that event not being returned again, but that
// is tested separately below.)
Copy link
Member

Choose a reason for hiding this comment

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

I don't really understand how optimize prevents it from being returned. Or how this tests it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Optimization keeps track of the highest eventid and then when the generate function is called any event with a lower ID is skipped when returning rows. The test for optimization verifies that behavior.

@directionless
Copy link
Member

@alessandrogario Can you review this?

@directionless
Copy link
Member

@zwass What was the conclusion here? I know you talked for awhile at Office Hours about this. Is it ready for merge?

@zwass
Copy link
Member Author

zwass commented Feb 18, 2025

I believe it's ready but I am hoping that @alessandrogario will review it because it's deep in the events code.

@zwass
Copy link
Member Author

zwass commented Mar 11, 2025

Going ahead and merging.

@zwass zwass merged commit 9e3535a into osquery:master Mar 11, 2025
22 checks passed
@zwass zwass deleted the fix-events-expiration branch March 11, 2025 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug events Related to osquery's evented tables or eventing subsystem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Osquery loses events due to optimization errors under specific conditions

2 participants