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

Ignore transient errors when gathering stats for Windows Containers in Dockershim #98510

Merged

Conversation

jsturtevant
Copy link
Contributor

What type of PR is this?
/kind bug

What this PR does / why we need it:
When a Windows container is started by docker there is a case when stats may be accessed before the container is started causing errors.

Which issue(s) this PR fixes:

Fixes #98509

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Fix errors when accessing Windows container stats for Dockershim 

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


/sig windows

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. sig/windows Categorizes an issue or PR as relevant to SIG Windows. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. labels Jan 28, 2021
@jsturtevant
Copy link
Contributor Author

/priority critical-urgent

@k8s-ci-robot k8s-ci-robot added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jan 28, 2021
@jsturtevant jsturtevant changed the title Ignore transient errors when gather stats for Windows Containers in Dockershim Ignore transient errors when gathering stats for Windows Containers in Dockershim Jan 28, 2021
@ehashman ehashman added this to Triage in SIG Node PR Triage Jan 28, 2021
Copy link
Member

@ehashman ehashman left a comment

Choose a reason for hiding this comment

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

/triage accepted
LGTM but I'm not a windows person :)

pkg/kubelet/dockershim/docker_stats_windows.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 28, 2021
@ehashman ehashman moved this from Triage to Needs Reviewer in SIG Node PR Triage Jan 28, 2021
@jsturtevant
Copy link
Contributor Author

/assign @marosset

@jsturtevant
Copy link
Contributor Author

looks like pull-kubernetes-bazel-build failed with

2021/01/28 21:58:14 Image pull was unsuccessful: unable to save remote image k8s.gcr.io/build-image/debian-base@sha256:afff10fcd513483e492807f8d934bdf0be4a237997f55e0f1f8e34c04a6cb213: unable to write image layers: unable to write image layer: unable to write the contents of layer 0 to /bazel-scratch/.cache/bazel/_bazel_root/7989b31489f31aee54f32688da2f0120/external/debian-base-amd64/image/000.tar.gz: read tcp 10.32.255.3:46322->142.250.128.128:443: read: connection reset by peer

/retest

@jsturtevant
Copy link
Contributor Author

looks like the azure disk is known issue: #98492

@jsturtevant
Copy link
Contributor Author

/test pull-kubernetes-e2e-azure-disk-windows

// This is transient; skip container for now
// These hcs errors do not have helpers exposed in public package so need to query for the known codes:
// https://github.com/microsoft/hcsshim/blob/master/internal/hcs/errors.go
klog.Errorf("Container is not in a state that stats can be accessed '%s': %v. This occurs when the container is created but not started.", containerID, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we make this an info message since nothing is actually wrong and there is nothing actionable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was following the same pattern as above

if !hcsshim.IsNotExist(err) && !hcsshim.IsAlreadyStopped(err) {
klog.Errorf("Error opening container (stats will be missing) '%s': %v", containerID, err)
}

If we do that here I think we should do it there too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's update both messages to log as Info at V(4).
That matches some similar logs messages i'm seeing in dockershim

klog.V(4).Infof("Unable to convert docker to runtime API container: %v", err)

@ehashman any concerns or comments with this?

Copy link
Member

Choose a reason for hiding this comment

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

I know we're not yet on structured logging in this file yet but I don't think there's any issue with changing this to an Info, the current guidance is that expected errors are fine to log at the info level: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#using-errors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated to log using info

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 2, 2021
@marosset
Copy link
Contributor

marosset commented Feb 2, 2021

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 2, 2021
@marosset
Copy link
Contributor

marosset commented Feb 2, 2021

/milestone v1.21

@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Feb 2, 2021
@ehashman ehashman moved this from Needs Reviewer to Needs Approver in SIG Node PR Triage Feb 2, 2021
@jsturtevant
Copy link
Contributor Author

/test pull-kubernetes-e2e-azure-disk-windows

@jsturtevant
Copy link
Contributor Author

@ehashman this is ready for final approval

@jsturtevant
Copy link
Contributor Author

@ehashman I see you are not the approver for this sorry!

/assign @dchen1107 @derekwaynecarr

@mrunalp
Copy link
Contributor

mrunalp commented Feb 9, 2021

/approve

@mrunalp mrunalp moved this from Needs Approver to Done in SIG Node PR Triage Feb 9, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jsturtevant, marosset, mrunalp

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 9, 2021
@k8s-ci-robot k8s-ci-robot merged commit b9b11d3 into kubernetes:master Feb 9, 2021
@AbelHu
Copy link

AbelHu commented May 13, 2021

@jsturtevant Thanks for fixing this issue. Do you have a plan to backport this fix to earlier versions since lots of users are hitting this issue?

k8s-ci-robot added a commit that referenced this pull request Jun 8, 2021
…#98510-upstream-release-1.20

Automated cherry pick of #98510: Ignore transient errors when gather stats
k8s-ci-robot added a commit that referenced this pull request Jun 8, 2021
…#98510-upstream-release-1.19

Automated cherry pick of #98510: Ignore transient errors when gather stats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/windows Categorizes an issue or PR as relevant to SIG Windows. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
8 participants