[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#6993)



> Hello
>
> This problem occurs at the end of the connection  init.
> At the end of the connection_init, the connection is provided to the
> listener list (through slapd_add_internal call) and then, the connection
> mutex is freed.
>
> ==>  At this point, the connection is available to the listener but the
> back end initialization has not been done.
>
> The backend_connection_init call is done out of the connection mutex
> protection.
> If the connection mutex is freed after the connection_init call, all the
> back end should performed their initialization before it could be used
> in the operation

Thank you.  I understand your point, and I agree that the connection
initialization is not over until all backends had an opportunity to deal
with it.  My concern is about any harm this change may cause to existing
code.

A quick search in official backends and overlays shows that only
slapo-rwm(5) is currently setting this hook.  Let alone this possible bug,
this fact triggers something in my mind: bi_connection_init() might not be
the best place for your initialization to occur.

In fact, this is intended to provide something to *all* connections, but a
connection being created does not imply that your backend will be used, so
it may be a waste of resources to initialize your backend for *all*
connections.

You might be better off initializing your backend's connections only when
they are actually needed, i.e. each operation within your backend should
(mutex-protected) check whether initialization occurred and, if it didn't,
do it; if it's ongoing, just pause waiting for it to finish.

p.