Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XrdOfs Memory leak #1008

Closed
mpatrascoiu opened this issue Jun 20, 2019 · 1 comment
Closed

XrdOfs Memory leak #1008

mpatrascoiu opened this issue Jun 20, 2019 · 1 comment

Comments

@mpatrascoiu
Copy link
Contributor

mpatrascoiu commented Jun 20, 2019

Spotted while running the EOS unit tests compiled with Address Sanitizer.
The following dummy test case will produce memory leaks:

TEST(XrdFstOfs, Dummy)
{
  XrdOfs ofs;
  ASSERT_TRUE(true);
}

With the following message:

Direct leak of 7 byte(s) in 1 object(s) allocated from:
    #0 0x7fac28b16180 in strdup (/usr/lib64/libasan.so.3+0x5a180)
    #1 0x7fac254aff71 in XrdOfs::XrdOfs() /workspace/xrootd/src/XrdOfs/XrdOfs.cc:139
    #2 0x8c8466 in XrdFstOfs_Dummy_Test::TestBody() /workspace/eos/unit_tests/fst/XrdFstOfsTests.cc:65
...
    #14 0x7fac23faf3d4 in __libc_start_main (/usr/lib64/libc.so.6+0x223d4)

Traced it down to the XrdOfs::XrdOfs() constructor, which performs memory allocation in myRole = strdup(...), but that memory never gets deallocated in the deconstructor.

Since it was causing our Asan unit tests to fail, we added a suppression for this particular case, but would be nicer to have it fixed. :)

Edit: set language format for code blocks

@abh3
Copy link
Member

abh3 commented Jul 3, 2019

We consider this a false positive. Many plugin allocate storage for the life of the plugin. As there is no way of exiting xrootd other than killing it, the storage is obviously freed when the process dies. While we can go and fix all of these one-time allocations that's a lot of work to simply satisfy memory leak detectors when, in practice, there really is no leak. Yes, I'm sure several people will disagree but we're taking the path of least resistance here.

@abh3 abh3 closed this as completed Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants