-
Notifications
You must be signed in to change notification settings - Fork 1k
Fixes an issue where last-heartbeat time was set to the first event's timestamp #3361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes an issue where last-heartbeat time was set to the first event's timestamp #3361
Conversation
@@ -2074,7 +2074,6 @@ func (e *MutableStateImpl) ReplicateActivityTaskStartedEvent( | |||
ai.StartedEventId = event.GetEventId() | |||
ai.RequestId = attributes.GetRequestId() | |||
ai.StartedTime = event.GetEventTime() | |||
ai.LastHeartbeatUpdateTime = ai.StartedTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's another one in AddActivityTaskStartedEvent
.
Also, we need to be very careful on this. and make sure it won't break sync activity task or heartbeat timeout calculation. Have you checked all usage of this field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any places relying on this being non-null in the value-read usages. It looks like they all use timestamp.TimeValue which has null checks. In DescribeWorkflowExecution, we are already only optionally setting that field. In timer_sequence:getActivityHeartbeatTimeout, we default to the start time if the LastHeartbeatUpdateTime is zero, which will have the same behavior. We also replace the field, but I don't see why that would cause any issues because the way it's read will still be the same usages as the ones I already checked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, thanks for catching the one in AddActivityTaskStartedEvent, fixed.
16ba94c
to
6d7f8e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, but don't land this before 1.18
…s LastHeartbeatTime to the event time
f825283
to
3508fcc
Compare
This PR fixes a bug where the first event for a pending activity would set its LastHeartbeatTime to the event time. I tested the fix by writing a test which calls the
ReplicateActivityTaskStartedEvent
method which had this issue, and verifies that theLastHeartbeatDetails
are nil (as long as they were previously nil). The biggest risk to this change is if someone was depending onLastHeartbeatDetails
on their pending activities being non-nil.