misc: get rid of fiber_gc
As it breaks sane usage of region as a data stack: size_t region_svp = region_used(&fiber()->gc); /* some allocation on fiber gc and usage of allocated memory. */ region_truncate(&fiber()->gc, region_svp); If in the above snippet one calls a function that in turn calls `fiber_gc` then the snippet code may have use-after-free and later UB on truncation. For this reason let's get read of fiber_gc. However we need to make sure we won't introduce leaks this way. So before actually removing fiber_gc we make it perform leak check instead and only after fixing all the leaks the fiber_gc was removed. In order to find the leak easily the backtrace of the first fiber gc allocation that is not truncated is saved and then reported. In order to catch leaks that are not triggered by the current test suit and to prevent introducing leaks in future patches the leak check is added on fiber exit/recycle and for long living system fibers on every loop iteration. Leak check in release build is on but without leak backtrace info by default for performance reasons. Backtrace can be provided by using `fiber.leak_backtrace_enable()` knob before starting leaking fiber. Regularly leaks are only reported in log but it will not help to catch errors when running test suits so build option ABORT_ON_LEAK is added. When it is on we abort on leak. This option is turned off for all builds that used in CI. Closes #5665 NO_CHANGELOG=internal NO_DOC=internal
Showing
- .test.mk 38 additions, 14 deletions.test.mk
- CMakeLists.txt 13 additions, 0 deletionsCMakeLists.txt
- changelogs/unreleased/gh-5665-get-rid-of-fiber_gc.md 7 additions, 0 deletionschangelogs/unreleased/gh-5665-get-rid-of-fiber_gc.md
- src/box/alter.cc 7 additions, 0 deletionssrc/box/alter.cc
- src/box/applier.cc 14 additions, 16 deletionssrc/box/applier.cc
- src/box/box.cc 13 additions, 13 deletionssrc/box/box.cc
- src/box/ck_constraint.c 8 additions, 3 deletionssrc/box/ck_constraint.c
- src/box/gc.c 2 additions, 0 deletionssrc/box/gc.c
- src/box/iproto.cc 1 addition, 0 deletionssrc/box/iproto.cc
- src/box/lua/call.c 2 additions, 0 deletionssrc/box/lua/call.c
- src/box/lua/execute.c 11 additions, 4 deletionssrc/box/lua/execute.c
- src/box/lua/index.c 38 additions, 26 deletionssrc/box/lua/index.c
- src/box/lua/net_box.c 1 addition, 0 deletionssrc/box/lua/net_box.c
- src/box/memtx_engine.cc 12 additions, 23 deletionssrc/box/memtx_engine.cc
- src/box/memtx_space.c 11 additions, 1 deletionsrc/box/memtx_space.c
- src/box/raft.c 1 addition, 0 deletionssrc/box/raft.c
- src/box/recovery.cc 1 addition, 3 deletionssrc/box/recovery.cc
- src/box/relay.cc 5 additions, 1 deletionsrc/box/relay.cc
- src/box/service_engine.c 4 additions, 0 deletionssrc/box/service_engine.c
- src/box/space.c 7 additions, 4 deletionssrc/box/space.c
Loading
-
mentioned in commit e46df961
-
mentioned in commit a6469205
-
mentioned in commit a4533a99
-
mentioned in commit 63b1f9cf
-
mentioned in commit cd84e784
-
mentioned in commit acf1fc2c
-
mentioned in commit 87fad00a
-
mentioned in commit 7160549c
-
mentioned in commit 964bda76
-
mentioned in commit 4a6911bd
Please register or sign in to comment