Closed Bug 1342257 Opened 9 years ago Closed 9 years ago

tc-worker should schedule a self-reboot at least every 96 hours

Categories

(Taskcluster :: Workers, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dustin, Assigned: dustin)

References

Details

Attachments

(3 files)

Puppet / OCC will run on reboot only, and we need hosts to keep their config up to date. Per bug 1336050, we'll also need hosts to renew their credentials. So, taskcluster-worker will need a feature to shutdown before 96 hours have expired. Maybe this can be a "soft stop" when idle after, say, 86 hours; or a hard stop at 96 hours.
This can be easily implemented inside the reboot plugin. I can implement this after bug 1341743
<whine>but I wanna help!</whine>
Status: NEW → ASSIGNED
Commits pushed to master at https://github.com/taskcluster/taskcluster-worker https://github.com/taskcluster/taskcluster-worker/commit/b6b87cf71e2aa647eb1093d080ca35a507f7e21d Bug 1342257: support rebooting after a configurable number of hours * use a RWLock to avoid race conditions in shutting down the worker * add required plugin config * reboot delay (in hours) * reboot command (to allow use of sudo where necessary) * update POSIX reboot technique: * Wait for the reboot command to complete and panic if it fails Note that in my testing, this terminates the worker before it can execute the reboot command. https://github.com/taskcluster/taskcluster-worker/commit/e88eb851442fd99c0b5a20b4dbfd6ce46954b5a5 Merge pull request #181 from taskcluster/bug1342257 support rebooting after a configurable number of hours
waiting to deploy this until we're ready with the secrets service
Can we close this bug?
Actually, I was mixing this up with the hostsecrets config plugin. This one could get deployed now, right? How do I go about making a release of tc-worker and deploying it on the macs?
I don't think we need to deploy to close the bug, at least this hasn't been the way we were doing, but nothing stops us from doing that either :)
I'd like to see hosts rebooting so I can be confident this worked :)
Wander, can you point me to instructions for deploying a new worker? If I practice with this one, then I will know how to deploy when the worker-secrets service is ready :)
Flags: needinfo?(wcosta)
(In reply to Dustin J. Mitchell [:dustin] from comment #10) > Wander, can you point me to instructions for deploying a new worker? If I > practice with this one, then I will know how to deploy when the > worker-secrets service is ready :) * Tag a new release and push it to github.com. It (should) generates the binary automatically * Download the macosx64 binary to puppet master /repo/data/EXEs/ (I can't recall the exact path) * Update the version https://github.com/mozilla/build-puppet/blob/master/modules/packages/manifests/mozilla/taskcluster_worker.pp#L11 * Reboot the machines 0040-0049 (or ask :aselagea to re-image them if you want to play safe).
Flags: needinfo?(wcosta)
> * Tag a new release and push it to github.com. It (should) generates the binary automatically This doesn't seem to work: https://travis-ci.org/taskcluster/taskcluster-worker/jobs/214687349 mv: rename /Users/travis/gopath/src/github.com/taskcluster/taskcluster-worker/taskcluster-worker to /Users/travis/gopath/src/github.com/taskcluster/taskcluster-worker/taskcluster-worker-0.0.11-darwin-amd64: No such file or directory I also see the `.travis_rename_releases.sh` script setting an env var just before exiting the shell (taking the var out of scope), but that env var is referenced in .travis.yml. I'm not sure how that would work. Pete, can you help?
Flags: needinfo?(pmoore)
(In reply to Dustin J. Mitchell [:dustin] from comment #12) > > * Tag a new release and push it to github.com. It (should) generates the binary automatically > > This doesn't seem to work: > https://travis-ci.org/taskcluster/taskcluster-worker/jobs/214687349 > mv: rename > /Users/travis/gopath/src/github.com/taskcluster/taskcluster-worker/ > taskcluster-worker to > /Users/travis/gopath/src/github.com/taskcluster/taskcluster-worker/ > taskcluster-worker-0.0.11-darwin-amd64: No such file or directory It looks like when we changed from using `go build` to `go install` (which I think we did because some linters require/inspect pkg files) we forgot to update .travis_rename_releases.sh to use the install path, rather than the source directory. In other words, mv "${TRAVIS_BUILD_DIR}/taskcluster-worker${FILE_EXT}" "${RELEASE_FILE}" should be instead: mv "${GOPATH}/bin/${GOOS}_${GOARCH}/taskcluster-worker${FILE_EXT}" "${RELEASE_FILE}" > I also see the `.travis_rename_releases.sh` script setting an env var just > before exiting the shell (taking the var out of scope), but that env var is > referenced in .travis.yml. I'm not sure how that would work. Pete, can you > help? This file is sourced, not executed in .travis.yml: before_deploy: - "source .travis_rename_releases.sh" Also note, release instructions are in https://github.com/taskcluster/taskcluster-worker#releasing
Flags: needinfo?(pmoore)
Thanks! I missed the sourcing, that's cool :)
That worked for Windows but not Darwin or Linux. I'll see if I can figure it out.
Great success! Pete, please feel free to re-import this fix into generic-worker. Now, to deploy.
Flags: needinfo?(pmoore)
With generic-worker, do we need to reboot every 96 hours if it already reboots after every task? I would hope that the machine health API would find machines that haven't run a task in XX hours, otherwise, machines should be rebooting fairly frequently. This also opens up the question...should we be rebooting after every task?
If machines aren't busy enough to be running tasks every 96 hours, then we would need something like this. And, rebooting after every task takes a little bit of time and also loses the buffer cache, so not rebooting would be more efficient. That said, macs reboot in less than 1 minute, so it's not a huge hit.
re: minute overhead This might be ok, as long as it doesn't cause a nasty backlog. Macs reboot quick, hopefully the Windows and Linux machines are not bad. re: rebooting after ever job Currently the macs can have a perfect storm scenario and cause strain on the puppet masters. If we are increasing the amount of reboots these machines experience, we'll need to coordinate with relops so they can beef up these instances. re: max uptime of a machine Good point that it's not guaranteed that a machine will claim a task causing it to reboot every 96 hours. There is an expectation that configuration changes can be deployed and machines running with that in a certain amount of time. I believe that this is 24 hours now, so we might even need to lower the 96 hours, which is quite a bit of time to elapse.
Attachment #8851668 - Flags: review?(jwatkins) → review+
In generic worker, it is possible to configure the worker to reboot after executing a configurable number of tasks. In AWS, on win7, we do this every task - on the other platforms, we do not use this feature, but instead, we poll a url every X minutes (default = 30) between tasks, never when a task is running, to see if the worker should terminate or not. We can also do this on hardware workers. We'd have to hit a different url, but that is quite doable. In the meantime, a good start would be that we just set the workers to reboot after running e.g. 20 tasks - this is certainly better than not rebooting at all, and means on average we only get the cost of 1/20th of the reboot time per task, since it only happens 1 in 20 times. Typically, at our high utilisation, I would expect this to result in most workers rebooting daily during the working week. We can monitor, and tweak accordingly, until we have a more tuned solution.
Flags: needinfo?(pmoore)
Bug 1342263 covers rebooting in generic-worker. The needinfo was just to import the release script fix :)
Attachment #8852062 - Flags: review?(wcosta)
Attachment #8852062 - Flags: review?(wcosta) → review+
On the plus side, the macs I rebooted are now rebooting every 96 seconds.
Attachment #8852597 - Flags: review?(wcosta)
Comment on attachment 8852597 [details] [diff] [review] reboot-slower.patch actually, never mind - I'll just land this as a bustage patch
Attachment #8852597 - Flags: review?(wcosta) → review+
I rebooted minis 0040-0048 just now, so they get this change. After this point we should never see more than 4 days of uptime (most were at 34 days!)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Component: Worker → Workers
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: