You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Cloned from Pagure issue: https://pagure.io/SSSD/sssd/issue/629
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:
The text was updated successfully, but these errors were encountered: