sdk-go icon indicating copy to clipboard operation
sdk-go copied to clipboard

Worker versioning + workflow session

Open robindarby opened this issue 2 years ago • 1 comments
trafficstars

Expected Behavior

Calling workflow.CreateSessio, while using a versioned worker, creates a new session context for that worker.

Actual Behavior

The new session has no worker; "internalSessionCreationActivity" will timeout: activity error (type: internalSessionCreationActivity, scheduledEventID: 6, startedEventID: 0, identity: ): activity ScheduleToStart timeout (type: ScheduleToStart) ;

Could it be because this internal activity has the following attribute: Use Compatible Version false (as seen in the UI)?

Steps to Reproduce the Problem

  1. set a worker version via the SDK as follows:
func setTemporalTaskQueueDefaultVersion(temporalClient client.Client, taskQueue string, buildId string) error {
	if err := temporalClient.UpdateWorkerBuildIdCompatibility(context.Background(), &client.UpdateWorkerBuildIdCompatibilityOptions{
		TaskQueue: taskQueue,
		Operation: &client.BuildIDOpAddNewIDInNewDefaultSet{
			BuildID: buildId,
		},
	}); err != nil {
		return err
	}
	return nil
}
  1. Then, use that version in the worker:
	w := worker.New(temporalClient, workflows.QueueName, worker.Options{
		EnableSessionWorker:     true,
		BuildID:                 *buildId,
		UseBuildIDForVersioning: useBuildIDForVersioning,
	})
  1. Now, in a workflow, when you call:
	activityOptions := workflow.ActivityOptions{
		StartToCloseTimeout: 60 * time.Minute,
		RetryPolicy: &temporal.RetryPolicy{
			MaximumAttempts: 2,
		},
		TaskQueue:        QueueName,
	}
	ctx = workflow.WithActivityOptions(ctx, activityOptions)

	so := &workflow.SessionOptions{
		CreationTimeout:  time.Minute,
		ExecutionTimeout: time.Hour,
	}
	ctx, err := workflow.CreateSession(ctx, so)
	if err != nil {
		return nil, err
	}
	defer workflow.CompleteSession(ctx)

Specifications

  • Version: v1.24.0
  • Platform: Linux

robindarby avatar Sep 06 '23 12:09 robindarby

Unfortunately worker versioning and sessions are not compatible at this time because the task queue used for internalSessionCreationActivity , the activity responsible for creating the session, does not have the same version info as the original task queue and the server has no way to link two task queues together.

Quinn-With-Two-Ns avatar Sep 09 '23 23:09 Quinn-With-Two-Ns