Skip to content
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

fix(controller): Workflow hangs indefinitely during ContainerCreating if the Pod or Node unexpectedly dies #5585

Merged
merged 8 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions pkg/apis/workflow/v1alpha1/workflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ const (
VolumeClaimGCOnSuccess VolumeClaimGCStrategy = "OnWorkflowSuccess"
)

type NodePendingReason string
sarabala1979 marked this conversation as resolved.
Show resolved Hide resolved

const (
WaitingForSyncLock NodePendingReason = "PendingForSyncLock"
)

// Workflow is the definition of a workflow resource
// +genclient
// +genclient:noStatus
Expand Down Expand Up @@ -1279,9 +1285,12 @@ func (n Nodes) Find(f func(NodeStatus) bool) *NodeStatus {
return nil
}

func (ns NodeStatus) IsPodCreated() bool {
func (ns NodeStatus) GetPendingReason() NodePendingReason {
sarabala1979 marked this conversation as resolved.
Show resolved Hide resolved
// If node is waiting for synchronize lock, Pod will not be created in this scenario
return ns.SynchronizationStatus == nil || ns.SynchronizationStatus.Waiting == ""
if ns.SynchronizationStatus != nil || ns.SynchronizationStatus.Waiting != "" {
return WaitingForSyncLock
}
return ""
}

func NodeWithDisplayName(name string) func(n NodeStatus) bool {
Expand Down
3 changes: 2 additions & 1 deletion workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -976,9 +976,10 @@ func (woc *wfOperationCtx) podReconciliation(ctx context.Context) error {
// If the node is pending and the pod does not exist, it could be the case that we want to try to submit it
// again instead of marking it as an error. Check if that's the case.
// Node will be in pending state without Pod create if Node is waiting for Synchronize lock
if node.Pending() && !node.IsPodCreated() {
if node.Pending() && node.GetPendingReason() == wfv1.WaitingForSyncLock {
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be || not &&?

Copy link
Member Author

Choose a reason for hiding this comment

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

should be &&

Copy link
Member Author

Choose a reason for hiding this comment

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

The node should not fail/error if the node is in a pending state with WaitforSyncLock.

Copy link
Contributor

Choose a reason for hiding this comment

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

are you sure? && means that any node that is pending and not waiting for lock may be marked as error

Copy link
Member Author

Choose a reason for hiding this comment

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

yes. I am sure. There is another scenario (pod. is not updated to informer) which will cover in recentlyStarted

Copy link
Contributor

Choose a reason for hiding this comment

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

@simster7 - can I request another opinion on this? I feel like I'm going mad.

continue
}

if recentlyStarted {
// If the pod was deleted, then we it is possible that the controller never get another informer message about it.
// In this case, the workflow will only be requeued after the resync period (20m). This means
Expand Down