]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9789 slapd-asyncmeta: Reset op->o_counters every time we migrate to a new thread
authorOndřej Kuzník <ondra@mistotebe.net>
Tue, 25 Jan 2022 14:13:07 +0000 (14:13 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 2 Feb 2022 17:12:23 +0000 (17:12 +0000)
servers/slapd/back-asyncmeta/add.c
servers/slapd/back-asyncmeta/meta_result.c
servers/slapd/back-asyncmeta/search.c

index d32415ba8ccebfd6732467089f6aa3932a56bc56..1f194ed58990629515895a3ad26199644b60aa58 100644 (file)
@@ -51,6 +51,7 @@ asyncmeta_error_cleanup(Operation *op,
        }
        asyncmeta_drop_bc(mc, bc);
        slap_sl_mem_setctx(op->o_threadctx, op->o_tmpmemctx);
+       operation_counter_init( op, op->o_threadctx );
        ldap_pvt_thread_mutex_unlock( &mc->mc_om_mutex);
        send_ldap_result(op, rs);
        return LDAP_SUCCESS;
index 07863bbfb63ea18257d0789c6a9e6a76ca253df2..0ce279a1dfde2e13994de72c05770023a5bb37ea 100644 (file)
@@ -650,6 +650,7 @@ asyncmeta_send_all_pending_ops(a_metaconn_t *mc, int candidate, void *ctx, int d
                bc->op->o_threadctx = ctx;
                bc->op->o_tid = ldap_pvt_thread_pool_tid( ctx );
                slap_sl_mem_setctx(ctx, bc->op->o_tmpmemctx);
+               operation_counter_init( bc->op, ctx );
                bc->bc_active++;
                ret = asyncmeta_send_pending_op(bc, candidate);
                if (ret != META_SEARCH_CANDIDATE) {
@@ -699,6 +700,7 @@ asyncmeta_return_bind_errors(a_metaconn_t *mc, int candidate, SlapReply *bind_re
                        bc->op->o_threadctx = ctx;
                        bc->op->o_tid = ldap_pvt_thread_pool_tid( ctx );
                        slap_sl_mem_setctx(ctx, bc->op->o_tmpmemctx);
+                       operation_counter_init( bc->op, ctx );
                        bc->rs.sr_err = bind_result->sr_err;
                        bc->rs.sr_text = bind_result->sr_text;
                        mc->pending_ops--;
@@ -1422,6 +1424,7 @@ asyncmeta_op_read_error(a_metaconn_t *mc, int candidate, int error, void* ctx)
                bc->op->o_threadctx = ctx;
                bc->op->o_tid = ldap_pvt_thread_pool_tid( ctx );
                slap_sl_mem_setctx(ctx, bc->op->o_tmpmemctx);
+               operation_counter_init( bc->op, ctx );
 
                op = bc->op;
                rs = &bc->rs;
@@ -1569,6 +1572,7 @@ retry_bc:
                bc->op->o_threadctx = ctx;
                bc->op->o_tid = ldap_pvt_thread_pool_tid( ctx );
                slap_sl_mem_setctx(ctx, bc->op->o_tmpmemctx);
+               operation_counter_init( bc->op, ctx );
                if (bc->op->o_abandon) {
                        ldap_pvt_thread_mutex_lock( &mc->mc_om_mutex );
                        asyncmeta_drop_bc( mc, bc);
@@ -1668,12 +1672,14 @@ void* asyncmeta_timeout_loop(void *ctx, void *arg)
                        }
 
                        if (bc->op->o_abandon ) {
-                                       /* set our memctx */
-                               bc->op->o_threadctx = ctx;
-                               bc->op->o_tid = ldap_pvt_thread_pool_tid( ctx );
-                               slap_sl_mem_setctx(ctx, bc->op->o_tmpmemctx);
                                Operation *op = bc->op;
 
+                               /* set our memctx */
+                               op->o_threadctx = ctx;
+                               op->o_tid = ldap_pvt_thread_pool_tid( ctx );
+                               slap_sl_mem_setctx(ctx, op->o_tmpmemctx);
+                               operation_counter_init( op, ctx );
+
                                LDAP_STAILQ_REMOVE(&mc->mc_om_list, bc, bm_context_t, bc_next);
                                mc->pending_ops--;
                                for (j=0; j<mi->mi_ntargets; j++) {
@@ -1730,6 +1736,7 @@ void* asyncmeta_timeout_loop(void *ctx, void *arg)
                        bc->op->o_threadctx = ctx;
                        bc->op->o_tid = ldap_pvt_thread_pool_tid( ctx );
                        slap_sl_mem_setctx(ctx, bc->op->o_tmpmemctx);
+                       operation_counter_init( bc->op, ctx );
 
                        if (bc->searchtime) {
                                timeout_err = LDAP_TIMELIMIT_EXCEEDED;
index 5310ca1c2aaa311d3e9c85d42cda7afb23759f2f..0b0db8225c24838aff1f5459f4b33d413ae5e834 100644 (file)
@@ -58,6 +58,7 @@ asyncmeta_handle_onerr_stop(Operation *op,
                }
        }
        slap_sl_mem_setctx(op->o_threadctx, op->o_tmpmemctx);
+       operation_counter_init( op, op->o_threadctx );
        ldap_pvt_thread_mutex_unlock( &mc->mc_om_mutex);
        send_ldap_result(op, rs);
 }