Repository navigation
fix(sftp): 上传卡死可立即取消、快速失败,同连接传输并发车道 - #418
Merged
feigeCode merged 4 commits intoOct 19, 2026
Merged
Conversation
ekovovo
commented
Oct 17, 2026
Contributor
- 上传全链路(单文件/目录准备/子目录/逐文件/最终发布)用 select! 对取消 标志竞速(100ms 轮询),卡在无响应服务器上的在途请求可立即打断,不再 等满请求超时;被打断的写入保留远端暂存文件(原始文件不受影响)
- 单条 SFTP 请求超时 300s 缩短到 60s:卡死任务从最坏 ~10 分钟(含重试) 降到 ~2 分钟失败并释放车道;60s 为 fsync 在慢速存储上的合法耗时留余量
- 同一连接的传输车道从单并发改为容量 3(每任务独立 SFTP channel), 一个卡住/慢速的任务不再拖死同服务器上的其它传输,FIFO 补位顺序不变
- 目录上传扫描显式处理符号链接:文件链接跟随按真实大小上传,目录链接 与坏链跳过,修复含符号链接目录上传必然失败的问题
- 上传全链路(单文件/目录准备/子目录/逐文件/最终发布)用 select! 对取消 标志竞速(100ms 轮询),卡在无响应服务器上的在途请求可立即打断,不再 等满请求超时;被打断的写入保留远端暂存文件(原始文件不受影响) - 单条 SFTP 请求超时 300s 缩短到 60s:卡死任务从最坏 ~10 分钟(含重试) 降到 ~2 分钟失败并释放车道;60s 为 fsync 在慢速存储上的合法耗时留余量 - 同一连接的传输车道从单并发改为容量 3(每任务独立 SFTP channel), 一个卡住/慢速的任务不再拖死同服务器上的其它传输,FIFO 补位顺序不变 - 目录上传扫描显式处理符号链接:文件链接跟随按真实大小上传,目录链接 与坏链跳过,修复含符号链接目录上传必然失败的问题
执行器同连接车道容量从 1 改为 3 后,第二个上传任务不再排队而是直接 启动,queued_sftp_transfer_can_be_cancelled_before_provider_start 的 前置条件(任务处于排队态)不再成立。改为先提交三个占位任务占满车道, 第四个真正排队后再取消,并断言被取消任务始终不会到达 provider。
解决 crates/sftp/src/russh_impl.rs 冲突:保留 main 侧的 scan_local_dir_entries(符号链接目录上传修复)与本分支的 race_with_cancel (硬取消),两侧新增函数与测试并列保留。
2 of 4 tasks
ekovovo
pushed a commit
to ekovovo/navop
that referenced
this pull request
Oct 19, 2026
- main/Cargo.toml、Cargo.lock:0.20.2 -> 0.20.3 - CHANGELOG.md:新增 v0.20.3 双语发布说明 本版自 v0.20.2 以来已合入 main 的变更: - 终端按行 / 按屏滚动回看历史输出(feigeCode#409) - Auto 模式 SQL 编辑器粘性会话,跨执行保留会话变量(feigeCode#312) - 笔记 Markdown 大纲面板与代码字体设置(feigeCode#406) - Redis:启用 TLS 修复、集群汇总全部 master、空库切换崩溃修复(feigeCode#414、feigeCode#416) - SFTP:上传可立即取消、同连接 3 条并发车道、目录符号链接处理(feigeCode#417、feigeCode#418) - 清空表刷新数据页签、结果集保存限定库名、剪贴板 JSON 原文复制(feigeCode#412、feigeCode#413)
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.