Skip to content

[Bug]: Container auto deletes when we stop a container and start the same container within few milliseconds. #833

@theetherGit

Description

@theetherGit

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

Please watch the video:

error-on-start-after-stopping-container.mov

Current behavior

  • Start a container
container start redis
  • Stop the container
container stop redis
  • Start same container within a second
container start redis

Here you will get Error: internalError: "failed to bootstrap container" (cause: "internalError: "failed to bootstrap container redis (cause: "invalidState: "container expected to be in created state, got: shuttingDown"")"")
And it automatically removes the container from the system.

Expected behavior

  • Start a container
container start redis
  • Stop the container
container stop redis
  • Start same container within a second
container start redis

with no errors or safe fallback [Last version I used was 0.4.1, and it works fine].

Environment

- OS: macOS 26.0.1 (25A362)
- Xcode: Version 26.0 (17A5276g)
- Container: 0.6.0

Relevant log output

Error Output:
Error: internalError: "failed to bootstrap container" (cause: "internalError: "failed to bootstrap container redis (cause: "invalidState: "container expected to be in created state, got: shuttingDown"")"")

Container System Logs (container system logs):

container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] starting start [uuid=redis]
2025-11-03 15:07:16.912561+0530 0x3495b    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] configuring XPC server [uuid=redis]
2025-11-03 15:07:16.912799+0530 0x3495b    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] starting XPC server [uuid=redis]
2025-11-03 15:07:16.913228+0530 0x3496a    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `createEndpoint` xpc handler [uuid=redis]
2025-11-03 15:07:16.913521+0530 0x3496a    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `bootstrap` xpc handler [uuid=redis]
2025-11-03 15:07:16.917368+0530 0x3496c    Info        0x0                  7903   0    container-network-vmnet: [com.apple.container:NetworkVmnetHelper] allocated attachment [address=192.168.64.19/24] [gateway=192.168.64.1] [hostname=redis] [id=default]
2025-11-03 15:07:16.917587+0530 0x3495b    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] creating NATNetworkInterface with network reference [uuid=redis]
2025-11-03 15:07:17.358438+0530 0x3495b    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `startProcess` xpc handler [uuid=redis]
2025-11-03 15:07:17.466438+0530 0x3469e    Info        0x0                  7894   0    container-apiserver: [com.apple.container:APIServer] registering container redis with exit monitor
2025-11-03 15:07:17.466587+0530 0x3495b    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `state` xpc handler [uuid=redis]
2025-11-03 15:07:17.467322+0530 0x3496b    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `wait` xpc handler [uuid=redis]
2025-11-03 15:07:19.197011+0530 0x3496a    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `stop` xpc handler [uuid=redis]
2025-11-03 15:07:19.311404+0530 0x3496a    Error       0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] process deletion [id=redis] [uuid=redis] [error=internal error (13): unknown error processing request]
2025-11-03 15:07:19.318388+0530 0x3495b    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] init process exited with: ExitStatus(exitCode: 0, exitedAt: 2025-11-03 09:37:19 +0000) [uuid=redis]
2025-11-03 15:07:19.392325+0530 0x349e8    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] closing forwarders [uuid=redis]
2025-11-03 15:07:19.392326+0530 0x349e8    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] closed forwarders [uuid=redis]
2025-11-03 15:07:19.392639+0530 0x34750    Info        0x0                  7903   0    container-network-vmnet: [com.apple.container:NetworkVmnetHelper] released attachments [id=default] [hostname=redis]
2025-11-03 15:07:19.397007+0530 0x345fa    Info        0x0                  7894   0    container-apiserver: [com.apple.container:APIServer] Shutting down sandbox service for redis
2025-11-03 15:07:19.397250+0530 0x3496b    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `shutdown` xpc handler [uuid=redis]
2025-11-03 15:07:20.820642+0530 0x349e8    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `createEndpoint` xpc handler [uuid=redis]
2025-11-03 15:07:20.821021+0530 0x3496b    Info        0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `bootstrap` xpc handler [uuid=redis]
2025-11-03 15:07:20.821794+0530 0x3496b    Error       0x0                  20755  0    container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] handler for com.apple.container.sandbox/bootstrap threw error invalidState: "container expected to be in created state, got: shuttingDown" [uuid=redis]
2025-11-03 15:07:20.831084+0530 0x3469e    Error       0x0                  7894   0    container-apiserver: [com.apple.container:APIServer] WaitHandler for redis threw error internalError: "failed to wait for process redis in container redis" (cause: "interrupted: "XPC connection error: Connection interrupted"")
2025-11-03 15:07:20.903142+0530 0x346a0    Error       0x0                  7894   0    container-apiserver: [com.apple.container:APIServer] handler for containerBootstrap threw error internalError: "failed to bootstrap container redis" (cause: "invalidState: "container expected to be in created state, got: shuttingDown"")
2025-11-03 15:07:20.903147+0530 0x3469f    Info        0x0                  7894   0    container-apiserver: [com.apple.container:APIServer] Handling container redis exit. Code ExitStatus(exitCode: -1, exitedAt: 2025-11-03 09:37:20 +0000)
2025-11-03 15:07:20.903712+0530 0x3469e    Error       0x0                  7894   0    container-apiserver: [com.apple.container:APIServer] handler for containerStop threw error notFound: "container with ID redis not found"

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions