[PR #2788] [MERGED] Fix file descriptor leaks in error paths #2790

Closed
opened 2026-03-04 02:07:17 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/2788
Author: @CarstenGrohmann
Created: 1/23/2026
Status: Merged
Merged: 1/23/2026
Merged by: @ggtakec

Base: masterHead: fix_fd_leaks


📝 Commits (1)

  • 081e2a7 Fix file descriptor leaks in error paths

📊 Changes

2 files changed (+6 additions, -1 deletions)

View changed files

📝 src/fdcache.cpp (+1 -0)
📝 src/fdcache_entity.cpp (+5 -1)

📄 Description

Close file descriptors before returning on error in three locations:

  • FdManager::MakeTempFile(): fd leaked when unlink() failed after successful mkstemp()
  • FdEntity::Open(): physical_fd leaked when fstat() failed after opening cache file
  • FdEntity::Open(): physical_fd leaked when OpenMirrorFile() failed

These leaks would accumulate over time when error conditions occurred, eventually exhausting the process file descriptor limit.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/s3fs-fuse/s3fs-fuse/pull/2788 **Author:** [@CarstenGrohmann](https://github.com/CarstenGrohmann) **Created:** 1/23/2026 **Status:** ✅ Merged **Merged:** 1/23/2026 **Merged by:** [@ggtakec](https://github.com/ggtakec) **Base:** `master` ← **Head:** `fix_fd_leaks` --- ### 📝 Commits (1) - [`081e2a7`](https://github.com/s3fs-fuse/s3fs-fuse/commit/081e2a7310f673cd427364eb4205bb0345a6d3f5) Fix file descriptor leaks in error paths ### 📊 Changes **2 files changed** (+6 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/fdcache.cpp` (+1 -0) 📝 `src/fdcache_entity.cpp` (+5 -1) </details> ### 📄 Description Close file descriptors before returning on error in three locations: - `FdManager::MakeTempFile()`: fd leaked when `unlink()` failed after successful `mkstemp()` - `FdEntity::Open()`: `physical_fd` leaked when `fstat()` failed after opening cache file - `FdEntity::Open()`: `physical_fd` leaked when `OpenMirrorFile()` failed These leaks would accumulate over time when error conditions occurred, eventually exhausting the process file descriptor limit. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 02:07:17 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#2790
No description provided.