fix(sftp): handle SSH channels concurrently to fix 40s freeze with gvfs/Nautilus#191
fix(sftp): handle SSH channels concurrently to fix 40s freeze with gvfs/Nautilus#191Xgabi86 wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details🔇 Additional comments (1)
📝 WalkthroughWalkthroughIn ChangesConcurrent SFTP Channel Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Let me do some investigation for this. |
Fixes pelican-dev/panel#2399
Root Cause
gvfs (used by GNOME Nautilus and KDE Dolphin) opens two separate SSH connections to the SFTP server via SSH ControlMaster multiplexing: a
command_connectionand adata_connection. Both share the same underlying TCP connection, meaning Wings receives two channel open requests on the samessh.ServerConn.The issue is in
AcceptInbound: thefor ch := range chansloop callsc.Handle()synchronously, blocking on the first channel's entire SFTP session. The second channel requested by gvfs is queued inchansbut never dequeued — Wings is stuck insideHandle()for the first channel. After ~40 seconds, gvfs times out and falls back to a degraded mode, loggingSetting up data connection failed.FileZilla is unaffected because it only opens a single SFTP channel per connection.
Fix
Wrap
c.Handle()in a goroutine so each SSH channel is served concurrently, allowing Wings to process multiple channels on the same connection simultaneously.Investigation
Diagnosed via:
tsharkpacket capture confirming a precise ~40s silence afterSSH_MSG_CHANNEL_OPEN_CONFIRMATIONstraceongvfsd-sftpconfirming twosshprocesses spawned with-oControlMaster autogvfsbackendsftp.c) confirming the dual-connection architectureSummary by CodeRabbit