fiber: fix leak on dead joinable fiber search
When fiber is accessed from Lua we create a userdata object and keep the reference for future accesses. The reference is cleared when fiber is stopped. But if fiber is joinable is still can be found with `fiber.find`. In this case we create userdata object again. Unfortunately as fiber is already stopped we fail to clear the reference. The trigger memory that clear the reference is also leaked. As well as fiber storage if it is accessed after fiber is stopped. Let's add `on_destroy` trigger to fiber and clear the references there. Note that with current set of LSAN suppressions the trigger memory leak of the issue is not reported. Closes #10187 NO_DOC=bugfix (cherry picked from commit 7db4de75)
Showing
- changelogs/unreleased/gh-10187-fix-memleaks-on-dead-fiber-usage.md 3 additions, 0 deletions...s/unreleased/gh-10187-fix-memleaks-on-dead-fiber-usage.md
- src/lib/core/fiber.c 7 additions, 0 deletionssrc/lib/core/fiber.c
- src/lib/core/fiber.h 2 additions, 0 deletionssrc/lib/core/fiber.h
- src/lua/fiber.c 28 additions, 15 deletionssrc/lua/fiber.c
- test/app-luatest/fiber_test.lua 24 additions, 0 deletionstest/app-luatest/fiber_test.lua
Loading
Please register or sign in to comment