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

Windows: Container log rotation may fail if the container logs are followed #124443

Open
claudiubelu opened this issue Apr 22, 2024 · 2 comments · May be fixed by #124444
Open

Windows: Container log rotation may fail if the container logs are followed #124443

claudiubelu opened this issue Apr 22, 2024 · 2 comments · May be fixed by #124444
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/windows Categorizes an issue or PR as relevant to SIG Windows.

Comments

@claudiubelu
Copy link
Contributor

claudiubelu commented Apr 22, 2024

What happened?

The test k8s.io/kubernetes/pkg/kubelet/kuberuntime/logs.TestReadRotatedLog is failing on Windows [0]:

{Failed  === RUN   TestReadRotatedLog
    logs_test.go:276: 
        	Error Trace:	C:/kubernetes/pkg/kubelet/kuberuntime/logs/logs_test.go:276
        	Error:      	Received unexpected error:
        	            	rename C:\Users\azureuser\AppData\Local\Temp\TestReadRotatedLog1957435032\001\logfile2771403626 C:\Users\azureuser\AppData\Local\Temp\TestReadRotatedLog1957435032\001\logfile2771403626.2220240422-035910: The process cannot access the file because it is being used by another process.
        	Test:       	TestReadRotatedLog
        	Messages:   	failed to rotate log "C:\\Users\\azureuser\\AppData\\Local\\Temp\\TestReadRotatedLog1957435032\\001\\logfile2771403626" to "C:\\Users\\azureuser\\AppData\\Local\\Temp\\TestReadRotatedLog1957435032\\001\\logfile2771403626.2220240422-035910"
--- FAIL: TestReadRotatedLog (0.21s)

The idea of the test is to check that kubelet still follows and reads the Container Logs after a Log Rotation occured. However, because the followed file is open, it cannot be renamed, and thus, the container logs cannot be rotated.

This issue could be prevented if the file would be opened with the FILE_SHARE_DELETE flag set [1]: Delete access allows both delete and rename operations.

[0] https://prow.k8s.io/view/gs/kubernetes-jenkins/logs/ci-kubernetes-unit-windows-master/1782243642258231296
[1] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea

What did you expect to happen?

Kubelet should not block container log rotation.

How can we reproduce it (as minimally and precisely as possible)?

Run the test k8s.io/kubernetes/pkg/kubelet/kuberuntime/logs.TestReadRotatedLog is failing on Windows.

Anything else we need to know?

/sig windows

/kind bug
/kind failing-test

Kubernetes version

latest, master. This unit test has been failing for a while.

Cloud provider

N/A

OS version

Windows nodes

Install tools

N/A

Container runtime (CRI) and version (if applicable)

N/A

Related plugins (CNI, CSI, ...) and versions (if applicable)

N/A

@claudiubelu claudiubelu added the kind/bug Categorizes issue or PR as related to a bug. label Apr 22, 2024
@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 22, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@claudiubelu
Copy link
Contributor Author

/kind failing-test
/sig windows

@k8s-ci-robot k8s-ci-robot added kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. sig/windows Categorizes an issue or PR as relevant to SIG Windows. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/windows Categorizes an issue or PR as relevant to SIG Windows.
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants