ADIOS2 icon indicating copy to clipboard operation
ADIOS2 copied to clipboard

BP5 Address sanitizer and undefined behavior sanitizer issues

Open caitlinross opened this issue 1 year ago • 2 comments

I'm updating the Fides CI to use ADIOS 2.9 and found a couple of memory leaks as well as an error found by undefined behavior sanitizer.

Memory leaks:

For the UB error, the only information I get is

/usr/include/c++/9/bits/stl_vector.h:1061:34: runtime error: reference binding to null pointer of type 'const struct value_type'

I did a git bisect and found it started with this commit: 5e03434c2d5d940f51183d07fc607aa8b85801a1

@eisenhauer

caitlinross avatar Apr 07 '23 16:04 caitlinross

Hey Caitlin. Hmm. This code got uglier when we had to support ReadRandomAccess mode and this problem maybe related to that, but offhand I don't see how these things fail to get deleted if the BP5Deserializer destructor is called. This bit of code in the destructor should handle all cases:

    if (m_FreeableMBA)
        delete m_FreeableMBA;
    for (auto &step : MetadataBaseArray)
    {
        delete step;
    }

We're not seeing leaks in our own CI in this, so maybe there's something special about how Fides is using ADIOS? I took a quick peek at the code, but I can't spend time on it at the moment as I'm on vacation. I'd suggest trying to make sure that Close() gets called on all the sources... I don't have any thoughts beyond that without doing some more digging.

eisenhauer avatar Apr 07 '23 17:04 eisenhauer

That could be the case. I'll check on it.

Have fun on vacation!

caitlinross avatar Apr 07 '23 17:04 caitlinross