← Back to issue list

if an instance fails to launch, it can never be launched again

View original Github issue

Metadata

Project
craft-providers
Number
#455
Type
issue
State
closed
Author
mr-cal
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #464 (commit d5c194b) added launch PID tracking and checks, preventing stale STARTING instances from indefinitely blocking launch retries.

Resolution: closed resolved

Reason: PR #464, resolved by commit d5c194b, stores and checks the launching process PID so a failed launch is distinguishable from another active launch and can be retried.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description If craft-providers fails to launch an instance [here](https://github.com/canonical/craft-providers/blob/df23ecc1d8bb75304844d99bb74e3a89da9e2483/craft_providers/lxd/lxc.py#L607), then it will create a scenario where the instance can never be launched again. This happens because the instance is launched with `--config user.craft_providers.status=STARTING` and fails. The next time craft-providers runs, it sees the instance is `STARTING`, wrongly assumes another process is starting the instance, and times out after 60 seconds. To resolve this, craft-providers should delete the instance if it fails to launch. https://github.com/canonical/craft-providers/issues/448 may also prevent this issue from occurring. ### To Reproduce ```python from pathlib import Path import logging from craft_providers import bases, lxd logging.basicConfig(level="DEBUG") logger = logging.getLogger() # define alias, provider, and base alias = bases.BuilddBaseAlias.JAMMY my_base = bases.BuilddBase(alias=alias) provider_a = lxd.LXDProvider(lxd_project="project1") provider_a.ensure_provider_is_available() provider_b = lxd.LXDProvider(lxd_project="project2") provider_b.ensure_provider_is_available() with provider_a.launched_environment( project_name="hello-world", project_path=Path().absolute(), base_configuration=my_base, build_base=alias.value, instance_name="test-instance", ) as instance: logger.info("launched instance") try: with provider_b.launched_environment( project_name="hello-world", project_path=Path().absolute(), base_configuration=my_base, build_base=alias.value, instance_name="test-instance", ) as instance: logger.info("launched instance") except: logger.info("Failure is expected because of name conflict.") # delete all instances in project1 to resolve name conflict lxd.project.purge(lxc=lxd.LXC(), project="project1") # the instance in project2 will never launch because its status is "STARTING" with provider_b.launched_environment( project_name="hello-world", project_path=Path().absolute(), base_configuration=my_base, build_base=alias.value, instance_name="test-instance", ) as instance: logger.info("launched instance") ``` ### part yaml _No response_ ### Relevant log output ```shell n/a ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #464 (commit d5c194b) added launch PID tracking and checks, preventing stale STARTING instances from indefinitely blocking launch retries.
qwen/qwen3.6-35b-a3b — closed stale Issue closed without clear resolution. Bug: failed LXD instance launches leave instance in 'STARTING' state, preventing future launches. Suggested fix: delete instance on launch failure.

Update history

Date Change
created

Related work

  • Likely Fixed By: canonical/craft-providers#464 (confidence 98%)

    Commit d5c194b introduced PID storage and validation for LXD instance launches, directly addressing the stale STARTING state.

Related issues

No related issues found above the similarity threshold.