Skip to content

Conversation

@JaewonHur
Copy link
Contributor

Run = Create + Start

  1. Mount source points to a valid directory

    • Run and Create + Start both correctly create the container with mount.
  2. Mount source points to a file

    • Run fails bootstrapping the container, thus container not created.
    • Create creates the container, but Start fails bootstrapping, removing the container. (Thus, both are the same.)
  3. Mount source deleted or replaced to file after container created

    • Start throw errors but do not delete the container.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

User can encounter unexpected container removal when shared volume source is in wrong state.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

@JaewonHur JaewonHur force-pushed the check-virtiofs-deleted branch from 2841247 to b7f738d Compare January 14, 2026 20:10
@jglogan
Copy link
Contributor

jglogan commented Jan 15, 2026

Seeing this test failure:

◇ Suite TestCLINoParallelCases started.
◇ Test testImageSingleConcurrentDownload() started.
✔ Test testImageSingleConcurrentDownload() passed after 0.862 seconds.
◇ Test testImageManyConcurrentDownloads() started.
✔ Test testImageManyConcurrentDownloads() passed after 0.704 seconds.
◇ Test testImagePruneNoImages() started.
✔ Test testImagePruneNoImages() passed after 0.184 seconds.
◇ Test testImagePruneUnusedImages() started.
✘ Test testImagePruneUnusedImages() recorded an issue at TestCLINoParallelCases.swift:81:9: Expectation failed: (output → "untagged registry.local/stdin-file:10E1258F-6DC1-40EB-80F1-F18471AEA98E
untagged ghcr.io/apple/containerization/vminit:0.20.1
untagged test-alpine-env:DC582421-DD5D-496F-BE47-C39EB2F5693B
untagged test-env-child:0CE91A3D-E1F0-4FB5-A4FB-8375E9FD7A47
untagged ghcr.io/containerd/busybox:1.36
untagged ghcr.io/containerd/busybox:testImageSaveAndLoadStdinStdout
untagged ghcr.io/linuxcontainers/alpine:testImageTag
untagged registry.local/multi-arch:326BD5F0-39E8-4681-B6EB-EC89A17E200E
untagged test-env-only:FB98ED08-8994-422B-9695-B8F22E806E05
untagged ghcr.io/containerd/busybox:testImageSaveAndLoad
untagged registry.local/add-all:A45C78C8-BCC9-4DB3-B736-BF36D37A6E28
untagged registry.local/multi-tag-test:latest
untagged ghcr.io/apple/container-builder-shim/builder:0.7.0
untagged registry.local/build-arg:8B2B8285-79D0-4D46-8281-A098B10AEAB6
untagged registry.local/build-symlinks:A8449327-D470-4794-9043-3665EFF0ADEB
untagged registry.local/multi-tag-test:EA0E05B5-867A-4DDF-A10D-85E40ED26052
untagged registry.local/build-network-access:CB58B319-C954-48B9-9A13-CB5957221C40
untagged ghcr.io/linuxcontainers/alpine:testImageSaveAndLoad
untagged test-label-only:C04AAD7A-8D05-45FE-B48B-C0648395C196
untagged from-local:7D176AF6-90F2-44D3-8624-56DF2DA194F7
untagged registry.local/scratch-add:BED25DA9-D9CD-4F92-A67F-2097B0326FB4
untagged docker.io/library/python:alpine
untagged ghcr.io/username/image-name:mytag
untagged ghcr.io/linuxcontainers/alpine:3.18
untagged registry.local/dockerfile-keywords:E77F2AF6-241A-4E61-B9C9-98BCEC65D8BB
untagged test-env-base:6CA5943D-47B0-4669-A26F-2963D3FEBE7C
untagged registry.local/dot-file:44442DC8-DC1C-468A-A3A6-5F98F98F0AC4
untagged registry.local/from-previous-layer:4FDB702C-0369-4162-997E-ABB9365BA918
untagged test-build-and-run:latest
untagged local-only:E87D38F9-F823-4F9E-BB50-50CF93725ED0
untagged test-complex-env:F26FA244-7D12-4C64-A8E5-A4323254C645
untagged ghcr.io/linuxcontainers/alpine:testImageSaveAndLoadStdinStdout
untagged registry.local/scratch-add-special-dir:1A1B8E39-3746-4563-9F11-C1926C7A84E3
untagged registry.local/multi-tag-test:v1.0.0
untagged registry.local/build-diff-context:24D7C51D-4A52-4B51-A660-9129E0824C5B
deleted 193d51b116e20bdd28a9b292a008ec7a446758e6b4bea1a09801848ce32aa68c
deleted 86852de7f69d89c037ced2f78afa323976a44a10f8ac96626aa97b85ea160c34
deleted dae9190ee1dfeaa618a111d20058289d5cab7cb78105045fc9c887296f4db76d
deleted 96c8bb09dc1a2e998a574217f921911029d197c1f40bf81eb983286d484f74b0
deleted fd65fd9f19f58489ad910135803d1d89928927820d73110adefa161932cd335a
deleted b49eda688ce8c1226b6d7e02969f22361a8874cfee14c603e98ad855f1267a94
deleted 3a065aab44645209c4c3d3746f31b17cd6048a4148f890ed0fe9128baab9f553
deleted 9f9c4097a5eeb3e1b0f4fecaea5bbbe7da91f1d5e5ebb798b49047eca8e3e053
deleted be7d6d554a4bcc2b43d042f800f8f75055063ba668b9c7d60c831b16c0f26d3c
deleted ad499d8d07ad9998ee30577b376b76036eec716352318f550f5cec2cdfe5bfb1
deleted 46758452d3eef8cacb188405495d52d265f0c3a7580dfec51cb627c04c7bafc4
deleted c1d35649879861aec54f6ee4b049d573fd0e876178c558664af8da0eb0313b3d
deleted b333a6ba512596007c2683825dd364570303624164926019bbe674d90c28d5fc
deleted 29e4011ec5ddd973132dc62a298532cf7e74ed52accb51dcabdde661c4b35e88
deleted 69a77b9e82a72c35ec6ef0440fc5e3d0d32cc3235dcf9953f938d0c00bc2592f
deleted 469f7b67563d268cf25bb109da2d34e54c8b6ecf46f217c153260ab19bb016b6
deleted 430c16482b7d918525165f02610d7d24692dbdb96c02662a4be1b11cfe9144e6
deleted 77ed5ebc3d9d48581e8afcb75b4974978321bd74f018613483570fcd61a15de8
deleted bfa33b545f308b89bfcdc2f1494a8b33eb4942225428283684bf724802af9feb
deleted c21043749f3985bf7b16d9f5dcb64761f4571f2f50995486f0303fbfa63af1a2
deleted f62ebdf5041307d70c3b258918b2b7fe65f9470020c100b2369288e69a46602f
deleted b8867b6470fa5a2ad4993cdfa8407c089792c9ca28a99246628bc1b093afaf61
deleted a5ca0b27295ac877b32fed9056cd9e0685aa103880b5b4608fa018a7b2675ebe
deleted 44f35edb16d2a3aa958968b4825b37b2decb9bb1021522a02815b3ec3f9fe378
deleted 4c2e345eb1c3ec2b19a9e4c3ee422a8b01d280bcea5c4b4d3144aace2e231d82
deleted f1139c06d62421bbf77cec7852ff280a151d6d44f8964534b4a01f00bd745613
deleted f6b4fb9446345fcad2db26eac181fef6c0a919c8a4fcccd3bea5deb7f6dff67e
deleted b0c2909d1da88c295531b3acb353524ebc452d70a198d012df008a0c2f30a70a
deleted 6495489e65b7e1f05fff4e6828ece2ce1b0d5cf5b0bd740bb0d0b1185803c8a3
deleted 74b67d9de7c0a62fd14e11a737e0f6ed8fa9d0803c0ecbde23ff302e7523495f
deleted f78e6840ded1aafb6c9f265f52c2fc7c0a990813ccf96702df84a7dcdbe48bea
deleted 8a6eaca30cf8f88d713fd5040661cefa076b0e809dc27a52e38863c567531379
deleted 8ceaa5e44e0777ada21c9afb0afbc0b2ff35f3836d185d019982004e0ba04fc7
deleted 2bc9dea49d1a226db134bce761bfa89dd456109555c3ee4c490db84ad48d53b0
deleted 7fd44050a834a9d06057d8d20b5d7c11e37682ad42d2b64bdc9112118262a3d2
deleted e954aa43bc3d58a30a967d36b0b0ebf408eea4b1283106d2ca553b0243858d6b
deleted 5a6960d24672eeb3ab99648411781c92a07e762305fd81152a600d3fadb68b33
deleted 4ff685e2bcafdab0d2a9b15cbfd9d28f5dfe69af97e3bb1987ed483b0abf5a99
deleted b07db1bde08dc5ef78326cace055da8387ab54dc352f0e786acfb2efa43b6f45
deleted 9e240dbce563eba2b4cfb6f86247dc75047c1b2a6a54dba00129f113737f4880
deleted c3505dfdb7a6ef524d17d0ee391749f94de950c43642e3286e06172577e184a3
deleted c7dc643c3cfd3d741403be633468db3858d7ec09034ccb10b86836165f600607
deleted 8a49fdb3b6a5ff2bd8ec6a86c05b2922a0f7454579ecc07637e94dfd1d0639b6
deleted 16184b59f4c7ede13940875705528ce315e96c08c4fcbab3c69676a9cef17159
deleted d7ce2729f5f4d1716be99bc2376a7ea2906d293543c4bcd31693e569e6c04fee
deleted 65c9c10b984f059d0a8b8a054ae2d7ee817ce2caf06ade436074dc89dfbf0717
Reclaimed 3.35 GB in disk space
").contains(alpine → "ghcr.io/linuxcontainers/alpine:3.20")
↳ should prune alpine image
✘ Test testImagePruneUnusedImages() recorded an issue at TestCLINoParallelCases.swift:86:9: Expectation failed: alpineRemoved
↳ expected image ghcr.io/linuxcontainers/alpine:3.20 to be removed
✘ Test testImagePruneUnusedImages() failed after 21.787 seconds with 2 issues.
◇ Test testImagePruneDanglingImages() started.
✔ Test testImagePruneDanglingImages() passed after 69.015 seconds.
➜ Test testNetworkPruneNoNetworks() skipped: "Requires macOS 26"
➜ Test testNetworkPruneUnusedNetworks() skipped: "Requires macOS 26"
➜ Test testNetworkPruneSkipsNetworksInUse() skipped: "https://github.com/apple/container/issues/953"
➜ Test testNetworkPruneSkipsNetworkAttachedToStoppedContainer() skipped: "https://github.com/apple/container/issues/953"
✘ Suite TestCLINoParallelCases failed after 92.555 seconds with 2 issues.
↳ /// Tests that need total control over environment to avoid conflicts.
✘ Test run with 9 tests in 1 suite failed after 92.555 seconds with 2 issues.

@JaewonHur
Copy link
Contributor Author

JaewonHur commented Jan 15, 2026

Previous failures may have affect the following ones.
Not sure what's the first test case causing the issue... no test seems touching the code I updated.

Below is the failing test cases in git action. Could we try testing again to check it reproduces the same?

2026-01-14T23:29:22.6911480Z ✘ Test testRunCommandPlatform() failed after 77.334 seconds with 1 issue.
2026-01-14T23:29:22.6911960Z ✘ Test testRunDefaultHostsEntries() failed after 77.334 seconds with 1 issue.
2026-01-14T23:47:36.1332820Z ✘ Test testImagePruneUnusedImages() failed after 21.787 seconds with 2 issues.

Run = Create + Start

1) Mount source points to a valid directory
   - Run and Create + Start both correctly create the container with
     mount.

