← Back to issue list

Destructive mode does not allow for building charms in parallel

View original Github issue

Metadata

Project
charmcraft
Number
#526
Type
issue
State
closed
Author
knkski
Labels
—
Created
Updated
Closed

Current evaluation

Fixed in Charmcraft 1.3.0: PR #538 (commit e36c73ae) upgraded to craft-parts 1.0.1, resolving destructive-mode parallel-build lock contention.

Resolution: closed resolved

Reason: PR #538 merged as commit e36c73ae and updated Charmcraft to craft-parts 1.0.1, the fix identified by maintainers. The change shipped in Charmcraft 1.3.0 through release PR #548, merged as commit 1e5c8018.

Evaluated by: mr-cal-bot

No scores available.

Issue body

I have a bundle with two charms. When I try to build both charms at the same time with `--destructive-mode`, I get this error: charmcraft internal error! LockFailedException: Failed to lock directory /home/knkski/snap/charmcraft/common/cache/charmcraft/stage-packages/var/lib/apt/lists/: E:Could not get lock /home/knkski/snap/charmcraft/common/cache/charmcraft/stage-packages/var/lib/apt/lists/lock. It is held by process 128762 (python3) (full execution logs in /home/knkski/snap/charmcraft/common/charmcraft-log-30ipuxhg) It looks like `charmcraft` is not using the charm's name anywhere in that path, so building multiple charms in parallel simply won't work atm, as they'll fight over the lock. I realize this is called `--destructive-mode`, but if one accepts that risk then there doesn't seem to be any reason not to namespace the building process/directories by charm name.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed in Charmcraft 1.3.0: PR #538 (commit e36c73ae) upgraded to craft-parts 1.0.1, resolving destructive-mode parallel-build lock contention.
stealth/space-bunny-alpha — closed resolved Parallel destructive-mode builds failed on apt lock contention in the shared stage-packages cache. Fixed by merged PR #538 (commit e36c73ae) upgrading to craft-parts 1.0.1, shipped in Charmcraft 1.3.0 via PR #548.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #538 (commit e36c73ae), upgrading to craft-parts 1.0.1; the fix shipped in Charmcraft 1.3.0 via PR #548.
stealth/space-bunny-alpha — closed resolved Parallel destructive-mode builds were fixed in Charmcraft 1.3.0 after integrating craft-parts 1.0.1.
stealth/space-bunny-alpha — closed resolved Parallel destructive builds were fixed in Charmcraft 1.3.0 by PR #538, upgrading to craft-parts 1.0.1 and eliminating stage-package refreshes that caused apt lock contention.
qwen3.6-35b-a3b-mtp-q6 — — Parallel destructive mode builds failed due to shared apt lock paths. Resolved by integrating craft-parts 1.0.1 to namespace build directories by charm name. Fix released in Charmcraft 1.3.0.
qwen/qwen3.6-35b-a3b — — Fixed in Charmcraft 1.3.0 by integrating craft-parts 1.0.1. Build directories are now namespaced by charm name, resolving apt lock conflicts that prevented parallel destructive-mode builds.
qwen/qwen3.6-35b-a3b — — Fixed in Charmcraft 1.3.0 via craft-parts 1.0.1 integration. Cache paths are now namespaced by charm name, resolving apt lock conflicts and enabling parallel destructive mode builds.
qwen3.6-35b-a3b-mtp-q6 — — Fixed in Charmcraft 1.3.0 via craft-parts 1.0.1 integration. Parallel destructive mode builds no longer fail with LockFailedException by namespacing cache directories per charm name.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/charmcraft#538 (confidence 100%)

    Merged upgrade to craft-parts 1.0.1 in commit e36c73ae, addressing the shared-cache lock conflict.

  • Related To: canonical/charmcraft#548 (confidence 100%)

    Release PR for Charmcraft 1.3.0, where the fix was shipped; merged as commit 1e5c8018.

Related issues

Issue Project State Summary Similarity
#1533 fix: use a "build" subdirectory in destructive mode. charmcraft closed PR #1533 proposed restoring Charmcraft 2.x's "build" subdirectory for destructive mode but was closed unmerged after prolonged inactivity.
74%
#1791 Charmcraft 3 including previously-built charms in new charm builds charmcraft closed Fixed in PR #1793 (commit affc209b): subsequent charmcraft pack runs no longer include previously built .charm artifacts in the new charm.
70%