diff --git a/include/haproxy/initcall.h b/include/haproxy/initcall.h index dffec04d1..1f44e5e22 100644 --- a/include/haproxy/initcall.h +++ b/include/haproxy/initcall.h @@ -67,6 +67,7 @@ enum init_stage { STG_ALLOC, // allocate required structures STG_POOL, // create pools STG_INIT, // subsystems normal initialization + STG_INIT_2, // runs after step_init_2, to have global.nbthread STG_SIZE // size of the stages array, must be last }; @@ -202,6 +203,7 @@ DECLARE_INIT_SECTION(STG_REGISTER); DECLARE_INIT_SECTION(STG_ALLOC); DECLARE_INIT_SECTION(STG_POOL); DECLARE_INIT_SECTION(STG_INIT); +DECLARE_INIT_SECTION(STG_INIT_2); // for use in the main haproxy.c file #define DECLARE_INIT_STAGES asm("") diff --git a/src/haproxy.c b/src/haproxy.c index ab17fee6b..d6d7b1319 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -3378,6 +3378,7 @@ int main(int argc, char **argv) */ step_init_2(argc, argv); + RUN_INITCALLS(STG_INIT_2); /* Late init step: register signals for worker and standalon modes, apply * nofile and memory limits, apply capabilities from binary, if any. */ diff --git a/src/stick_table.c b/src/stick_table.c index 5532fc679..08e08a03c 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -5901,10 +5901,10 @@ static void stkt_late_init(void) f = find_sample_fetch("src", strlen("src")); if (f) smp_fetch_src = f->process; - hap_register_post_check(stkt_create_stk_ctr_pool); + stkt_create_stk_ctr_pool(); } -INITCALL0(STG_INIT, stkt_late_init); +INITCALL0(STG_INIT_2, stkt_late_init); /* register cli keywords */ static struct cli_kw_list cli_kws = {{ },{