Strange wkf behavior after setting workflowExecutionTimeout in config

Hi!
All this started after we set this on our client:

"workflowExecutionTimeout": "2592000s",   (30 days)

After firing a new (daily) scheduled execution with that change impacted, the workflow ran for 30 days and was automatically terminated with state Timed Out then.
As we understand it, that workflowExecutionTimeout should only affect a particular instance/run/execution of the workflow, and not the workflow as a whole.
When we looked at previous executions for the last 30 days, we noted all of them had this attribute set with the same exact date:

"workflowExecutionExpirationTime": "2023-01-15T19:16:34.108Z",

The last execution, the one that yielded Timed Out, has these events:

[
  {
    "eventId": "1",
    "eventTime": "2023-01-15T11:16:43.209226816Z",
    "eventType": "WorkflowExecutionStarted",
    "version": "0",
    "taskId": "198181457",
    "workflowExecutionStartedEventAttributes": {
      "workflowType": {
        "name": "MyWorkflow"
      },
      "parentWorkflowNamespace": "",
      "parentWorkflowNamespaceId": "",
      "parentWorkflowExecution": null,
      "parentInitiatedEventId": "0",
      "taskQueue": {
        "name": "prod",
        "kind": "Normal"
      },
      "input": {
        "payloads": [
          {
            "metadata": {
              "encoding": "xxxx"
            },
            "data": "xxx"
          }
        ]
      },
      "workflowExecutionTimeout": "2592000s",
      "workflowRunTimeout": "2592000s",
      "workflowTaskTimeout": "10s",
      "continuedExecutionRunId": "8c38ac8e-f791-4122-af57-5e2836af916a",
      "initiator": "CronSchedule",
      "continuedFailure": null,
      "lastCompletionResult": null,
      "originalExecutionRunId": "b0c18294-f6e1-4584-b4a4-46045a79efeb",
      "identity": "",
      "firstExecutionRunId": "2c26e776-aea2-4bed-9384-c5eb15f58519",
      "retryPolicy": {
        "initialInterval": "1s",
        "backoffCoefficient": 2,
        "maximumInterval": "100s",
        "maximumAttempts": 5,
        "nonRetryableErrorTypes": []
      },
      "attempt": 1,
      "workflowExecutionExpirationTime": "2023-01-15T19:16:34.108Z",
      "cronSchedule": "0 11 * * *",
      "firstWorkflowTaskBackoff": "85397s",
      "memo": null,
      "searchAttributes": null,
      "prevAutoResetPoints": {
        "points": []
      },
      "header": {
        "fields": {
          "CallerSID": {
            "metadata": {
              "encoding": "xxx=="
            },
            "data": "xxx"
          },
          "RequestId": {
            "metadata": {
              "encoding": "xxx=="
            },
            "data": "xxx"
          }
        }
      },
      "parentInitiatedEventVersion": "0"
    }
  },
  {
    "eventId": "2",
    "eventTime": "2023-01-15T19:16:35.380467096Z",
    "eventType": "WorkflowExecutionTimedOut",
    "version": "0",
    "taskId": "198181465",
    "workflowExecutionTimedOutEventAttributes": {
      "retryState": "Timeout",
      "newExecutionRunId": ""
    }
  }
]

What caught our attention was that empty newExecutionRunId and the unexpected workflowExecutionExpirationTime property.
We’ve never set workflowExecutionExpirationTime and in fact we couldn’t find a way to set that expiration time through Temporal’s Java SDK.

Temporal version: Java SDK 1.17.0

WorkflowRunTimeout limits duration of a single workflow run.
WorkflowExecutionTimeout limits duration of the chain (continue-as-new, workflow retry) workflow runs.

Thanks a lot, @maxim .
I see… so for example in the case of a daily-scheduled workflow, when setting WorkflowRunTimeout=30d but not setting WorkflowExecutionTimeout , would the workflow remain scheduled forever? Also, if a particular run gets stuck for 30 days, that run only will be TimedOut, and after that timeout period (30 days stuck), a new run will be initiated?

In the case of a cron workflow WorkflowRunTimeout=30d would allow a single invocation of the workflow to last up to 30 days. So, yes, it will execute the next one only after the previous stuck one times out.