[PR #2012] [MERGED] Fixed data race and memory leaks in PseudoFdInfo #2302

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

📋 Pull Request Information

Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/2012
Author: @ggtakec
Created: 7/29/2022
Status: Merged
Merged: 7/29/2022
Merged by: @gaul

Base: masterHead: fix_race_vals


📝 Commits (1)

  • b9a01fb Fixed data race and memory leaks in PseudoFdInfo

📊 Changes

2 files changed (+54 additions, -43 deletions)

View changed files

📝 src/fdcache_fdinfo.cpp (+52 -42)
📝 src/fdcache_fdinfo.h (+2 -1)

📄 Description

Relevant Issue (if applicable)

#2008

Details

In addition to #2008 run_tests_using_sanitizers.sh detected following, so I fixed it.

WARNING: ThreadSanitizer: data race (pid=2385)
  Write of size 4 at 0x7b3400006cd0 by thread T30 (mutexes: write M85703959268558400, write M85985434245269344):
    #0 PseudoFdInfo::ParallelMultipartUpload(char const*, std::__cxx11::list<mp_part, std::allocator<mp_part> > const&, bool) /home/ggtakec/work/s3fs-fuse/src/fdcache_fdinfo.cpp:433:9 (s3fs+0x5762cf)
    #1 PseudoFdInfo::ParallelMultipartUploadAll(char const*, std::__cxx11::list<mp_part, std::allocator<mp_part> > const&, std::__cxx11::list<mp_part, std::allocator<mp_part> > const&, int&) /home/ggtakec/work/s3fs-fuse/src/fdcache_fdinfo.cpp:448:9 (s3fs+0x57649c)
    #2 FdEntity::RowFlushStreamMultipart(PseudoFdInfo*, char const*) /home/ggtakec/work/s3fs-fuse/src/fdcache_entity.cpp:1879:25 (s3fs+0x55f3ec)
    #3 FdEntity::RowFlush(int, char const*, AutoLock::Type, bool) /home/ggtakec/work/s3fs-fuse/src/fdcache_entity.cpp:1437:18 (s3fs+0x55e098)
    #4 FdEntity::Flush(int, AutoLock::Type, bool) /home/ggtakec/work/s3fs-fuse/src/./fdcache_entity.h:141:82 (s3fs+0x4db31c)
    #5 s3fs_flush(char const*, fuse_file_info*) /home/ggtakec/work/s3fs-fuse/src/s3fs.cpp:2491:23 (s3fs+0x4ca876)
    #6 <null> <null> (libfuse.so.2+0xee6e)
...
...

Also, there was a memory leak that was fixed.


🔄 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/2012 **Author:** [@ggtakec](https://github.com/ggtakec) **Created:** 7/29/2022 **Status:** ✅ Merged **Merged:** 7/29/2022 **Merged by:** [@gaul](https://github.com/gaul) **Base:** `master` ← **Head:** `fix_race_vals` --- ### 📝 Commits (1) - [`b9a01fb`](https://github.com/s3fs-fuse/s3fs-fuse/commit/b9a01fbb547f271f0388b3d041c44626dd2bbf29) Fixed data race and memory leaks in PseudoFdInfo ### 📊 Changes **2 files changed** (+54 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `src/fdcache_fdinfo.cpp` (+52 -42) 📝 `src/fdcache_fdinfo.h` (+2 -1) </details> ### 📄 Description ### Relevant Issue (if applicable) #2008 ### Details In addition to #2008 `run_tests_using_sanitizers.sh` detected following, so I fixed it. ``` WARNING: ThreadSanitizer: data race (pid=2385) Write of size 4 at 0x7b3400006cd0 by thread T30 (mutexes: write M85703959268558400, write M85985434245269344): #0 PseudoFdInfo::ParallelMultipartUpload(char const*, std::__cxx11::list<mp_part, std::allocator<mp_part> > const&, bool) /home/ggtakec/work/s3fs-fuse/src/fdcache_fdinfo.cpp:433:9 (s3fs+0x5762cf) #1 PseudoFdInfo::ParallelMultipartUploadAll(char const*, std::__cxx11::list<mp_part, std::allocator<mp_part> > const&, std::__cxx11::list<mp_part, std::allocator<mp_part> > const&, int&) /home/ggtakec/work/s3fs-fuse/src/fdcache_fdinfo.cpp:448:9 (s3fs+0x57649c) #2 FdEntity::RowFlushStreamMultipart(PseudoFdInfo*, char const*) /home/ggtakec/work/s3fs-fuse/src/fdcache_entity.cpp:1879:25 (s3fs+0x55f3ec) #3 FdEntity::RowFlush(int, char const*, AutoLock::Type, bool) /home/ggtakec/work/s3fs-fuse/src/fdcache_entity.cpp:1437:18 (s3fs+0x55e098) #4 FdEntity::Flush(int, AutoLock::Type, bool) /home/ggtakec/work/s3fs-fuse/src/./fdcache_entity.h:141:82 (s3fs+0x4db31c) #5 s3fs_flush(char const*, fuse_file_info*) /home/ggtakec/work/s3fs-fuse/src/s3fs.cpp:2491:23 (s3fs+0x4ca876) #6 <null> <null> (libfuse.so.2+0xee6e) ... ... ``` Also, there was a memory leak that was fixed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 02:04:49 +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#2302
No description provided.