[PATCH] Cache messaging dgm connections

Jeremy Allison jra at samba.org
Thu Sep 15 17:03:08 UTC 2016


On Thu, Sep 15, 2016 at 11:06:00AM +0200, Ralph Böhme wrote:
>  Wed, Sep 14, 2016 at 10:13:13PM -0700, Jeremy Allison wrote:
> > My money is on the event context getting freed with
> > active connections. I'm cheating here as this is
> > something metze already discovered with Volker's
> > tmsgd work :-).
> > 
> > Metze's patch for this is attached (modified to
> > compile in master). I'm trying a private autobuild
> > with it now.
> 
> I guess we also need this:
> 
> --- a/lib/poll_funcs/poll_funcs_tevent.c
> +++ b/lib/poll_funcs/poll_funcs_tevent.c
> @@ -474,6 +474,7 @@ struct poll_funcs *poll_funcs_init_tevent(TALLOC_CTX *mem_ctx)
>  static int poll_funcs_state_destructor(struct poll_funcs_state *state)
>  {
>         size_t num_watches = talloc_array_length(state->watches);
> +       size_t num_timeouts = talloc_array_length(state->timeouts);
>         size_t i;
>         /*
>          * Make sure the watches are cleared before the contexts. The watches
> @@ -482,6 +483,9 @@ static int poll_funcs_state_destructor(struct poll_funcs_state *state)
>         for (i=0; i<num_watches; i++) {
>                 TALLOC_FREE(state->watches[i]);
>         }
> +       for (i=0; i<num_timeouts; i++) {
> +               TALLOC_FREE(state->timeouts[i]);
> +       }
>         return 0;
>  }
> 
> but afaict all this will still crash if the tevent context is freed
> before we have a chance to rundown the messaging and poll_funcs
> contexts.

That's why metze's patch changes the talloc owner of
struct poll_funcs_tevent_context to the tevent context.

I think the following patch should fix the problem.

Let me run another private autobuild to be sure, and
I'll report back asap. If everything passes, I'll
propose this for review.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s3-lib-poll_funcs.-Ensure-struct-poll_funcs_tevent_c.patch
Type: text/x-diff
Size: 2593 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160915/7ca2f2dc/0001-s3-lib-poll_funcs.-Ensure-struct-poll_funcs_tevent_c.diff>


More information about the samba-technical mailing list