Skip to content

activity Schedule To Close timeout(Activity complete after timeout) #1912

Open
@Pharaohsk

Description

@Pharaohsk

Expected Behavior

In a three-node cluster using Temporal, the time on each node is not synchronized. The Temporal server is deployed on the main control node, where Service A starts a workflow and sets configurations such as ScheduleToCloseTimeout and other timeout settings. When the task is scheduled to execute on Service B on node B, the local time on node B is later than that on node A. As a result, when Service B executes the task, its local time has already exceeded the timeout. It is expected that no error will be reported.

Actual Behavior

return err : Activity complete after timeout..
File : internal/internal_task_handlers.go

	info := getActivityEnv(ctx)
	ctx, dlCancelFunc := context.WithDeadline(ctx, info.deadline)
	defer dlCancelFunc()

	output, err := activityImplementation.Execute(ctx, t.Input)
	// Check if context canceled at a higher level before we cancel it ourselves
	isActivityCancel := ctx.Err() == context.Canceled

	dlCancelFunc()
	if <-ctx.Done(); ctx.Err() == context.DeadlineExceeded {
		ath.logger.Info("Activity complete after timeout.",
			tagWorkflowID, t.WorkflowExecution.GetWorkflowId(),
			tagRunID, t.WorkflowExecution.GetRunId(),
			tagActivityType, activityType,
			tagAttempt, t.Attempt,
			tagResult, output,
			tagError, err,
		)
		return nil, ctx.Err()
	}

I think the code should use context.WithTimeout instead of context.WithDeadline(ctx, info.deadline).

Steps to Reproduce the Problem

1.Use Temporal in a cluster with two or more nodes, with the Temporal server running on the main control node.
2.Configure the task timeout and allow the task to be scheduled for execution on another node.
3.Modify the time on all hosts in the cluster to be unsynchronized, with the time difference exceeding the configured task timeout.

Specifications

  • Version: v1.22.0
  • Platform: go version go1.18 linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions