pespin submitted this change.

View Change


Approvals: fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved
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(-)


To view, visit change 36450. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ibbdec94acb8132be20508d3178d88da44bfaf91d
Gerrit-Change-Number: 36450
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged