-
Notifications
You must be signed in to change notification settings - Fork 12
fix: fix wasm middleware guest module instance memory leak issue #86
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
Conversation
0ef7f5d to
04fd875
Compare
|
imports style fixed, please approve CI actions |
|
Thanks for this @ttys3, any chance you can port the benchmarks into this PR? |
I have all things to reproduce and verify the leak issue and the PR fixed the issue in the repo: https://github.com/ttys3/traefik-wasm-plugin-memory-leak-demo/ but I do not know how to port them to this. any advice ? @jcchavezs |
|
I think the main issue comes from traefik/traefik#11119 (comment) |
I think it's just the opposite; that leak is secondary. The main leak is addressed in this PR. They are two different types of leaks. Although they have similar symptoms, they are not the same issue. |
… thus memory leak
…OT set on it, has problem)
4faa707 to
b074ca8
Compare
fixup guest module instance creation without guest module free caused memory leak
related issue: traefik/traefik#11119
related PR: traefik#2
cc @juliens
since this implementation make usage of
sync.Poolwe must call
Close()method of the module when the sync.Pool object got GC ed.without call
Close()to releases resources allocated for this Module, the memory will leakrelated PR
see also traefik/traefik#11151 which fixup the wasm plugin memory leak when dynamic config loading ( which cause all related route middleware recreation), we have to call
nethttp.middleware.Close()(which will callhandler.middleware.Close()->wazero.Runtime.Close()) to free the memory