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

Feature Request: Provide a Close() callback to clean up plugin's own resources #109

Open
raptium opened this issue May 4, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@raptium
Copy link

raptium commented May 4, 2022

Currently new plugin instances are be created upon config changes and old plugin instances are removed from instances slice so they are inaccessible and left to be garbage collected eventually. A plugin instance has no way to sense if it will not used anymore. This works fine until we have a plugin with background goroutines: our plugin starts several goroutines on start and we need them to run until the plugin instance is closed. The catch here is that we do not know if the plugin is closed, and we have no way to stop the goroutines. These goroutines hold reference to the plugin instance so nothing will be GCed.

My request is to provide a Close callback so that the plugin instance can have a chance to clean up its own resources to prevent problems like goroutine leaks.

I can imagine that this would not be easy to implement, since the plugin instance would have to be closed after all its related events have been handled.

@gszr gszr added the enhancement New feature or request label Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants