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

Refactor memory hierarchy in sysdb #1671

Closed
sssd-bot opened this issue May 2, 2020 · 0 comments
Closed

Refactor memory hierarchy in sysdb #1671

sssd-bot opened this issue May 2, 2020 · 0 comments
Labels
Closed: Fixed Issue was closed as fixed.

Comments

@sssd-bot
Copy link

sssd-bot commented May 2, 2020

Cloned from Pagure issue: https://pagure.io/SSSD/sssd/issue/629

  • Created at 2010-09-20 17:10:45 by sgallagh
  • Closed as Fixed
  • Assigned to jzeleny

Quoted from https://fedorahosted.org/pipermail/sssd-devel/2010-September/004624.html

There are several places in the sysdb where
we're doing this wrong, because once upon a time the sysdb was an
asynchronous interface. When this was the case, it was necessary for
these functions to have a memory context, because we needed to be able
to cancel them if the parent context was canceled.

Nowadays, the proper behavior is that a synchronous function should NOT
take a talloc context unless it is returning data. Internally to the
synchronous function, this should be the ONLY memory allocated atop this
context. Any other memory allocated during the synchronous run should be
allocated atop a tmp_ctx that is a child of NULL.

The reason for this is that it makes it much easier to track down memory
leaks. Valgrind is unable to detect when memory is still in use if it's
been attached to another memory context (because it's still referenced
by a variable that is in scope).

If the memory context happens to be something long-lived (for example
it's a direct child of the responder context or nss context) then this
memory may leak on every invocation without a way to see that it happened.

However, if the temporary context for this function is allocated on
NULL, when the function exits, if tmp_ctx hasn't been fully destroyed,
there will remain a detectable memory leak that we can use to identify
the source of growth.

As discussed in that mailing list thread, we should go through the sysdb and adjust all of the public interfaces to behave in the same manner.

Comments


Comment from dpal at 2010-09-21 15:18:44

Fields changed

milestone: NEEDS_TRIAGE => SSSD 1.5.0
owner: somebody => jzeleny


Comment from dpal at 2010-10-19 15:59:00

Fields changed

milestone: SSSD 1.5.0 => SSSD 1.6.0


Comment from dpal at 2011-02-07 15:50:25

Fields changed

coverity: =>
milestone: SSSD 1.6.0 => SSSD 1.7.0
upgrade: => 0


Comment from jzeleny at 2011-06-08 09:53:32

Fields changed

patch: => 0
status: new => assigned


Comment from dpal at 2011-07-21 15:06:41

Fields changed

milestone: SSSD 1.8.0 => SSSD 1.7.0
priority: minor => critical


Comment from jhrozek at 2011-08-18 14:04:06

Fixed in master:

e79d239

844015b

resolution: => fixed
rhbz: =>
status: assigned => closed


Comment from sgallagh at 2012-01-30 21:55:15

Fields changed

rhbz: => 0


Comment from sgallagh at 2017-02-24 14:54:01

Metadata Update from @sgallagh:

  • Issue assigned to jzeleny
  • Issue set to the milestone: SSSD 1.7.0
@sssd-bot sssd-bot added the Closed: Fixed Issue was closed as fixed. label May 2, 2020
@sssd-bot sssd-bot closed this as completed May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed: Fixed Issue was closed as fixed.
Projects
None yet
Development

No branches or pull requests

1 participant