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

Enable and enforce goroutine leak checks in tests #5006

Closed
4 tasks done
yurishkuro opened this issue Dec 14, 2023 · 23 comments · Fixed by #5010
Closed
4 tasks done

Enable and enforce goroutine leak checks in tests #5006

yurishkuro opened this issue Dec 14, 2023 · 23 comments · Fixed by #5010
Labels
good first issue Good for beginners help wanted Features that maintainers are willing to accept but do not have cycles to implement

Comments

@yurishkuro
Copy link
Member

yurishkuro commented Dec 14, 2023

Enforce the use of https://github.com/uber-go/goleak across the repo:

  • a linter similar to scripts/check-test-files.sh that verifies that all packages with tests have goleak in TestMain
  • add goleak to all packages via TestMain. Some packages may pass the validation, some may fail and would need to be fixed. It's best to break this into several PRs, first to add goleak to packages that do not fail, and then potentially separate PRs for each package where goleak does fail with the corresponding fixes to the tests.
  • Fix leaks in the integration tests (see Add go leak checks to ES/OS tests #6339)
  • Change linter script to fail CI on errors going forward

State on March 8 2024:

$ make goleak
Verifying that all packages with tests have goleak in their TestMain
🔴 Error(check-goleak): no goleak check in package ./cmd/collector/app/
🔴 Error(check-goleak): no goleak check in package ./cmd/internal/printconfig/
🔴 Error(check-goleak): no goleak check in package ./cmd/query/app/
🔴 Error(check-goleak): no goleak check in package ./pkg/cassandra/gocql/testutils/
🔴 Error(check-goleak): no goleak check in package ./pkg/testutils/
🔴 Error(check-goleak): no goleak check in package ./plugin/metrics/prometheus/metricsstore/
🔴 Error(check-goleak): no goleak check in package ./plugin/sampling/strategystore/adaptive/
🔴 Error(check-goleak): no goleak check in package ./plugin/storage/integration/
Error(check-goleak): no goleak check in 8 package(s).
@yurishkuro yurishkuro added help wanted Features that maintainers are willing to accept but do not have cycles to implement good first issue Good for beginners labels Dec 14, 2023
@Freedisch
Copy link

@yurishkuro, I will look into this

@akagami-harsh
Copy link
Member

@yurishkuro, i would also like to work on this, if @Freedisch dosen't mind

yurishkuro added a commit that referenced this issue Dec 18, 2023
## Which problem is this PR solving?
- Partially Fixes #5006 

## Description of the changes
- added a linter to check implementation of goleak in tests
- added go leak in some tests 

## How was this change tested?
- 

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [ ] I have added unit tests for the new functionality
- [ ] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Harshvir Potpose <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
@yurishkuro yurishkuro reopened this Dec 18, 2023
yurishkuro added a commit that referenced this issue Dec 19, 2023
## Which problem is this PR solving?
- Part of #5006

## Description of the changes
- Add goleak checks to all packages with empty_test.go as well as
./storage/... (which mostly contains APIs)

## How was this change tested?
- CI

Signed-off-by: Yuri Shkuro <[email protected]>
yurishkuro added a commit that referenced this issue Dec 21, 2023
## Which problem is this PR solving?
- part of #5006 

## Description of the changes
- added goleak checks to all tests that do not fail
- minor bug fix in `check-goleak-file.sh`
- `make goleak` was listing directories that do not contain any test,
added a `if` condition to prevent that

## How was this change tested?
- `make test`

---------

Signed-off-by: Harshvir Potpose <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
@yurishkuro
Copy link
Member Author

Latest: 33 packages remaining

Error(check-goleak): no goleak check in 33 package(s).

yurishkuro added a commit that referenced this issue Dec 22, 2023
## Which problem is this PR solving?
- Part of #5006

## Description of the changes
- Fix goroutine leaks in several packages

## How was this change tested?
- go test

---------

Signed-off-by: Yuri Shkuro <[email protected]>
yurishkuro pushed a commit that referenced this issue Dec 25, 2023
## Which problem is this PR solving?
- part of #5006 

## Description of the changes
- fix goroutine leaks in some package and add goleak check

## How was this change tested?
- go test

---------

Signed-off-by: Harshvir Potpose <[email protected]>
@Pushkarm029
Copy link
Member

working on /cmd/collector/app/zipkin/

@limistah
Copy link
Contributor

I have implemented this into the package folders in this PR

yurishkuro pushed a commit that referenced this issue Dec 30, 2023
## Which problem is this PR solving?
- fix gorourine leak in some packages 

## Description of the changes
- part of #5006 

## How was this change tested?
- go test

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`

---------

Signed-off-by: Harshvir Potpose <[email protected]>
yurishkuro added a commit that referenced this issue Jan 2, 2024
…lder (#5055)

## Which problem is this PR solving?
- Part of #5006 

## Description of the changes
- Added TestMain to package folders
- Added make goleak into unit test ci

## How was this change tested?
- please run make goleak 

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Aleem Isiaka <[email protected]>
Signed-off-by: Aleem Isiaka <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
yurishkuro pushed a commit that referenced this issue Jan 3, 2024
## Which problem is this PR solving?
- part of #5006 

## Description of the changes
- fixed goroutine leaks in `cmd/agent/app/reporter/grpc` and also added
a goleak check

## How was this change tested?
- go test

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`

---------

Signed-off-by: Harshvir Potpose <[email protected]>
@WillSewell
Copy link
Contributor

WillSewell commented Mar 29, 2024

I had a look into ./plugin/sampling/strategystore/adaptive/. One challenge is the high default Processor.followerRefreshInterval (20s) which causes the runUpdateProbabilitiesLoop to hang long enough that either Close() needs to block a long time, or the test times out. In processor_test.go the default value can be overridden before Processor.Start is called. However in factory_test.go this is not currently possible because the Factory wraps both the initialising and starting of the Processor in the CreateStrategyStore method.

I think there's a couple of options:

  1. Add the followerRefreshInterval field to the Factory which could be set in the test code, and then this could be set on the Processor in the CreateStrategyStore method.
  2. Expose --sampling.follower-refresh-interval as an option

For now I'll go for 1. but I thought I'd see whether there is any appetite for 2. because it would have the side benefit of making the test code a bit cleaner.

@WillSewell
Copy link
Contributor

Solved in a different way: dfe7adc

yurishkuro pushed a commit that referenced this issue Mar 29, 2024
## Which problem is this PR solving?
- Solves part of #5006

## Description of the changes
- This mainly involved ensuring that all goroutines started by the
Processor are shut down in a Close method (which also blocks on them
returning via a WaitGroup).
- Adding this flagged an issue where the `runUpdateProbabilitiesLoop`
had a long delay, so tests need to be able to override the default
Processor.followerRefreshInterval, or `Close` would take up to ~20s to
return. More context on this here
#5006 (comment)
- specifically regarding how to override this in the `Factory`.
- I also needed to fix a deadlock where a test was not unlocking a lock
which would allow the Close method to return:
https://github.com/jaegertracing/jaeger/pull/5310/files#diff-c9d6c33e36122502911585c65618d1af863079a70a68543adcc0ae2798faa348R468

## How was this change tested?
- `make test lint`

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [ ] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Will Sewell <[email protected]>
yurishkuro added a commit that referenced this issue Mar 31, 2024
## Which problem is this PR solving?
- The testutils package itself was being flagged as missing goleak
check. The check was there, but without the package name, and the lint
script was flagging it as false positive.
- Similar issue in `pkg/cassandra/gocql/testutils`
- Part of #5006

## Description of the changes
1. Change package name of the test file so that the functions can be
called with the usual package package name `testutils`.
2. change competing `testutils` import labels to satisfy the linter

## How was this change tested?
- `make goleak` no longer shows this package

---------

Signed-off-by: Yuri Shkuro <[email protected]>
jkowall pushed a commit that referenced this issue Apr 1, 2024
## Which problem is this PR solving?
- Part of #5006
- We have only two packages remaining without goroutine leak checks,
both integration tests, which are being worked on
- Meanwhile new code / packages do not benefit from enforcement of
goleak checks because the linter does not fail CI

## Description of the changes
- Add the two remaining packages into exclusion list and force a failure
of the CI if anything else is missing goleak checks

## How was this change tested?
Successful exit:
```shell
$ make goleak
Verifying that all packages with tests have goleak in their TestMain
🔴 Error(check-goleak): no goleak check in package ./cmd/jaeger/internal/integration/
	this package is temporarily allowed and will not cause linter failure
🔴 Error(check-goleak): no goleak check in package ./plugin/storage/integration/
	this package is temporarily allowed and will not cause linter failure
🐞 Warning(check-goleak): no goleak check in 2 package(s).
	See https://github.com/jaegertracing/jaeger/pull/5010/files
	for examples of adding the checks.
```

Unsuccessful exit (forced by removing one of the existing checks):
```shell
$ make goleak
Verifying that all packages with tests have goleak in their TestMain
🔴 Error(check-goleak): no goleak check in package ./cmd/jaeger/internal/integration/
	this package is temporarily allowed and will not cause linter failure
🔴 Error(check-goleak): no goleak check in package ./internal/tracegen/
🔴 Error(check-goleak): no goleak check in package ./plugin/storage/integration/
	this package is temporarily allowed and will not cause linter failure
⛔ Fatal(check-goleak): no goleak check in 3 package(s), 1 of which not allowed.
	See https://github.com/jaegertracing/jaeger/pull/5010/files
	for examples of adding the checks.
make: *** [goleak] Error 1
```

Signed-off-by: Yuri Shkuro <[email protected]>
yurishkuro pushed a commit that referenced this issue Apr 8, 2024
…st.go (#5311)

## Which problem is this PR solving?
- Solves part of #5006

## Description of the changes
- Fixes goroutine leaks in the shutdown of cassandra Factory
- It does not add the goleak detection because there are still failures
in this package related to other components (e.g. grpc, elasticsearch)

## How was this change tested?
- Add a goleak detection (i.e. this file
105a4d7)
- `STORAGE=cassandra go test -v  ./plugin/storage/integration`

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [ ] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Will Sewell <[email protected]>
yurishkuro added a commit that referenced this issue Apr 11, 2024
## Which problem is this PR solving?
- Solves part of #5006

## Description of the changes
- The key issue was that the grpc client was only being killed in a
`runtime.SetFinalizer` - i.e. when it is GCed. I think in the tests this
was not shutting down before goleak had decided that the goroutine had
leaked.
- This change switches to a more conventional approach of killing the
client as part of the Close method and then ensuring this is called in
each of the tests.

## How was this change tested?
- While this change does not include a call to activate goleak, it _was_
tested with this. The PR does not include goleak detection because there
are still other violations related to elasticsearch in this package.

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [ ] I have added unit tests for the new functionality
- [ ] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Will Sewell <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
varshith257 pushed a commit to varshith257/jaeger that referenced this issue May 3, 2024
## Which problem is this PR solving?
- Solves part of jaegertracing#5006

## Description of the changes
- The key issue was that the grpc client was only being killed in a
`runtime.SetFinalizer` - i.e. when it is GCed. I think in the tests this
was not shutting down before goleak had decided that the goroutine had
leaked.
- This change switches to a more conventional approach of killing the
client as part of the Close method and then ensuring this is called in
each of the tests.

## How was this change tested?
- While this change does not include a call to activate goleak, it _was_
tested with this. The PR does not include goleak detection because there
are still other violations related to elasticsearch in this package.

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [ ] I have added unit tests for the new functionality
- [ ] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Will Sewell <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
Signed-off-by: Vamshi Maskuri <[email protected]>
@inosmeet inosmeet mentioned this issue Oct 20, 2024
4 tasks
@Manik2708
Copy link
Contributor

#5468 (comment) I started with this like by adding adding goleak in a single test. From there I got errors and by reffering to this I got to know that we have to use a seperate grpc clients for each test instead of using as a single (initialized in the e2eInitialize), then I placed the TestMain for checking all go leaks and got the tests passed for cassandra. @yurishkuro What should be the correct way? Should we be bothered for failing tests when checked seperately or way encorprated in #5468 is correct?

@yurishkuro
Copy link
Member Author

yurishkuro commented Dec 8, 2024

@Manik2708 if you are able to get clean run by adding goleak check into individual tests, feel free to create PRs for those - it will narrow down the scope of remaining work (once the whole package is clean it's easy to remove those in favor of a package-level check, although we may just want to keep them per-test too, as a debugging tool).

I will need more information about what specific problem you found. I don't believe it should matter if some gRPC clients are alive for the duration of the overall test vs. individual tests as long as they are closed at the end of the parent test.

@Manik2708
Copy link
Contributor

Manik2708 commented Dec 8, 2024

This was the error which I got when I used goleak.VerifyNone(t) in a test of getOperations for Cassandra. This error was not present when goleak was ran for the whole package. The gRPC error is same as described in my above comment.

    integration.go:357: 2024-12-08 22:24:42.04  Writing trace with 5 spans
    integration.go:261: Retrieved operations: [{example-operation-1 unspecified} {example-operation-3 server} {example-operation-4 client}]
    e2e_integration.go:270: Purging storage via http://0.0.0.0:9231/purge
    integration.go:269: found unexpected goroutines:
        [Goroutine 52 in state select, with google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run on top of the stack:
        google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run(0xc000216c20, {0x2b146e8, 0xc0004fe230})
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/grpcsync/callback_serializer.go:88 +0x1eb
        created by google.golang.org/grpc/internal/grpcsync.NewCallbackSerializer in goroutine 22
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/grpcsync/callback_serializer.go:52 +0x207
         Goroutine 53 in state select, with google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run on top of the stack:
        google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run(0xc000216c50, {0x2b146e8, 0xc0004fe280})
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/grpcsync/callback_serializer.go:88 +0x1eb
        created by google.golang.org/grpc/internal/grpcsync.NewCallbackSerializer in goroutine 22
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/grpcsync/callback_serializer.go:52 +0x207
         Goroutine 50 in state IO wait, with internal/poll.runtime_pollWait on top of the stack:
        internal/poll.runtime_pollWait(0x740c6f938df0, 0x72)
        	/usr/local/go/src/runtime/netpoll.go:351 +0x85
        internal/poll.(*pollDesc).wait(0xc0004c9020, 0x72, 0x0)
        	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0xb1
        internal/poll.(*pollDesc).waitRead(...)
        	/usr/local/go/src/internal/poll/fd_poll_runtime.go:89
        internal/poll.(*FD).Read(0xc0004c9000, {0xc00032f000, 0x1000, 0x1000})
        	/usr/local/go/src/internal/poll/fd_unix.go:165 +0x466
        net.(*netFD).Read(0xc0004c9000, {0xc00032f000, 0x1000, 0x1000})
        	/usr/local/go/src/net/fd_posix.go:55 +0x4b
        net.(*conn).Read(0xc0004f6050, {0xc00032f000, 0x1000, 0x1000})
        	/usr/local/go/src/net/net.go:189 +0xad
        net/http.(*persistConn).Read(0xc0005807e0, {0xc00032f000, 0x1000, 0x1000})
        	/usr/local/go/src/net/http/transport.go:2052 +0xf9
        bufio.(*Reader).fill(0xc0004f2120)
        	/usr/local/go/src/bufio/bufio.go:110 +0x29a
        bufio.(*Reader).Peek(0xc0004f2120, 0x1)
        	/usr/local/go/src/bufio/bufio.go:148 +0xc5
        net/http.(*persistConn).readLoop(0xc0005807e0)
        	/usr/local/go/src/net/http/transport.go:2205 +0x354
        created by net/http.(*Transport).dialConn in goroutine 24
        	/usr/local/go/src/net/http/transport.go:1874 +0x29b4
         Goroutine 51 in state select, with net/http.(*persistConn).writeLoop on top of the stack:
        net/http.(*persistConn).writeLoop(0xc0005807e0)
        	/usr/local/go/src/net/http/transport.go:2519 +0x1c5
        created by net/http.(*Transport).dialConn in goroutine 24
        	/usr/local/go/src/net/http/transport.go:1875 +0x2a3f
         Goroutine 54 in state select, with google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run on top of the stack:
        google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run(0xc000216c80, {0x2b146e8, 0xc0004fe2d0})
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/grpcsync/callback_serializer.go:88 +0x1eb
        created by google.golang.org/grpc/internal/grpcsync.NewCallbackSerializer in goroutine 22
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/grpcsync/callback_serializer.go:52 +0x207
         Goroutine 58 in state select, with google.golang.org/grpc/internal/resolver/dns.(*dnsResolver).watcher on top of the stack:
        google.golang.org/grpc/internal/resolver/dns.(*dnsResolver).watcher(0xc00011e000)
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/resolver/dns/dns_resolver.go:220 +0x3ee
        created by google.golang.org/grpc/internal/resolver/dns.(*dnsBuilder).Build in goroutine 7
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/resolver/dns/dns_resolver.go:149 +0x645
         Goroutine 6 in state select, with google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run on top of the stack:
        google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run(0xc00025a380, {0x2b146e8, 0xc0001a43c0})
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/grpcsync/callback_serializer.go:88 +0x1eb
        created by google.golang.org/grpc/internal/grpcsync.NewCallbackSerializer in goroutine 22
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/grpcsync/callback_serializer.go:52 +0x207
         Goroutine 7 in state select, with google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run on top of the stack:
        google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run(0xc00025a3b0, {0x2b146e8, 0xc0001a4410})
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/grpcsync/callback_serializer.go:88 +0x1eb
        created by google.golang.org/grpc/internal/grpcsync.NewCallbackSerializer in goroutine 22
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/grpcsync/callback_serializer.go:52 +0x207
         Goroutine 8 in state select, with google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run on top of the stack:
        google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run(0xc00025a3e0, {0x2b146e8, 0xc0001a4460})
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/grpcsync/callback_serializer.go:88 +0x1eb
        created by google.golang.org/grpc/internal/grpcsync.NewCallbackSerializer in goroutine 22
        	/home/manik/go/pkg/mod/google.golang.org/[email protected]/internal/grpcsync/callback_serializer.go:52 +0x207
         Goroutine 56 in state IO wait, with internal/poll.runtime_pollWait on top of the stack:
        internal/poll.runtime_pollWait(0x740c6f938cd8, 0x72)
        	/usr/local/go/src/runtime/netpoll.go:351 +0x85
        internal/poll.(*pollDesc).wait(0xc0004c91a0, 0x72, 0x0)
        	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0xb1


@yurishkuro
Copy link
Member Author

@Manik2708 first, you mentioned that adding goleak.VerifyNone(t) to some test did not result in an issue - can you create PRs for those?

second, are you talking about v1 or v2 integration tests? For v1 there should be no gRPC in the picture. If you are talking about v2, then again gRPC there is not specific to Cassandra, but to the overall test setup, so I would expect the same issue to occur for another storage backend that might be easier to run locally than the one with Cassandra.

Lastly, I think I would be only putting goleak.VerifyNone(t) to the top-level tests, not individual sub-tests.

@yurishkuro
Copy link
Member Author

looking at the dump output, it mentions e2e_integration.go, which is v2 tests. But we already have package-level testutils.VerifyGoLeaks(m) there, so I am not sure how you are getting this failure.

@Manik2708
Copy link
Contributor

@Manik2708 first, you mentioned that adding goleak.VerifyNone(t) to some test did not result in an issue - can you create PRs for those?

second, are you talking about v1 or v2 integration tests? For v1 there should be no gRPC in the picture. If you are talking about v2, then again gRPC there is not specific to Cassandra, but to the overall test setup, so I would expect the same issue to occur for another storage backend that might be easier to run locally than the one with Cassandra.

Lastly, I think I would be only putting goleak.VerifyNone(t) to the top-level tests, not individual sub-tests.

I think there is some mis-understanding! I said that tests are not passing for individual tests but they are passing for package. Yes, this output is for v2. But thanks for the clarification as I was putting the goleak test in individual test not in top level test. I think now these errors are justified.

@yurishkuro
Copy link
Member Author

I don't think we need anything extra for v2 tests since we already have package-level check. The last package missing checks is plugin/storage/integration (which is also used by v2 e2e tests, so a bit puzzling why it fails)

yurishkuro added a commit that referenced this issue Dec 11, 2024
## Which problem is this PR solving?
Fixes a part of #5006 
## Description of the changes
1) Cassandra factory is closed in the test manually after the test, not
doing so will fail the leak test probably due to CleanUp function is not
closing factory properly and returning in the test leading to end it
that further fails the leak test.
2) Kafka Producer and Consumer was not closed before leading to failure
of leak test which is fixed in this PR.

## How was this change tested?
- By running integartion tests manually

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Manik2708 <[email protected]>
Signed-off-by: Manik Mehta <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
yurishkuro pushed a commit that referenced this issue Dec 12, 2024
## Which problem is this PR solving?
Fixes a part of #5006 

## Description of the changes
- Added go leak check for badgerstore, grpc and Memstore

## How was this change tested?
- Integration Tests

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: Manik2708 <[email protected]>
yurishkuro pushed a commit that referenced this issue Dec 18, 2024
## Which problem is this PR solving?
- Fixes a part of #5006 

## Description of the changes
- This is a better version of `elasticsearch_test` reducing the number
of leaks from 50 to less than 10. Unfortunately we can't fix all the
leakages because there is no way to close the v8 client of ES leading to
some unclosed http transports. If the changes looks good then we can
merge without embedding `goleak` (as it will lead to failure of test)

## How was this change tested?
- By running the integration tests

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [ ] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Manik2708 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for beginners help wanted Features that maintainers are willing to accept but do not have cycles to implement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants