bigfile/py/loadblk: Replace pybuf with a stub object in calling frame in case it stays alive
It turns out some code wants to store tracebacks e.g. for further logging/whatever. This way GC won't help to free up references to pybuf. However if pybuf remain referenced only from calling frames, we can change there reference to pybuf to a stub object "<pybuf>" and this way remove the reference. With added test but without loadblk changes the failure would be as: pybigfile_loadblk WARN: pybuf->ob_refcnt != 1 even after GC: pybuf (ob_refcnt=2): <read-write buffer ptr 0x7fae4911f000, size 2097152 at 0x7fae4998cef0> pybuf referrers: [<frame object at 0x556daff41aa0>] <-- NOTE bigfile/_bigfile.c:613 pybigfile_loadblk BUG!
Showing