2) Mount source points to a file
   - Run fails bootstrapping the container, thus container not created.
   - Create creates the container, but Start fails bootstrapping,
     removing the container.
     (Thus, both are the same.)

3) Mount source deleted or replaced to file after container created
   - Start throw errors but do not delete the container.
@JaewonHur JaewonHur force-pushed the check-virtiofs-deleted branch from b7f738d to e840b77 Compare January 15, 2026 01:53
@JaewonHur JaewonHur requested a review from jglogan January 15, 2026 01:55
@JaewonHur
Copy link
Contributor Author

Integration test succeeded on my Mac.

✔ Suite TestCLINetwork passed after 16.947 seconds.
✔ Suite TestCLIRunLifecycle passed after 3.351 seconds.
✔ Suite TestCLIExecCommand passed after 3.131 seconds.
✔ Suite TestCLICreateCommand passed after 5.006 seconds.
✔ Suite TestCLIRunCommand passed after 56.832 seconds.
✔ Suite TestCLIStatsCommand passed after 6.962 seconds.
✔ Suite TestCLIImagesCommand passed after 36.785 seconds.
✔ Suite TestCLITermIO passed after 1.346 seconds.
✔ Suite TestCLIRunBase passed after 1.346 seconds.
✔ Suite CLIBuilderEnvOnlyTest passed after 24.335 seconds.
✔ Suite CLIBuilderLifecycleTest passed after 4.038 seconds.
✔ Suite CLIBuilderLocalOutputTest passed after 4.220 seconds.
✔ Suite CLIBuilderTarExportTest passed after 5.943 seconds.
✔ Suite CLIBuilderTest passed after 38.796 seconds.
✔ Suite TestCLIBuildBase passed after 77.334 seconds.
✔ Suite TestCLIVolumes passed after 19.690 seconds.
✔ Suite TestCLIKernelSet passed after 108.282 seconds.
✔ Suite TestCLIAnonymousVolumes passed after 26.928 seconds.
✔ Suite TestCLINoParallelCases passed after 40.251 seconds.

