← Back to issue list

Incorrectly handling SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT

View original Github issue

Metadata

Project
craft-providers
Number
#212
Type
issue
State
open
Author
stolk
Labels
Type: Bug
Created
Updated
Closed
—

Current evaluation

SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT not honored and Multipass instances hardcoded to 2 CPUs. Maintainer triaged; still unfixed in craft-providers (cpus=2 at multipass_provider.py:300), provider-side work split out to #531, snapcraft-side partly fixed in 8.4.4.

Suggested action: keep open

Reason: The bug remains live: MultipassProvider.launched_environment still hardcodes cpus=2/mem_gb=2 (craft_providers/multipass/multipass_provider.py:300), which mr-cal identified as the cause of the second symptom, and a grep for parallel_build_count/CRAFT_PARALLEL_BUILD_COUNT in craft-providers returns nothing. Maintainer explicitly triaged it ('Tracking with CRAFT-1847', CRAFT-2598) and redirected the provider-side work to the still-open craft-providers#531, so it must stay open. The first symptom's snapcraft-side aspect was partially addressed by merged snapcraft#4041 (log diagnostics) and snapcraft#5108 (shipped in Snapcraft 8.4.4), but the underlying '2 CPUs' limitation is unchanged.

Evaluated by: mr-cal-bot

Impact: 42 Quick Win: 10 Complexity: 62 Confidence: 84 Actionability: 64

Issue body

