Skip to content

out_azure_blob: Plug dangling pointers on exceptions - #12305

Open
cosmo0920 wants to merge 1 commit into
masterfrom
cosmo0920-plug-dangling-pointers-on-out_azure_blob
Open

out_azure_blob: Plug dangling pointers on exceptions#12305
cosmo0920 wants to merge 1 commit into
masterfrom
cosmo0920-plug-dangling-pointers-on-out_azure_blob

Conversation

@cosmo0920

@cosmo0920 cosmo0920 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Closes #12202

Implemented the stronger ownership fix in azure_blob_db.c.

  • Outputs are initialized to NULL on entry.
  • SDS allocations use local temporaries.
  • Outputs are published only after all allocations succeed.
  • Failure cleanup destroys only local allocations, preventing dangling pointers and caller double-frees.
  • Database statement cleanup is consolidated across all return paths.

Verification passed:

  • cmake --build build --target flb-plugin-out_azure_blob flb-it-azure_blob_path -j8
  • ctest --test-dir build -R '^flb-it-azure_blob_path$' --output-on-failure
  • ctest --test-dir build -R '^flb-rt-out_azure_blob_compression$' --output-on-failure
  • git diff --check

No Azure Blob Python integration scenario exists under tests/integration.


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 reliability when checking for the oldest ready Azure Blob file.
    • Added safer handling for database locks, empty results, query failures, and memory-allocation errors.
    • Ensured outputs are consistently initialized and resources are properly cleaned up.

Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 238e86e0-5eb2-4267-bebe-d3e80affc339

📥 Commits

Reviewing files that changed from the base of the PR and between 6315162 and 347c0e5.

📒 Files selected for processing (1)
  • plugins/out_azure_blob/azure_blob_db.c

Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

azb_db_file_oldest_ready now initializes outputs, validates database locking, uses local query results, centralizes cleanup, and clears partial allocations on failure. It preserves -1, 0, and 1 return values for errors, empty results, and successful rows.

Changes

Azure Blob database handling

Layer / File(s) Summary
Oldest-ready result handling
plugins/out_azure_blob/azure_blob_db.c
azb_db_file_oldest_ready initializes output parameters, checks lock acquisition, stores allocations locally, centralizes statement cleanup, and releases partial allocations on errors. It preserves the existing return values for errors, empty results, and successful rows.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 347c0

This localized memory-safety fix initializes outputs safely and consolidates cleanup without introducing an actionable merge-blocking risk; it is merge-ready after normal checks and review.

Suggested reviewers: edsiper, leonardo-albertovich

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes use local SDS temporaries, initialize outputs, publish them after success, and clean up failures as required by issue #12202.
Out of Scope Changes check ✅ Passed The statement cleanup, lock checks, output initialization, and allocation handling support the ownership and failure-safety objectives in issue #12202.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: preventing dangling pointers during exception handling in the out_azure_blob plugin.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cosmo0920-plug-dangling-pointers-on-out_azure_blob

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.

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.

out_azure_blob: partial allocation failure leaves dangling SDS outputs

1 participant