fix(sftp): fix UI freeze and READDIR hang on directories with special files - #26
Merged
Conversation
Orinks
force-pushed
the
fix/sftp-directory-hang
branch
2 times, most recently
from
March 1, 2026 01:44
f8d1a70 to
2c36c6d
Compare
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
- Move remote directory listing and chdir onto daemon threads so the UI never freezes during SFTP operations - Fix infinite READDIR loop: some SFTP servers (e.g. Synology NAS) send count=0 instead of SSH_FX_EOF for empty directories; paramiko loops forever in this case — treat count=0 as EOF (matches WinSCP behaviour) - Add SFTP lock to serialise calls (paramiko is not thread-safe) - Skip special files (sockets, FIFOs, devices) that can hang on stat - Add --debug / --log=<file> flags for capturing diagnostic output - Add tests for threaded refresh, special file skipping, chdir error handling
Orinks
force-pushed
the
fix/sftp-directory-hang
branch
from
March 1, 2026 04:32
9df5bdd to
2a0dff7
Compare
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.
Problem
Two related issues caused the app to freeze or hang when navigating remote directories:
chdirwere running on the main thread, blocking the entire UISSH_FXP_READDIRwithcount=0instead ofSSH_FX_EOFfor empty directories. Paramiko loops forever in this case — the app hangs indefinitelyRoot Cause
Paramiko's
listdir_attrdoes not handlecount=0as end-of-directory. WinSCP and other clients treatcount=0as EOF; this PR replicates that behaviour via a custom_listdir_attr_safeimplementation.Changes
chdirandlistdir_attronto daemon threads so the UI remains responsive_listdir_attr_safe: same assftp.listdir_attrbut breaks oncount=0_sftp_lockto serialise SFTP calls (paramiko sessions are not thread-safe)stat()--debugand--log=<file>CLI flags for diagnostic output