You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(engine): provisioning of dagger-engine not occuring when container is stopped #3793
Dagger fails to start running the dagger-engine- if the container (with the same name) already exists and is stopped.
Prerequisites
Make sure that no dagger engine is running (docker ps -a). Then:
> cd sdk/go
> go test -count=1 -race -run=TestImageProvision -v ./...
=== RUN TestImageProvision
--- PASS: TestImageProvision (17.80s)
PASS
ok dagger.io/dagger 18.037s
? dagger.io/dagger/internal/engineconn [no test files]
? dagger.io/dagger/internal/engineconn/dockerprovision [no test files]
? dagger.io/dagger/internal/engineconn/http [no test files]
? dagger.io/dagger/internal/engineconn/unix [no test files]
testing: warning: no tests to run
PASS
ok dagger.io/dagger/internal/querybuilder 0.172s [no tests to run]
Now, stop the dagger-engine- container, and re-run the tests:
> docker stop $(docker ps -a | grep dagger-engine- | cut -d " " -f 1)
> go test -count=1 -race -run=TestImageProvision -v ./...
=== RUN TestImageProvision
provision_test.go:72:
Error Trace: /Users/home/Documents/dagger-worktree/macos-runner/sdk/go/provision_test.go:72
Error: Received unexpected error:
EOF
Please visit https://dagger.io/help#go for troubleshooting guidance.
Test: TestImageProvision
--- FAIL: TestImageProvision (22.41s)
FAIL
FAIL dagger.io/dagger 22.792s
? dagger.io/dagger/internal/engineconn [no test files]
? dagger.io/dagger/internal/engineconn/dockerprovision [no test files]
? dagger.io/dagger/internal/engineconn/http [no test files]
? dagger.io/dagger/internal/engineconn/unix [no test files]
testing: warning: no tests to run
PASS
ok dagger.io/dagger/internal/querybuilder 0.260s [no tests to run]
FAIL
Was this encountered only by manually stopping the container or did the container stop for some other reason?
We set --restart always so if it's not manually stopped then it should restart on its own I think.
If the container was manually stopped by the user I'm not sure whether we actually should have our code restart it. All the setup code is automated, but if the user specifically goes out of their way to stop the container maybe it makes more sense to honor that and just let them manually start it again?
On the other hand, maybe that breaks the "magic" of automated provisioning. If we want to force restart the container then we should just change the provisioning code in internal/engine/docker.go to do a docker create followed by docker start rather than one docker run. That should give us idempotent behavior I think.
I'd probably air on the side of force restarting it for now since it results in the overall simplest behavior, but open to other opinions.
I guess the main issue was that dagger.Connect was failing because of this and we didn't get a proper error message about it in the test.
Yeah EOF is not very descriptive. Do you get a descriptive error if you configure log output in the client made by the test? I'm on mobile so hard to double check the code to see if that's already there atm
Following @sipsma's comment, it is safe to close this issue.
If the container was manually stopped by the user I'm not sure whether we actually should have our code restart it. All the setup code is automated, but if the user specifically goes out of their way to stop the container maybe it makes more sense to honor that and just let them manually start it again?
Activity
sipsma commentedon Nov 11, 2022
Was this encountered only by manually stopping the container or did the container stop for some other reason?
We set --restart always so if it's not manually stopped then it should restart on its own I think.
If the container was manually stopped by the user I'm not sure whether we actually should have our code restart it. All the setup code is automated, but if the user specifically goes out of their way to stop the container maybe it makes more sense to honor that and just let them manually start it again?
On the other hand, maybe that breaks the "magic" of automated provisioning. If we want to force restart the container then we should just change the provisioning code in internal/engine/docker.go to do a docker create followed by docker start rather than one docker run. That should give us idempotent behavior I think.
I'd probably air on the side of force restarting it for now since it results in the overall simplest behavior, but open to other opinions.
marcosnils commentedon Nov 11, 2022
Not sure it was accidentally stopped, but for some reason the engine process Exited and it was in "stopped" status.
I guess the main issue was that
dagger.Connectwas failing because of this and we didn't get a proper error message about it in the test.sipsma commentedon Nov 11, 2022
Yeah EOF is not very descriptive. Do you get a descriptive error if you configure log output in the client made by the test? I'm on mobile so hard to double check the code to see if that's already there atm
grouville commentedon Nov 11, 2022
Tried it, nope
grouville commentedon Dec 21, 2022
Following @sipsma's comment, it is safe to close this issue.
marcosnils commentedon Dec 21, 2022
@grouville shall we create a new issue to improve error handling on this case?
grouville commentedon Dec 21, 2022
Great idea !