aboutsummaryrefslogtreecommitdiff
path: root/test/kafka/kafka-client-loadtest/test_offset_fetch.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-12-08 21:38:09 -0800
committerGitHub <noreply@github.com>2025-12-08 21:38:09 -0800
commit9196696278ae1bd1203cf149f1de43317b3ccef3 (patch)
tree393081ac4fe314e23a9820b2d7108dd68118fbcb /test/kafka/kafka-client-loadtest/test_offset_fetch.go
parentff4855dcbe784eefa34e5f3298ebc071e10ed208 (diff)
downloadseaweedfs-9196696278ae1bd1203cf149f1de43317b3ccef3.tar.xz
seaweedfs-9196696278ae1bd1203cf149f1de43317b3ccef3.zip
mount: add mutex to DirectoryHandle to fix race condition (#7674)
* mount: add mutex to DirectoryHandle to fix race condition When using Ganesha NFS on top of FUSE mount, ls operations would hang forever on directories with hundreds of files. This was caused by a race condition in DirectoryHandle where multiple concurrent readdir operations could modify shared state (entryStream, entryStreamOffset, isFinished) without synchronization. The fix adds a mutex to DirectoryHandle and holds it for the entire duration of doReadDirectory. This serializes concurrent readdir calls on the same handle, which is the correct behavior for a directory handle and fixes the race condition. Key changes: - Added sync.Mutex to DirectoryHandle struct - Lock the mutex at the start of doReadDirectory - This ensures thread-safe access to entryStream and other state The lock is per-handle (not global), so different directories can still be listed concurrently. Only concurrent operations on the same directory handle are serialized. Fixes: https://github.com/seaweedfs/seaweedfs/issues/7672 * mount: add mutex to DirectoryHandle to fix race condition When using Ganesha NFS on top of FUSE mount, ls operations would hang forever on directories with hundreds of files. This was caused by a race condition in DirectoryHandle where multiple concurrent readdir operations could modify shared state (entryStream, entryStreamOffset, isFinished) without synchronization. The fix adds a mutex to DirectoryHandle and holds it for the entire duration of doReadDirectory. This serializes concurrent readdir calls on the same handle, which is the correct behavior for a directory handle and fixes the race condition. Key changes: - Added sync.Mutex to DirectoryHandle struct - Lock the mutex at the start of doReadDirectory - Optimized reset() to reuse slice capacity and allow GC of old entries The lock is per-handle (not global), so different directories can still be listed concurrently. Only concurrent operations on the same directory handle are serialized. Fixes: https://github.com/seaweedfs/seaweedfs/issues/7672
Diffstat (limited to 'test/kafka/kafka-client-loadtest/test_offset_fetch.go')
0 files changed, 0 insertions, 0 deletions