Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SSHFS initializes condition variables for each open file, asynchronous read chunk and synchronous write, but releases their storage without calling pthread_cond_destroy(). Repeated I/O therefore accumulates resources on implementations with allocated condition variables, including Cygwin. A long-running SSHFS-Win 3.5.20357 mount was observed with over 4.5 million Windows handles and continuing growth.
Add the four missing destroy calls at the existing lifetime boundaries: read-chunk destruction, failed open, file release and completion of a synchronous write. No transport, reconnect or mount behavior changes.
The new unit test includes the real sshfs.c cleanup paths and counts successful condition-variable initializations/destructions. It requires neither FUSE mounting nor an SSH server, and detects the imbalance even on glibc, where condition variables do not allocate Windows-style handles. It covers six cases: empty and failed reads, failed open, release after disconnect, and empty and failed synchronous writes.
Validation on Debian trixie / GCC 14.2 / GLib 2.84.4 / libfuse 3.17.2:
Windows/Cygwin end-to-end stress validation has not been run. The observed desktop stutters are not claimed to be proven consequences of this specific leak.
Related reports: winfsp/sshfs-win#285.
The same cleanup calls were previously proposed by @TongLi-Galaxy as part of winfsp/sshfs-win#478. This PR brings the focused lifetime fix upstream, with regression coverage, rather than carrying additional Windows connection/recovery changes.