Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

sync plugin OOMs ("memory allocation of N bytes failed") when the target canister already has assets

未关闭
#703 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
rust, wasm
领域
cli

调研方向

使用提供的 icp.yaml 以及两个命令 icp deploy 或 icp sync 重现该问题,并比较空 canister 与已填充的 canister。首先跟踪 sync 插件路径和 certified-assets migration-v2.2.1 插件;确定故障属于 icp-cli 还是插件。完成的标准是:已填充的 canister 能够同步已更改的 asset,而不会耗尽内存或数分钟没有任何反应。

由索引模型根据 Issue 内容生成。

描述

Summary

A plugin sync step against a canister that already holds assets exhausts the plugin sandbox's memory and aborts with memory allocation of 44 bytes failed, after ~7 minutes during which it produces no output. The same sync against an empty canister completes in 3–8 seconds.

The practical effect is that an asset canister can be deployed once and then never updated: every subsequent icp deploy / icp sync fails.

Environment

icp-cli 1.2.0 and 1.3.0 — identical behaviour
OS macOS 26.5.2 (Darwin 25.5.0), arm64
Network mode: managed, launcher 15.0.0-2026-07-31-04-23. Also reproduces on mainnet
Recipe @dfinity/[email protected] (sha256 ee41744b…)
Sync plugin certified-assets migration-v2.2.1-6b48585 / sync_plugin.wasm (supplied by the recipe)
Canister wasm dfx assetstorage 0.29.1 (sha256 4014793c…)
Asset set 230 files, 4.4 MB total (a Docusaurus build/)

Reproduction

icp.yaml:

canisters:
  - name: docs
    recipe:
      type: "@dfinity/[email protected]"
      sha256: ee41744bd1361593a041d830b06ce50598cae5b21b57209fc727e8f63ae7e906
      configuration:
        version: "0.29.1"
        dir: docs/build          # any static site; ours is ~230 files / 4.4 MB
        build:
          - npm run build-docs
networks:
  - name: local
    mode: managed
    version: 15.0.0-2026-07-31-04-23
icp network start --background -e local

icp deploy docs -e local -y   # 1st: creates the canister, syncs 230 assets — OK, ~8s
icp deploy docs -e local -y   # 2nd: fails

icp sync docs -e local on its own reproduces it identically, so it is the sync step alone — no build, install or upgrade involved.

Actual

DEBUG icp::progress: sync plugin (legacy assetstorage / .ic-assets.json5): starting for canister <id> (environment: local)
DEBUG icp::progress: api_version: 2
DEBUG icp::progress: found 230 file(s) from ["docs/build"]
                    <~7 minutes, no output>
ERROR icp::operations::sync: ----- Failed to sync canister 'docs': <id> -----
ERROR icp::operations::sync: 'failed to run plugin'
ERROR icp::operations::sync:   caused by: plugin returned error: memory allocation of 44 bytes failed
ERROR icp::operations::sync:   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: Canister(s) ["docs"] failed to sync.

Expected

The sync completes, uploading only the changed assets — as it does when the canister is empty.

Notes

  • Empty vs populated is the trigger. First deploy (fresh canister, list returns nothing): 230 assets in 3–8s. Second: OOM. Clearing the canister restores the fast path — icp canister call docs clear '(record {})' followed by icp sync docs -e local uploads all 230 assets in 3 seconds. That is the only workaround we found, and it is not usable in production, since the canister serves nothing between the clear and the commit.

  • Not an icp-cli version issue. 1.3.0 behaves identically; the plugin comes from the pinned recipe, not from the CLI.

  • Moving to the current plugin does not help. certified-assets v0.3.3 (plugin-release.wasm) calls a can_sync query, which the legacy dfx assetstorage canister does not export, so it fails with IC0536 … has no query method 'can_sync'. The migration-* plugin appears to be the only one supporting these canisters, and it is the one that OOMs.

  • The memory limit is not configurable. ICP_CLI_PLUGIN_COMPUTE_LIMIT_SECS exists (#669) but there is no memory equivalent, so the ceiling cannot be raised from the outside. If the allocation ceiling is a deliberate sandbox guard rather than a leak, the same argument as #669 applies — it cannot be calibrated for someone else's asset bundle.

  • The silent ~7 minutes is its own problem. With no progress output, a hang and slow work are indistinguishable; in CI this consumed a 45-minute job timeout before failing.

  • Possibly related: dfinity/certified-assets#71, which tracks the legacy assetstorage migration plugin. If the fault is in the plugin rather than the sandbox, this may belong there instead.

Related, but separate

On a redeploy, icp deploy upgrades the canister (which stops it) and runs the sync step before restarting it, so the sync's first call is rejected with IC0508 … is stopped and therefore does not have a CallContextManager. A failed deploy also leaves the canister stopped — easy to miss on an asset canister, because http_request is a query and keeps serving normally while every update call is rejected. Happy to file that separately if you'd prefer it tracked on its own.

主要语言
Rust
星标
116
派生
17
平均合并
22 小时 11 分钟
30 天内合并 PR
28

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dfinity/icp-cli 的其他 Issue

查看 dfinity/icp-cli 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。