Skip to content

Conversation

@thaJeztah
Copy link
Member

hopefully addresses #36801

This test is ocassionally failing because we run into a Windows sharing violation:

--- FAIL: TestJSONFileLoggerWithOpts (0.07s)
    jsonfilelog_test.go:187: open C:\Users\ContainerAdministrator\AppData\Local\Temp\docker-logger-344571653\container.log.1: The process cannot access the file because it is being used by another process.

This patch attempts to skip the test if we encounter this situation.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is the syscall error corresponding with the error we're running into, but perhaps someone working on a Windows machine can double-check

Copy link

Choose a reason for hiding this comment

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

By actual testing using a file locking utility [https://www.jensscheffler.de/filelocker], I observed that it is os.PathError and not os.SyscallError.

Trying to print it:
Err3 &{%!!(string=open) %!!(string=ttr) %!!(syscall.Errno=32)}V

So the check against windows.ERROR_SHARING_VIOLATION stays the same because its value is 32.

Why not bypass all this and just check the exact error string - just trying to learn best practices here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Errorstrings usually are for humans, and may change (or even be localised in the Windows case), so trying to avoid string matching where possible.

Perhaps this particular error is "stable", but we had a case (need to search for it) where the message changed in Windows RS4 or RS5, causing things to break

@thaJeztah thaJeztah force-pushed the conditionally_skip_TestJSONFileLoggerWithOpts branch from 65f594d to da86706 Compare September 3, 2019 11:51
@thaJeztah
Copy link
Member Author

@ddebroy @StefanScherer @vikramhh PTAL - just a quick 'n dirty attempt to fix the flakiness without always skipping the test. Please verify if this looks good (and if I got the right syscall error 😅

@thaJeztah
Copy link
Member Author

Windows RS1 is failing on a timeout on DockerSuite.TestRestartAutoRemoveContainer. Looks like that test is flaky (on Windows RS1?); tracking issue: #29641

https://ci.docker.com/public/blue/rest/organizations/jenkins/pipelines/moby/branches/PR-39856/runs/2/nodes/39/log/?start=0

[2019-09-03T13:19:37.715Z] FAIL: check_test.go:86: DockerSuite.OnTimeout
[2019-09-03T13:19:37.715Z] 
[2019-09-03T13:19:37.715Z] check_test.go:93:
[2019-09-03T13:19:37.715Z]     c.Fatalf("Failed to get daemon PID from %s\n", path)
[2019-09-03T13:19:37.715Z] ... Error: Failed to get daemon PID from docker.pid
[2019-09-03T13:19:37.715Z] 
[2019-09-03T13:19:37.715Z] 
[2019-09-03T13:19:37.715Z] --- FAIL: Test (3938.00s)
[2019-09-03T13:19:37.715Z] panic: DockerSuite.TestRestartAutoRemoveContainer test timed out after 10m0s [recovered]
[2019-09-03T13:19:37.715Z] 	panic: DockerSuite.TestRestartAutoRemoveContainer test timed out after 10m0s
[2019-09-03T13:19:37.715Z] 
[2019-09-03T13:19:37.715Z] goroutine 8 [running]:
[2019-09-03T13:19:37.715Z] testing.tRunner.func1(0xc000486700)
[2019-09-03T13:19:37.715Z] 	d:/CI-2/CI-3593e7622/go/src/testing/testing.go:830 +0x399
[2019-09-03T13:19:37.715Z] panic(0x11266c0, 0xc0009e3b10)
[2019-09-03T13:19:37.715Z] 	d:/CI-2/CI-3593e7622/go/src/runtime/panic.go:522 +0x1c3
[2019-09-03T13:19:37.715Z] github.com/docker/docker/vendor/github.com/go-check/check.(*suiteRunner).runTest(0xc000740090, 0xc00075a230, 0xc0009dea50)
[2019-09-03T13:19:37.715Z] 	d:/gopath/src/github.com/docker/docker/vendor/github.com/go-check/check/check.go:875 +0x2a5
[2019-09-03T13:19:37.715Z] github.com/docker/docker/vendor/github.com/go-check/check.(*suiteRunner).run(0xc000740090, 0x1d30240)
[2019-09-03T13:19:37.715Z] 	d:/gopath/src/github.com/docker/docker/vendor/github.com/go-check/check/check.go:621 +0x105
[2019-09-03T13:19:37.715Z] github.com/docker/docker/vendor/github.com/go-check/check.Run(0x11f9a00, 0x1d30240, 0xc0002a4050, 0x1)
[2019-09-03T13:19:37.715Z] 	d:/gopath/src/github.com/docker/docker/vendor/github.com/go-check/check/run.go:100 +0x54
[2019-09-03T13:19:37.715Z] github.com/docker/docker/vendor/github.com/go-check/check.RunAll(0xc0002a4050, 0x3)
[2019-09-03T13:19:37.715Z] 	d:/gopath/src/github.com/docker/docker/vendor/github.com/go-check/check/run.go:92 +0x9d
[2019-09-03T13:19:37.715Z] github.com/docker/docker/vendor/github.com/go-check/check.TestingT(0xc000486700)
[2019-09-03T13:19:37.715Z] 	d:/gopath/src/github.com/docker/docker/vendor/github.com/go-check/check/run.go:80 +0x378
[2019-09-03T13:19:37.715Z] github.com/docker/docker/integration-cli.Test(0xc000486700)
[2019-09-03T13:19:37.715Z] 	d:/gopath/src/github.com/docker/docker/integration-cli/check_test.go:76 +0x90
[2019-09-03T13:19:37.715Z] testing.tRunner(0xc000486700, 0x126c868)
[2019-09-03T13:19:37.715Z] 	d:/CI-2/CI-3593e7622/go/src/testing/testing.go:865 +0xc7
[2019-09-03T13:19:37.715Z] created by testing.(*T).Run
[2019-09-03T13:19:37.715Z] 	d:/CI-2/CI-3593e7622/go/src/testing/testing.go:916 +0x361
[2019-09-03T13:19:37.715Z] exit status 2
[2019-09-03T13:19:37.715Z] FAIL	github.com/docker/docker/integration-cli	3938.089s

This test is ocassionally failing because we run into a Windows
sharing violation:

```
--- FAIL: TestJSONFileLoggerWithOpts (0.07s)
    jsonfilelog_test.go:187: open C:\Users\ContainerAdministrator\AppData\Local\Temp\docker-logger-344571653\container.log.1: The process cannot access the file because it is being used by another process.
```

This patch attempts to skip the test if we encounter this situation.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the conditionally_skip_TestJSONFileLoggerWithOpts branch from da86706 to 0641147 Compare September 3, 2019 16:05
@thaJeztah
Copy link
Member Author

@vikramhh updated; changed to check for an os.PathError

@vikramhh
Copy link

vikramhh commented Sep 3, 2019

Thanks @thaJeztah - LGTM

@ddebroy
Copy link
Contributor

ddebroy commented Sep 5, 2019

@ameyag - I think you had a solution for the Sharing violation issue right?

@thaJeztah
Copy link
Member Author

@ddebroy I think that patch is already here in master (it was a backport?), so perhaps there's still another issue at hand

@ddebroy
Copy link
Contributor

ddebroy commented Sep 9, 2019

This could be due to the same root cause as #39274

@andrewhsu
Copy link
Contributor

Related? golang/go#32088

@tonistiigi
Copy link
Member

Does this mean ERROR_SHARING_VIOLATION can only appear in this test or just by using log rotation? If latter and if this can be mitigated with FILE_SHARE_DELETE we could open files with go-winio with passing these files.

@thaJeztah
Copy link
Member Author

If we can address the actual issue, that would be better of course; this was my attempt at doing a quick n dirty hack to at least get CI more stable (and without fully skipping the test) while someone can work on a better solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants