Skip to content

Fix start-to-close timeout failure caused by short heatbeat timeout#1300

Merged
GregoryTravis merged 24 commits into
mainfrom
gmt/sdk-5113-short-heartbeat-timeout
May 29, 2026
Merged

Fix start-to-close timeout failure caused by short heatbeat timeout#1300
GregoryTravis merged 24 commits into
mainfrom
gmt/sdk-5113-short-heartbeat-timeout

Conversation

@GregoryTravis
Copy link
Copy Markdown
Contributor

@GregoryTravis GregoryTravis commented May 28, 2026

When an activity has both startToCloseTimeout and heartbeatTimeout set, and heartbeatTimeout < startToCloseTimeout, the Core SDK's local timeout timer never fires because successful heartbeats keep resetting it. The activity runs indefinitely on the worker even after the server has timed it out.

The previous implementation simply ignored the start_to_close timeout when the heartbeat timeout was shorter, which would work if the heartbeat timeout was not reset after each heartbeat ack. Instead, the heartbeat acks kept the activity alive long after the server had hit the start-to-close timeout. The workflow correctly resolved with a timeout, but the activity kept running and occupying a worker task slot.

The fix is to run both timeouts together -- the one-time start_to_close timeout and the infinitely resettable heartbeat timeout.

Tests: 3 unit, 1 integration.

Fixes #1188

@GregoryTravis GregoryTravis requested a review from a team as a code owner May 28, 2026 14:54
Copy link
Copy Markdown
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't fully reviewed, but pretty concerned about the integration test being flakey.

Comment thread crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs Outdated
Comment thread crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs Outdated
Comment thread crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs Outdated
Comment thread crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs Outdated
Comment thread crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs Outdated
Comment thread crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs Outdated
Comment thread crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs Outdated
Comment thread crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs Outdated
Comment thread crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs Outdated
Comment thread crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs Outdated
Copy link
Copy Markdown
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, very minor suggestions

Comment thread crates/sdk-core/src/worker/activities.rs Outdated
Comment thread crates/sdk-core/src/worker/activities.rs Outdated
Comment thread crates/sdk-core/src/worker/activities.rs Outdated
Comment thread crates/sdk-core/src/worker/activities.rs Outdated
Comment thread crates/sdk-core/src/worker/activities.rs Outdated
Comment thread crates/sdk-core/src/worker/activities.rs Outdated
Comment thread crates/sdk-core/src/worker/activities.rs Outdated
Comment thread crates/sdk-core/src/worker/activities.rs Outdated
@GregoryTravis GregoryTravis merged commit fae4e5b into main May 29, 2026
22 checks passed
@GregoryTravis GregoryTravis deleted the gmt/sdk-5113-short-heartbeat-timeout branch May 29, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Activity not cancelled after start_to_close_timeout when heartbeat_timeout is shorter

2 participants