s4: Composite async callback on error conditions

Stefan (metze) Metzmacher metze at samba.org
Mon Jan 17 03:28:46 MST 2011


Am 15.01.2011 22:12, schrieb Matthias Dieter Wallnöfer:
> Given the file "libcli/composite/composite.c":
>> _PUBLIC_ void composite_error(struct composite_context *ctx, NTSTATUS
>> status)
>> {
>>         /* you are allowed to pass NT_STATUS_OK to composite_error(),
>> in which
>>            case it is equivalent to composite_done() */
>>         if (NT_STATUS_IS_OK(status)) {
>>                 composite_done(ctx);
>>                 return;
>>         }
>>         if (!ctx->used_wait && !ctx->async.fn) {
>>                 event_add_timed(ctx->event_ctx, ctx, timeval_zero(),
>> composite_trigger, ctx);
>>         }
>>         ctx->status = status;
>>         ctx->state = COMPOSITE_STATE_ERROR;
>>         if (ctx->async.fn != NULL) {
>>                 ctx->async.fn(ctx);
>>         }
>> }
> Regardless if an action succeeds (composite_done branch) or fails a
> specified async callback is launched if it has been set. As far as I can
> see this leads to problems: see
> http://build.samba.org/build.cgi/build/50b21d3db7ff575c3bdac41bedc8d77ab74680a9
> (access in talloc destructor).
> So my question: should we still be running async callbacks also on
> failure conditions? Or can this particular problem be solved differently?

The problem is not in this code, it's the talloc hierachie in both the
smb and dcerpc client libraries.

One problem is that transport_destructor() calls smbcli_transport_dead(),
this is triggered when the dcerpc code tries to free the smb connection
state
while still having an outstanding request, which smbcli_transport_dead()
tries
to finish, while half of the state is already freed.

We have a few of those problems in our client libraries
and the only real fix is to use tevent_req and develop a concept
how we can handle broken connections in a sane way.
That's on my todo list...

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20110117/1efcdd45/attachment.pgp>


More information about the samba-technical mailing list