There are two issues when it comes to `SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT` environment variable. My laptop has 8 cores, verified with `/proc/cpuinfo` And I've set `SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT=8` but in the snapcraft log I see: ``` CPU count (from process affinity): 8 Invalid SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT value ``` And then it gets worse... later in the log, there is: ``` CPU count (from process affinity): 2 Invalid SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT value ``` Which is another issue: CPU count of 2 is not correct. snapcraft was launched as: ``` SNAPCRAFT_BUILD_ENVIRONMENT=multipass snapcraft ``` snap versions: ``` $ snap info snapcraft | grep installed installed: 7.2.9 (8619) 65MB classic $ snap info multipass | grep installed installed: 1.11.0 (8465) 112MB - ``` [snapcraft-20230207-135726.857780.log](https://github.com/canonical/craft-providers/files/10679759/snapcraft-20230207-135726.857780.log)

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 42
Quick Win: 10
Complexity: 62
Confidence: 84
Actionability: 64
keep open SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT not honored and Multipass instances hardcoded to 2 CPUs. Maintainer triaged; still unfixed in craft-providers (cpus=2 at multipass_provider.py:300), provider-side work split out to #531, snapcraft-side partly fixed in 8.4.4.
stealth/space-bunny-alpha
Impact: 47
Quick Win: 13
Complexity: 52
Confidence: 91
Actionability: 59
keep open Multipass builds reject SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT and run with two CPUs; CPU configuration is tracked in open craft-providers#531, while the invalid-value warning remains unresolved.
stealth/space-bunny-alpha
Impact: 50
Quick Win: 10
Complexity: 66
Confidence: 90
Actionability: 60
keep open Multipass still launches builds with 2 vCPUs despite SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT=8; the invalid-value warning was not reproduced, and CPU configuration remains tracked in craft-providers#531.
stealth/space-bunny-alpha
Impact: 48
Quick Win: 15
Complexity: 58
Confidence: 94
Actionability: 72
keep open Multipass rejects SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT=8 and still provisions only 2 CPUs; tracked as CRAFT-1847/CRAFT-2598 and delegated to craft-providers#531.
qwen3.6-35b-a3b-mtp-q6
Impact: 80
Quick Win: 24
Staleness: 40
Complexity: 70
Confidence: 80
Support Request: 10
keep open Issue with SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT handling and incorrect CPU counts in Multipass. Maintainer is addressing via craft-application integration.
qwen/qwen3.6-35b-a3b
Staleness: 45
Complexity: 60
Confidence: 85
Support Request: 5
keep open Reports invalid SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT handling and inaccurate CPU detection in Multipass. Maintainer acknowledged, tracking internally, and created follow-up issue #531 for CPU/memory config. Awaiting craft-application integration fix.
qwen3.6-35b-a3b-mtp-q6
Staleness: 40
Complexity: 60
Confidence: 90
Support Request: 10
keep open Issue tracking incorrect SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT handling and CPU detection in multipass. Maintainer acknowledged it, linked to internal tracking, and will close once craft-application integration delivers the fix.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/craft-providers#531 (confidence 88%)

    Maintainer split out the provider-side fix: 'I've made a new and more specific bug (#531) about setting the CPU and memory for Multipass instances'; #531 is still open and covers the hardcoded cpus=2/mem_gb=2 here.

  • Related To: canonical/snapcraft#4041 (confidence 70%)

    Merged PR by mr-cal from this very report, adding logging of invalid SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT values (diagnostics only, behavior unchanged).

  • Likely Fixed By: canonical/snapcraft#5108 (confidence 55%)

    Covers the build-count/parallel-build-count side for core24 via craft-application metadata; the issue summary states the fix shipped in Snapcraft 8.4.4, which may close the first half of this report for core24 only.

  • Related To: canonical/snapcraft#3997 (confidence 50%)

    Merged PR forwarding SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT into the build instance; evidence the env var propagation half is handled on the snapcraft side.

Related issues

Issue Project State Summary Similarity
#1997874 SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT doesn't seem to be passed through to lxd container snapcraft (launchpad) closed SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT was not forwarded into the LXD/Multipass build instance. Fixed by merged PR snapcore/snapcraft#3997 (commit 31a3990c8, 'providers: pass SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT to instance'), released in snapcraft 7.3.
79%
#3997 providers: pass SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT to instance snapcraft merged PR #3997 merged (commit 31a3990c8) forwarding SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT into the build provider instance, so parallel build limits are honored inside the build environment.
79%
#2008003 Multipass build provider does not support resource settings core core22 snaps snapcraft (launchpad) open Multipass builds of core22+ snaps ignore SNAPCRAFT_BUILD_ENVIRONMENT_CPU/MEMORY; provider hardcodes 2 CPUs/2GB RAM. Maintainer confirmed unsupported; fix tracked upstream in craft-providers#531.
77%
#1988748 SNAPCRAFT_PARALLEL_BUILD_COUNT not respected if set in `override-build:` snapcraft (launchpad) closed Closed as working as intended: maintainer sergiusens explained craftctl reads the configured parallel-build count, so exporting SNAPCRAFT_PARALLEL_BUILD_COUNT inside override-build cannot change it (it is set by snapcraft itself, per PR #1154).
75%
#4785 bug: snapcraft uses '1' for CRAFT_PARALLEL_BUILD_COUNT on multi-core machine snapcraft closed Core24 builds now receive the CPU-based CRAFT_PARALLEL_BUILD_COUNT; the fix shipped in Snapcraft 8.4.4 on 2024-10-24.
74%
#1795666 snapcraft overcommits CPUs in a multipass environment snapcraft (launchpad) closed Resolved by snapcore/snapcraft#2365 (commit c325c62ad), which reduced the conservative default Multipass CPU allocation to address host overcommit.
73%
#1792581 CPU max and override for multipass snapcraft (launchpad) closed Resolved by snapcore/snapcraft#2273, commit cbd1854d9, which selected the best available CPU configuration for Multipass.
73%
#1947914 concurrent snapcraft builds with multipass provider snapcraft (launchpad) open Snapcraft 5/Core 18 Multipass builds reportedly shared 10.30.202.6 and terminated silently; the old report has no maintainer assessment and needs triage against current versions.
72%
#5145 snapcraft fails to launch multipass instance when multipass isn't pre-installed snapcraft open Snapcraft emits cryptic 'Remote "snapcraft" is unknown or unreachable / exit code 2' when Multipass can't launch the build instance; maintainer traced it to image-server unavailability or non-amd64 hosts, fix tracked in craft-providers#211
72%
#1792614 use multipass if set in the environment snapcraft (launchpad) closed Closed as fixed: PR snapcore/snapcraft#2275 (commit 04f8896d9) made SNAPCRAFT_BUILD_ENVIRONMENT/multipass take precedence over the base-derived provider choice.
72%