Skip to content
This repository was archived by the owner on Feb 20, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion livelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ func (l *LiveLogTask) reinstateBackingLog() {
}

func (l *LiveLogTask) uploadLiveLog() error {
maxRunTimeDeadline := l.task.LocalClaimTime.Add(time.Duration(l.task.Payload.MaxRunTime) * time.Second)
// add an extra 15 minutes, to adequately cover client/server clock drift or task initialisation delays
maxRunTimeDeadline := time.Now().Add(time.Duration(l.task.Payload.MaxRunTime+900) * time.Second)
// deduce stateless DNS name to use
statelessHostname := hostname.New(config.PublicIP, config.Subdomain, maxRunTimeDeadline, config.LiveLogSecret)
getURL, err := url.Parse(l.liveLog.GetURL)
Expand Down
5 changes: 1 addition & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,7 @@ func (task *TaskRun) resolve(e *ExecutionErrors) *CommandExecutionError {

func (task *TaskRun) setMaxRunTimer() *time.Timer {
return time.AfterFunc(
// Round(0) forces wall time calculation instead of monotonic time in case machine slept etc
task.maxRunTimeDeadline.Round(0).Sub(time.Now()),
time.Second*time.Duration(task.Payload.MaxRunTime),
func() {
// ignore any error the Abort function returns - we are in the
// wrong go routine to properly handle it
Expand Down Expand Up @@ -1141,8 +1140,6 @@ func (task *TaskRun) Run() (err *ExecutionErrors) {
log.Printf("Running task https://tools.taskcluster.net/task-inspector/#%v/%v", task.TaskID, task.RunID)

task.Commands = make([]*process.Command, len(task.Payload.Command))
// need to include deadline in commands, so need to set it already here
task.maxRunTimeDeadline = time.Now().Add(time.Second * time.Duration(task.Payload.MaxRunTime))
// generate commands, in case features want to modify them
for i := range task.Payload.Command {
err := task.generateCommand(i) // platform specific
Expand Down
13 changes: 6 additions & 7 deletions model.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ type (
Status TaskStatus `json:"-"`
Commands []*process.Command `json:"-"`
// not exported
logMux sync.RWMutex
logWriter io.Writer
maxRunTimeDeadline time.Time
queueMux sync.RWMutex
Queue *tcqueue.Queue `json:"-"`
StatusManager *TaskStatusManager `json:"-"`
LocalClaimTime time.Time `json:"-"`
logMux sync.RWMutex
logWriter io.Writer
queueMux sync.RWMutex
Queue *tcqueue.Queue `json:"-"`
StatusManager *TaskStatusManager `json:"-"`
LocalClaimTime time.Time `json:"-"`
// PlatformData contains platform-specific data related to the
// execution environment, such as access tokens on Windows
PlatformData *PlatformData `json:"-"`
Expand Down