Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Sometimes we attempt to control containers that don't exist #538

Open
BenElgar opened this issue Dec 7, 2021 · 1 comment
Open
Labels
bug Something isn't working

Comments

@BenElgar
Copy link
Contributor

BenElgar commented Dec 7, 2021

I believe the issue is a mismatch between what we refer to in exo as a container and what docker refers to as a container. Docker treats containers as disposable single use objects, to be lazily garbage collected at some undefined point in the future whilst, in exo, a container is really more akin to a docker-compose service. This causes problems when a docker container has been garbage collected by the docker daemon and we're still trying to interact with it:

e.g.

14:33:17    server 2021/12/07 14:33:17 container to be removed not found: "5df3bf4437c4acc2ec02ed219bf8734a7ca87057dc07980f534104181aeb55df"

More importantly this sometimes breaks the start mechanism, since the docker container may not exist when exo tries to start the container.

func (c *Container) Start(ctx context.Context, input *core.StartInput) (*core.StartOutput, error) {
	//c.Initialize(ctx, &core.InitializeInput{Spec: })
	if err := c.start(ctx); err != nil {
		return nil, fmt.Errorf("starting process container: %w", err)
	}
	return &core.StartOutput{}, nil
}

func (c *Container) start(ctx context.Context) error {
	err := c.Docker.ContainerStart(ctx, c.State.ContainerID, types.ContainerStartOptions{})
	if err != nil {
		c.State.Running = true
		return fmt.Errorf("starting container: %w", err)
	}
	return nil
}
@BenElgar BenElgar added bug Something isn't working needs triage Incoming request that needs to be triaged and prioritized labels Dec 7, 2021
@brandonbloom
Copy link
Member

I think we can fix this as part of the other work I have planned to separate components from resources. Essentially, the component roughly correspond to the compose-style service with longer lifetime than the underlying container resource, which may be created/destroyed more freely.

@brandonbloom brandonbloom removed the needs triage Incoming request that needs to be triaged and prioritized label Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants