Skip to content

fix(cbus): fix segfault for unbounded channels when receiver drop'd before...

Konstantin D requested to merge fix/cbus-segv2 into master

Fix segfault for unbounded channels when receiver drop'd before sender. In this case fiber::Cond may be drop'd in non-tarantool (not cord) thread which leads to segfault in tarantool slab allocator free function. For oneshot thereis no need to fix, cause in oneshot channel Cond always freed in tx.

First version of this fix can be found here: https://git.picodata.io/picodata/picodata/tarantool-module/-/compare/master...fix%2Fcbus-segv. This version using Weak refs, but this code leads to flaky test unbounded_mpsc_test. After long time with gdb i reach that sometimes there is a segfault in one of non-tx threads in random place, but always inside malloc call. I trying to research this faults and came to the conclusion that there is memory corruption in place that i cannot find. So current fix is the second iteration, when i think: "ok, let's send Cond explicit to the TX thread and drop it all time in TX thread".

Edited by Konstantin D

Merge request reports