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

[Flaky Test] metricbeat/module/system/process TestFetchDegradeOnPartial #42809

Open
AndersonQ opened this issue Feb 20, 2025 · 1 comment
Open
Assignees
Labels
flaky-test Unstable or unreliable test cases. Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Comments

@AndersonQ
Copy link
Member

Flaky Test

It seems on CI the test isn't being able to fetch any event. Perhaps it should run as admin to have more permission or try more times. Run it on a requere.Eventually to ensure at least a event is fetched.

The panic is a bug in the test, it does not check if there is any event before accessing it:
https://github.com/AndersonQ/beats/blob/7a2f8d45744922c25d372482824641b3bde3790b/metricbeat/module/system/process/process_test.go#L80-L81

Stack Trace

2025-02-20 17:01:21 CEST	=== Failed
2025-02-20 17:01:21 CEST	=== FAIL: metricbeat/module/system/process TestFetchDegradeOnPartial (0.13s)
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.764Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 0: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 0: The parameter is incorrect. {0xc000404000}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.764Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 4: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 4: Access is denied. {0xc0004041c0}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.764Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 120: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 120: Access is denied. {0xc000404240}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.764Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 376: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 376: Access is denied. {0xc0004042a0}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.764Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 520: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 520: Access is denied. {0xc000404340}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.764Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 592: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 592: Access is denied. {0xc0004043a0}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.765Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 600: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 600: Access is denied. {0xc000404400}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.766Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 732: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 732: Access is denied. {0xc000404460}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.781Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 3244: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 3244: Access is denied. {0xc0004044e0}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.785Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 5236: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 5236: Access is denied. {0xc000404560}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.801Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 0: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 0: The parameter is incorrect. {0xc0004050e0}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.801Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 4: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 4: Access is denied. {0xc000405180}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.801Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 120: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 120: Access is denied. {0xc0004051e0}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.804Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 376: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 376: Access is denied. {0xc000405240}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.804Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 520: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 520: Access is denied. {0xc0004052a0}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.807Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 592: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 592: Access is denied. {0xc000405300}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.808Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 600: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 600: Access is denied. {0xc000405360}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.809Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 732: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 732: Access is denied. {0xc0004053c0}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.846Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 3244: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 3244: Access is denied. {0xc000405440}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.852Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidFill","file.name":"process/process.go","file.line":301},"message":"error calling FillMetricsRequiringMoreAccess for pid 5236: %!w(*fmt.wrapError=&{error fetching process args: non fatal error; reporting partial metrics: OpenProcess failed for PID 5236: Access is denied. {0xc0004054c0}})","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.877Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).pidIter","file.name":"process/process.go","file.line":212},"message":"Error fetching PID info for 5764, skipping: GetInfoForPid failed for pid 5764: could not get all information for PID 5764: error fetching name: OpenProcess failed for pid=5764: The parameter is incorrect.\nerror fetching status: OpenProcess failed for pid=5764: The parameter is incorrect.","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	{"log.level":"debug","@timestamp":"2025-02-20T16:01:01.877Z","log.logger":"processes","log.origin":{"function":"github.com/elastic/elastic-agent-system-metrics/metric/system/process.(*Stats).Get","file.name":"process/process.go","file.line":144},"message":"error fetching process metrics: non fatal error; reporting partial metrics: GetInfoForPid failed for pid 5764: could not get all information for PID 5764: error fetching name: OpenProcess failed for pid=5764: The parameter is incorrect.\nerror fetching status: OpenProcess failed for pid=5764: The parameter is incorrect.","ecs.version":"1.6.0"}
2025-02-20 17:01:21 CEST	    process_test.go:77:
2025-02-20 17:01:21 CEST	        	Error Trace:	C:/buildkite-agent/builds/bk-agent-prod-gcp-1740066775103615090/elastic/beats-metricbeat/metricbeat/module/system/process/process_test.go:77
2025-02-20 17:01:21 CEST	        	Error:      	Should NOT be empty, but was []
2025-02-20 17:01:21 CEST	        	Test:       	TestFetchDegradeOnPartial
2025-02-20 17:01:21 CEST	    process_test.go:79: fetched 0 events, showing events[0]:
2025-02-20 17:01:21 CEST	panic: runtime error: index out of range [0] with length 0 [recovered]
2025-02-20 17:01:21 CEST		panic: runtime error: index out of range [0] with length 0
2025-02-20 17:01:21 CEST	
2025-02-20 17:01:21 CEST	goroutine 52 [running]:
2025-02-20 17:01:21 CEST	testing.tRunner.func1.2({0x1ae8f40, 0xc0000f22d0})
2025-02-20 17:01:21 CEST		C:/Users/Buildkite/.go/go-1.22.12/src/testing/testing.go:1631 +0x24a
2025-02-20 17:01:21 CEST	testing.tRunner.func1()
2025-02-20 17:01:21 CEST		C:/Users/Buildkite/.go/go-1.22.12/src/testing/testing.go:1634 +0x377
2025-02-20 17:01:21 CEST	panic({0x1ae8f40?, 0xc0000f22d0?})
2025-02-20 17:01:21 CEST		C:/Users/Buildkite/.go/go-1.22.12/src/runtime/panic.go:770 +0x132
2025-02-20 17:01:21 CEST	github.com/elastic/beats/v7/metricbeat/module/system/process.TestFetchDegradeOnPartial(0xc00012a1a0)
2025-02-20 17:01:21 CEST		C:/buildkite-agent/builds/bk-agent-prod-gcp-1740066775103615090/elastic/beats-metricbeat/metricbeat/module/system/process/process_test.go:81 +0x772
2025-02-20 17:01:21 CEST	testing.tRunner(0xc00012a1a0, 0x1be0428)
2025-02-20 17:01:21 CEST		C:/Users/Buildkite/.go/go-1.22.12/src/testing/testing.go:1689 +0xfb
2025-02-20 17:01:21 CEST	created by testing.(*T).Run in goroutine 1
2025-02-20 17:01:21 CEST		C:/Users/Buildkite/.go/go-1.22.12/src/testing/testing.go:1742 +0x390
2025-02-20 17:01:21 CEST	
2025-02-20 17:01:21 CEST	DONE 945 tests, 39 skipped, 1 failure in 147.088s
2025-02-20 17:01:21 CEST	Error: failed to execute go: exit status 1
@AndersonQ AndersonQ added flaky-test Unstable or unreliable test cases. Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Feb 20, 2025
@AndersonQ AndersonQ self-assigned this Feb 20, 2025
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flaky-test Unstable or unreliable test cases. Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

No branches or pull requests

2 participants