Comment on lines +73 to +77
for mount in container.configuration.mounts where mount.isVirtiofs {
if !FileManager.default.fileExists(atPath: mount.source) {
throw ContainerizationError(.invalidState, message: "path '\(mount.source)' is not a directory")
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for us to do this in bootstrap in the API server instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be, but it might be duplicated as ClientCreate and ClientRun checks the mount source also.

Current bootstrap implicitly does it as making VM throws an error due to the wrong mount source path.
The thing is then, the container is just removed forever due to the cleanup logic.

@JaewonHur
Copy link
Contributor Author

It seems RunCommand fails randomly due to the XPC timeout when creating the container, but API server actually created the container internally.

✘ Test testRunCommandOSArch() recorded an issue at TestCLIRunCommand.swift:298:25: Issue recorded
↳ failed to run container .executionFailed("command failed: \u{1B}[33mWarning!\u{1B}[0m Running debug build. Performance may be degraded.\nError: internalError: \"failed to create container\" (cause: \"internalError: \"XPC timeout for request to com.apple.container.apiserver/containerCreate\"\")\n")
2
✘ Test testRunCommandOSArch() failed after 84.430 seconds with 1 issue.

Since the container is not cleaned up in the earlier test, image prune fails as alpine image is not dangling.

✘ Test testImagePruneUnusedImages() recorded an issue at TestCLINoParallelCases.swift:86:9: Expectation failed: alpineRemoved
↳ expected image ghcr.io/linuxcontainers/alpine:3.20 to be removed
✘ Test testImagePruneUnusedImages() failed after 20.391 seconds with 2 issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants