pespin has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/osmo-pcu/+/36450?usp=email )
Change subject: Make sure GprsMs free() also frees its tbfs ......................................................................
Make sure GprsMs free() also frees its tbfs
This fixes TBF objects leaking and ending up alive when the MS object is explicitly freed through talloc_free (and sporadically crashing TbfTest once a timeout for them occur).
This mostly affects unit tests, where most of the explicit free() happens. In osmo-pcu, in general, the GprsMs object only gets _free() called when its resource count reaches 0, aka no more TBFs are attached to it. Hence in general GprsMs object is freed() only when no TBFs (to be leaked) are present. However, in the unit tests it's usual that we want to wipe the entire context by eg. feeing the PCU, the BTS or MS object, which should also free the related TBFs.
When running osmo-pcu this may only be an issue when the MS object is freed explicitly, which could happen for instance when a BTS is torn down, ie. PCUIF going down, moment at which all GprsMs of that BTS are freed. But in there actually it iterates over PDCHs to free all TBFs, so it's fine. If we iterated over MS, this could have ended up in a crash, like it happened in TbfTest sporadically, but it's not a bit problem if we crash + restart at that time since anyway the BTS is gone ore just getting up around that time.
Related: OS#6359 Change-Id: Ibbdec94acb8132be20508d3178d88da44bfaf91d --- M src/gprs_ms.c M tests/alloc/AllocTest.err M tests/ms/MsTest.cpp M tests/ms/MsTest.err M tests/ms/MsTest.ok M tests/tbf/TbfTest.err M tests/types/TypesTest.err M tests/ulc/PdchUlcTest.err 8 files changed, 4,990 insertions(+), 94 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/50/36450/2