[PATCH] clean the event context after fork in
jra at samba.org
Wed Jan 7 02:21:15 GMT 2009
On Tue, Jan 06, 2009 at 01:19:41PM +0800, boyang wrote:
> Jeremy Allison wrote:
> > I know it causes a memory leak, but it can't lead to
> > double free. Remember, Metze's patch removes the
> > event pointers from the linked list, but doesn't
> > free them. So even if some codepath has a saved
> > pointer and calls TALLOC_FREE() on it there won't
> > be a double free, the saved pointer hasn't been
> > freed. That's why it causes a memory leak.
> > Doing it this way is safer than trying to free
> > the event pointers inside the event code, that
> > way can lead to crashes if the saved pointer
> > is referenced.
> > When I've added the code to convert the
> > reinit_after_fork() calls to the individual
> > winbindd_reinit_after_fork() etc., this
> > won't be a problem as part of the
> > winbindd_reinit_after_fork() call will be
> > code to free all pending events and null out
> > their saved pointers, so the event_context_reinit()
> > should be a no-op (as all the events on the
> > list will already have been freed).
> v2-event-context-master.diff frees check_online_event. But I think you
> don't need it now. Because all events freeing work will be done in
> winbindd_reinit_after_fork() :-). As you said.
> >> Looks like ccache_regain_all_now relies on entry->refresh_time to judge
> >> whether the handler is krb5_ticket_refresh_handler or
> >> krb5_ticket_gain_handler. Therefore, we must set entry->refresh_time
> >> before event_add_timed to make ccache_regain_all_now work correctly.
> >> I'll post a separate patch later.
> > Please send asap so I can evaluate it as I
> > back-port Metze's code to 3.3-test.
> v2-krb5-refresh-master.diff addresses this. :-) Pls review it, thanks!
Ok, I've finished doing a lot of cleanup work on the
event code in winbindd. It's all checked into 3.3 and
master. Please review.
If you feel it's working, feel free to back-port to 3.2
and/or 3.0.x and I'll commit patches for you. I'm not
doing that work yet as I'm not sure if we're doing any
more 3.2.x releases or just moving on to 3.3.0.
More information about the samba-technical