hooks: default timeout #3282

Merged
merged 6 commits into from May 15, 2017

Conversation

Projects
None yet
6 participants
Contributor

stolowski commented May 9, 2017

Set default timeout for hooks to 10 min, if not provided by hook setup.
Also increased the timeout of configure hook to 10 min; we could remove a specific configure hook timeout and use a default, but I think it's good to keep it separate in the code for fine-tuning (also, configure hook timeout can be tweaked via env var).

Contributor

morphis commented May 9, 2017

@stolowski Why do we have to increase the timeout to 10min?

Member

chipaca commented May 9, 2017

I need to point out that the prepare-device hook has been known to take 10-15 minutes on some devices. It's been reduced thanks to tvoss's work, but might still be something like that in the future. I'd suggest leaving this default as is, but also adding a 30 minute timeout to the HookSetup in devicemgr.go.

Contributor

stolowski commented May 9, 2017

@chipaca thanks for pointing out, done.
@morphis apart from what John said, there seemed to be some consensus around increasing that timeout. I agree it's A LOT, but that's a fallback in case something goes wrong after all; configure scripts should do their best to check if the setup is ok to run etc and error out quickly on their own.

Contributor

pedronis commented May 9, 2017

@chipaca @stolowski the key generation was taking 10+ mins, but that's not a hook, the prepare-device hook doesn't do key generation, it sets some config options usually, it shouldn't take forever!

Member

chipaca commented May 9, 2017

Ah! i stand corrected then :-)

stolowski added some commits May 9, 2017

zyga approved these changes May 9, 2017

LGTM

looks good but some wonderings

overlord/configstate/configstate.go
@@ -37,7 +37,7 @@ func init() {
}
func configureHookTimeout() time.Duration {
- timeout := 5 * time.Minute
+ timeout := 10 * time.Minute
@pedronis

pedronis May 9, 2017

Contributor

it's not clear from the forum discussion if we want this too? @niemeyer?

@@ -280,6 +280,7 @@ func snapCmd() string {
var syscallKill = syscall.Kill
var cmdWaitTimeout = 5 * time.Second
+var defaultHookTimeout = 10 * time.Minute
@pedronis

pedronis May 9, 2017

Contributor

this matches the forum discussion

overlord/hookstate/hookstate_test.go
+
+ s.manager.Ensure()
+ completed := make(chan struct{})
+ go func() {
@pedronis

pedronis May 9, 2017

Contributor

I see the other tests are like this, but naively I'm not quite sure why need the goroutine here

@stolowski

stolowski May 9, 2017

Contributor

You're right, these tests can be simplified. Updated my test case. If we are OK with this change I will simplify existing tests in a separate PR.

@zyga zyga requested a review from niemeyer May 10, 2017

Contributor

stolowski commented May 12, 2017

Restored config hook timeout back to 5 minutes for now so that the change can land and config hook tweaking can be done in a separate PR.

zyga approved these changes May 12, 2017

LGTM

mvo5 approved these changes May 12, 2017

@pedronis pedronis merged commit 9a3bfc0 into snapcore:master May 15, 2017

7 checks passed

artful-amd64 autopkgtest finished (success)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
xenial-amd64 autopkgtest finished (success)
Details
xenial-i386 autopkgtest finished (success)
Details
xenial-ppc64el autopkgtest finished (success)
Details
yakkety-amd64 autopkgtest finished (success)
Details
zesty-amd64 autopkgtest finished (success)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment