-
-
Notifications
You must be signed in to change notification settings - Fork 500
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
all: fix goroutine leaks #1358
all: fix goroutine leaks #1358
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
e10a9d7
to
3febcdc
Compare
Fixed golangci-lint "Error return value of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few minor comments, will postpone the final review until we discuss them.
Other than that, LGTM. Thanks for your dedication!
74f21a9
to
b5b70e3
Compare
There is another tricky case besides #1357 - reused containers. testcontainers-go/parallel_test.go Lines 163 to 169 in 5011016
Closing all containers produces error as there is only one real container. In the TestGenericReusableContainer reused container also can not be closed but even if we remove reaper it still calls Exec: testcontainers-go/generic_test.go Lines 90 to 94 in 5011016
which creates an idle connection in the client and the problem is that reused containers have their own provider: Lines 125 to 138 in 5011016
Lines 1139 to 1149 in 5011016
|
Fixes various goroutine leaks by moving around and adding missing Close calls. Leaks were detected by github.com/AlexanderYastrebov/noleak by adding ```go // go get github.com/AlexanderYastrebov/noleak@latest // cat main_test.go package testcontainers import ( "os" "testing" "github.com/AlexanderYastrebov/noleak" ) func TestMain(m *testing.M) { os.Exit(noleak.CheckMain(m)) } ``` Not all leaks could be fixed e.g. due to testcontainers#1357 therefore this change does not add leak detector, only fixes. Updates testcontainers#321
b5b70e3
to
2b055df
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for your patience while reviewing the PR.
As you seem very proficient with goroutines, would you participate in an eventual redesign for a revamp of the current Docker client infrastructure, in a v1 branch?
* main: chore(deps): bump github.com/aws dependencies in /modules/localstack (testcontainers#1472) chore(deps): bump Google emulators dependencies in /examples (testcontainers#1471) all: fix goroutine leaks (testcontainers#1358) chore(deps): bump github.com/neo4j/neo4j-go-driver/v5 in /modules/neo4j (testcontainers#1427)
@mdelapenya Thank you.
Just tag me and I'll think whether I could contribute anything meaningful. |
* main: (29 commits) Add support for MongoDB testing module (testcontainers#1447) Support groups in dependabot updates (testcontainers#1459) chore: run modulegen tests on Windows (testcontainers#1478) Add default labels when Ryuk is disabled (testcontainers#1339) feat: add clickhouse module (testcontainers#1372) chore: increase timeout for go test and GH action steps (testcontainers#1475) chore: triple max timeout for the workflow run, which takes +10m (testcontainers#1474) chore(deps): bump github.com/aws dependencies in /modules/localstack (testcontainers#1472) chore(deps): bump Google emulators dependencies in /examples (testcontainers#1471) all: fix goroutine leaks (testcontainers#1358) chore(deps): bump github.com/neo4j/neo4j-go-driver/v5 in /modules/neo4j (testcontainers#1427) chore(deps): bump github.com/tidwall/gjson from 1.14.4 to 1.15.0 in /modules/vault (testcontainers#1428) chore: add a GH action for release drafter (testcontainers#1470) chore(deps): bump mkdocs-material from 3.2.0 to 8.2.7 (testcontainers#1468) Add global testcontainers header to docs (testcontainers#1308) Simplify dependabot updates sorting (testcontainers#1460) feat: use credential helper in docker config, even if auth is empty in .docker/config.json (testcontainers#1079) chore(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 (testcontainers#1457) Revert "chore: run Windows tests on a Linux container (testcontainers#1456)" chore: run Windows tests on a Linux container (testcontainers#1456) ...
Fixes various goroutine leaks by moving around and adding missing Close calls.
Leaks were detected by https://github.com/AlexanderYastrebov/noleak by adding
Not all leaks could be fixed e.g. due to #1357 therefore this change does not add leak detector, only fixes.
Updates #321
What does this PR do?
Why is it important?
Related issues