Skip to content

Conversation

@ashinde-ai
Copy link

@ashinde-ai ashinde-ai commented Nov 23, 2025


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Summary by CodeRabbit

  • Bug Fixes
    • Improved stability by adding safety checks to prevent crashes in Windows Event Log collection when no event channels are configured or active.
    • Enhanced shutdown process reliability with additional protective checks.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 23, 2025

Walkthrough

Added null-safety guards to the Windows Event Log input plugin. A check skips collection when active channels are absent in in_winevtlog_collect, and in_winevtlog_exit now null-checks before dereferencing the active channel pointer.

Changes

Cohort / File(s) Summary
Null-safety hardening
plugins/in_winevtlog/in_winevtlog.c
Added null-check guards in in_winevtlog_collect to skip collection when ctx or ctx->active_channel is NULL; wrapped winevtlog_close_all in in_winevtlog_exit with null-check for ctx->active_channel

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • The changes are localized null-safety checks, which are straightforward to verify
  • Two separate defensive guards that follow a consistent pattern
  • Minimal impact on control flow or logic

Suggested labels

docs-required

Suggested reviewers

  • edsiper
  • koleini

Poem

🐰 A rabbit hops through channels bright,
With null-checks guarding left and right!
No derefs without a shield so true,
The logs flow safe—hooray for you! 🌿✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main change: fixing a crash when a channel does not exist or is ignored, which matches the guard additions and null-checks in the code.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@cosmo0920 cosmo0920 left a comment

Choose a reason for hiding this comment

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

We only need to guard NULL deref lines.
We shouldn't exit in_winevtlog plugin even if there's no active channels.

Comment on lines +393 to +399
/* If there are no active channels (e.g., all missing and ignored),
* there is nothing to collect. Guard against NULL to avoid dereferencing.
*/
if (ctx == NULL || ctx->active_channel == NULL) {
return 0;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't want to do this. This is because some sort of usages implies that there is no active channels but still wanted to run without collecting Windows EventLog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants