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

Incorrect use of fsnotify in configtls #8438

Closed
haoqixu opened this issue Sep 13, 2023 · 0 comments · Fixed by #8439
Closed

Incorrect use of fsnotify in configtls #8438

haoqixu opened this issue Sep 13, 2023 · 0 comments · Fixed by #8439
Labels
bug Something isn't working

Comments

@haoqixu
Copy link
Member

haoqixu commented Sep 13, 2023

Describe the bug
When working on #8395, I observed another testing failure:

=== RUN   TestErrorRecordedIfFileDeleted
Event: fsnotify.Event{Name:"/var/folders/9l/f2cn0_n52w38y4m77wms60gc0000gn/T/clientCAs.crt1808838314", Op:0x12}    clientcasfilereloader_test.go:65:
        	Error Trace:	/Users/haoqixu/code/personal/wip/otel/opentelemetry-collector/config/configtls/clientcasfilereloader_test.go:65
        	Error:      	Condition never satisfied
        	Test:       	TestErrorRecordedIfFileDeleted
    clientcasfilereloader_test.go:70:
        	Error Trace:	/Users/haoqixu/code/personal/wip/otel/opentelemetry-collector/config/configtls/clientcasfilereloader_test.go:70
        	Error:      	Not equal:
        	            	expected: "test error on reload"
        	            	actual  : "<nil>"

        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-test error on reload
        	            	+<nil>
        	Test:       	TestErrorRecordedIfFileDeleted
--- FAIL: TestErrorRecordedIfFileDeleted (5.00s)

Steps to reproduce
Run go test -v -run TestErrorRecordedIfFileDeleted -race -count 1000 . under config/configtls.

Environment
OS: macOS 13.2.1
Compiler(if manually compiled): go1.20.3

Additional context

The Op field of fsnotify.Event is a bitmask and some systems may send multiple operations at once. We should use the Event.Has() method instead of comparing with ==.

The failure above was caused by an multiple operations event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant