`contract build` can expose an empty wasm to concurrent builds
Maintainer thường phản hồi trong vòng 1 ngày
@leighmcculloch đang làm issue này rồi.
Từ ngày 15/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
What version are you using?
28.1.0 (main at d95abbc).
What did you do?
Ran two stellar contract build (or contract deploy/upload auto-build) processes at the same time on the same cargo workspace.
Note that this also happens in the auto_build integration tests and causes builds to fail sometimes. e.g. deploy_workspace_with_package_auto_builds in this run.
What did you expect to see?
Both builds succeed, with each reader seeing either the previous complete wasm or the new complete wasm.
What did you see instead?
The second build fails with ❌ error: unexpected end-of-file (at offset 0x0) after cargo reports Finished. Perhaps writing each rewrite to a temp file in the same directory and renaming it over the target could avoid the empty window while still breaking the deps/ hard link, though there may be other options worth weighing.
Thoughts
After cargo releases its build lock, inject_meta and filter_spec in cmd/soroban-cli/src/commands/contract/build.rs each rewrite the output wasm in place with fs::remove_file followed by fs::write, and fs::write creates an empty file before writing the bytes, so another process reading the same path in that window sees zero bytes. The remove-then-write pattern came from #1896 to break the hard link cargo keeps to deps/ (#1694), and the only step that writes to a temp file and renames into place today is --optimize, while the --out-dir copy uses fs::copy, which is also not atomic.
The file would not exist as a zero length file for a brief period if it was written to a temp directory, or with a random filename in the current directory, then renamed into place after the write is complete. So this is probably the ideal fix.
- Ngôn ngữ chính
- Rust
- Star
- 129
- Fork
- 153
- Merge trung bình
- 1 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của stellar/stellar-cli
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
stellar/stellar-cli#2887 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
stellar/stellar-cli#2880 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
arg_value_union panics on zero-arity union tuple case (unchecked type_[0] index)Có thể đã có người làm @hvoi đã nhận 22 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
stellar/stellar-cli#2806 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
contract extend panics on single-change resultMetaXdr (index out of bounds at extend.rs:306)Có thể làm lại được @duongynhi000005-oss đã nhận 18 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
stellar/stellar-cli#2796 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Document stellar-cli's RPC trust boundaryCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
stellar/stellar-cli#2781 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của stellar/stellar-cli
Issue tương tự
-
feature request good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
TabularisDB/tabularis#1513 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug priority: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
storytold/pdfcraft#7140 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug duplicate priority: low ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
storytold/vectorcraft#6956 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
PDF export issueĐang mởbug priority: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
storytold/designcraft#2712 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày