Skip to content

dedup backend: Fix leaking filedescriptor#2550

Merged
BareosBot merged 5 commits intobareos:bareos-24from
sebsura:backport/bareos-24/fix-fd-leak
Mar 6, 2026
Merged

dedup backend: Fix leaking filedescriptor#2550
BareosBot merged 5 commits intobareos:bareos-24from
sebsura:backport/bareos-24/fix-fd-leak

Conversation

@sebsura
Copy link
Contributor

@sebsura sebsura commented Feb 20, 2026

Backport of PR #2548 to bareos-24

Checklist for the reviewer of the PR (will be processed by the Bareos team)

Make sure you check/merge the PR using devtools/pr-tool to have some simple automated checks run and a proper changelog record added.

General
  • Correct milestone is set
Source code quality (if there were changes to the original PR)
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR

Backport quality

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 010389e0-8e83-49f0-becb-c61e4c85f055

📥 Commits

Reviewing files that changed from the base of the PR and between 7c3c8ab and f38d67c.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • core/platforms/freebsd/bareos-freebsd/bareos.com-common/BareosCommonMakefile

📝 Walkthrough

Walkthrough

Refactors descriptor handling in the dedupable backend: raii_fd API tightened (explicit ctor, noexcept move/assign, const/noexcept accessors, operator bool() explicit, fd made private), and volume now stores and uses raii_fd instead of raw int; OpenRelative returns raii_fd.

Changes

Cohort / File(s) Summary
RAII Wrapper
core/src/stored/backends/dedupable/util.h
Tightened API: explicit raii_fd(int) noexcept; move ctor/assign marked noexcept; fileno()int fileno() const noexcept; release()int release() noexcept; operator bool()explicit operator bool() const noexcept; fd moved to private.
Volume integration
core/src/stored/backends/dedupable/volume.h, core/src/stored/backends/dedupable/volume.cc
Replaced raw directory fd (int) with raii_fd; OpenRelative now returns raii_fd; call sites updated to use .fileno() and propagate the RAII wrapper; error contexts adjusted for wrapped descriptors.
Changelog
CHANGELOG.md
Added "dedup backend: Fix leaking filedescriptor [PR #2550]" under Unreleased and referenced PR #2550.
Platform makefile
core/platforms/freebsd/.../BareosCommonMakefile
PLIST_SUB DISTVERSION extraction regex changed to capture semantic version pattern (([0-9]+\.){2}[0-9]+).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • pstorz

Suggested labels

requires backport to 23

Poem

🐰 I hopped in code with nimble paws,
Wrapped stray fds and tamed their flaws,
Explicit, noexcept, tucked away,
Private fd now saves the day,
A tiny hop — no leaks, applause! 🎩

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning PR description is incomplete and missing critical required sections from the template. Add a concise summary of changes above the checklist and verify the PR title is usable as a CHANGELOG entry. Document the purpose and scope of the backport clearly.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'dedup backend: Fix leaking filedescriptor' directly and clearly describes the main change: fixing a file descriptor leak in the dedup backend, which aligns with the commit messages and code changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


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.

sebsura added 3 commits March 5, 2026 13:07
(cherry picked from commit c3d6ef0)
This makes it clear that you closing the filedescriptor is already
taken care of and reduces suprises.

(cherry picked from commit a7b976d)
@sebsura sebsura force-pushed the backport/bareos-24/fix-fd-leak branch from bb2f911 to 7c3c8ab Compare March 5, 2026 12:07
@sebsura sebsura changed the title Fix leaking filedescriptor on dedup backend dedup backend: Fix leaking filedescriptor Mar 5, 2026
@sebsura sebsura requested a review from pstorz March 5, 2026 12:09
@pstorz pstorz added this to the 24.0.10 milestone Mar 6, 2026
@BareosBot BareosBot merged commit 50e4ba7 into bareos:bareos-24 Mar 6, 2026
0 of 2 checks passed
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.

3 participants