Project

General

Profile

Actions

Bug #1317

closed

urcu: memory leaks

Added by Brett Holman over 3 years ago. Updated almost 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
05/17/2021
Due date:
% Done:

100%

Estimated time:

Description

Hello!

I was tracking down a memory leak in a project I'm contributing to (using Valgrind) and it looks like some leaks exist in userspace-rcu.

Specifically calls to call_rcu() is what I am interested in.

I ran the tests included in userspace-rcu with Valgrind and noticed that there may be some other leaks as well. I've attached the exact tests I ran as well as the output.

Regards,
Brett


Files

test.sh (2.43 KB) test.sh valgrind commands Brett Holman, 05/17/2021 09:46 PM
tests.out (55.1 KB) tests.out test output Brett Holman, 05/17/2021 09:46 PM
Actions #1

Updated by Mathieu Desnoyers over 3 years ago

This message on the lttng-dev mailing list discusses the reason why liburcu's default call_rcu worker thread data structures are leaked at process exit, and hints at a possible solution:

https://lists.lttng.org/pipermail/lttng-dev/2021-April/029951.html

Relevant snippet here:

I can see that maybe we could change liburcu to make it so that we free all
call_rcu data structures _if_ they happen to be empty of callbacks at process exit,
after invoking one rcu_barrier. That should take care of not leaking data structures
in the common case where call_rcu does not enqueue further callbacks.

And relevant follow up reply:

https://lists.lttng.org/pipermail/lttng-dev/2021-May/029963.html

Actions #2

Updated by Brett Holman over 3 years ago

Thanks for the response Mathieu. I believe that what was suggested in this discussion below would cover the current case that I'm seeing.

> > > I can see that maybe we could change liburcu to make it so that
> > > we
> > > free all
> > > call_rcu data structures _if_ they happen to be empty of
> > > callbacks at
> > > process exit,
> > > after invoking one rcu_barrier. That should take care of not
> > > leaking
> > > data structures
> > > in the common case where call_rcu does not enqueue further
> > > callbacks.
> > > 
> > > Thoughts ?

Without diving into the current urcu implementation more I don't have any better suggestions to handle the callback-in-callback issue that was mentioned.

Actions #3

Updated by Mathieu Desnoyers almost 2 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF