Skip to content

fix(uploads): resolve hash calculation memory crash and add hashing progress#375

Open
Confusion-ymc wants to merge 1 commit intoOpenListTeam:mainfrom
Confusion-ymc:main
Open

fix(uploads): resolve hash calculation memory crash and add hashing progress#375
Confusion-ymc wants to merge 1 commit intoOpenListTeam:mainfrom
Confusion-ymc:main

Conversation

@Confusion-ymc
Copy link

@Confusion-ymc Confusion-ymc commented Feb 4, 2026

Description / 描述

修复了大文件(10GB+)哈希计算导致的 Array buffer allocation failed 崩溃异常。

主要改进:

  1. 稳定性优化:在 while 循环哈希计算中引入 setTimeout(0) 主动释放主线程。通过出让 CPU 控制权,允许浏览器在计算间隙执行垃圾回收 (GC),彻底解决大文件处理时的内存分配失效问题。
  2. 进度显示:新增 onProgress 回调,实时反馈 hashing 阶段的百分比进度。

Motivation and Context / 背景

解决处理超大文件时主线程被长时间占用导致的页面假死和内存溢出崩溃,提升大文件上传的成功率与用户体验。

How Has This Been Tested? / 测试

  1. 大文件验证:成功计算 10GB+ 文件哈希,内存占用曲线平稳。
  2. 交互验证:验证计算过程中 UI 无卡顿,进度显示顺滑。
  3. 规范验证:已通过 prettier 格式化并校验。

Checklist / 检查清单

  • I have read the CONTRIBUTING document.
    我已阅读 CONTRIBUTING 文档。
  • I have formatted my code with go fmt or prettier.
    我已使用 go fmtprettier 格式化提交的代码。
  • I have added appropriate labels to this PR (or mentioned needed labels in the description if lacking permissions).
    我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
  • I have requested review from relevant code authors using the "Request review" feature when applicable.
    我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
  • I have updated the repository accordingly (If it’s needed).
    我已相应更新了相关仓库(若适用)。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant