-
Notifications
You must be signed in to change notification settings - Fork 139
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
Leaking goroutine found because of init() dbus call #135
Comments
Hey @crobert-1, looks like this is related to #103, there's a bunch of linked issues that make the same conclusion as you but there doesn't appear to be an intent to fix this from the maintainers (or any communication at all). It's extremely unfortunate that this bug is within an init function as it means any dependency that pulls this package in will introduce this leak, and it's everywhere. We've had this package sneak into our builds from two different dependencies over the years, more context on our own investigation and (kind of) fix: redpanda-data/connect#1184. I ended up using a replace directive with a modified version of the keyring package. This only works because we're not actually using this package for anything, and it means anyone using your own package as a library will need to also add the replace directive unless they're okay with the leaks. Very yucky. |
Thanks for the reference @Jeffail, appreciate it! This is a pretty indirect reference in my usage and I actually also found an issue against the package that directly depends on this, so I've filed a frequency there as well 👍 |
Closing as duplicate of #103 |
Context
Hello, I'm currently working on adding
goleak
to tests to ensure no goroutines are leaking.Bug
goleak
returned the following stack trace:After investigation I found that this is caused by the following line:
keyring/kwallet.go
Line 24 in 929f178
dbus.SessionBus()
creates a goroutine in the background when called. Since this is called withininit
, this goroutine is started whether or not the 99designs/keyring repository is used.Solution
It would be best to only call the aforementioned method when required, outside of init. Also, a public API for closing the session should be available for consumers on shutdown.
The text was updated successfully, but these errors were encountered: