Closed thibaultcha closed 2 months ago
Attention: Patch coverage is 93.98625%
with 35 lines
in your changes missing coverage. Please review.
Project coverage is 90.55719%. Comparing base (
ae7b611
) to head (0368123
).
@casimiro I added one more fix that I can squash later, can you take a quick look at it make sure it is sound? I tested the ngx_init_cycle
code paths locally.
Nice catch @thibaultcha!
The added change indeed fixes the issue, although I think there's a more terse way to fix it.
Originally, we were setting metrics->shm_zone->noreuse
to 1 in ngx_wa_metrics_init_conf
when the old-cycle's metrics storage couldn't be reused. Then, later in ngx_wa_metrics_init
we would check for metrics->shm_zone->noreuse
and reallocate the old-cycle's metrics accordingly.
However, we should have set metrics->old_metrics->shm_zone->noreuse
to 1 in ngx_wa_metrics_init_conf
and check for metrics->old_metrics->shm_zone->noreuse
in ngx_wa_metrics_init
.
This expresses more clearly what's happening: the new configuration made the old-cycle's metrics storage non-reusable, not the current-cycle's one.
I pushed a commit representing what I mean.
I thought the commit I pushed was equivalent to the fix you proposed, weird. I'm investigating why it's not.
After correcting the fix I proposed, I'm less inclined to prefer it over the one you pushed.
Well are mis-using the noreuse
flag in any case so it may not do what we want it to do. At least the original fix fully leans into that misuse and takes advantage of that it's possible to set the flag at reload (although a misuse).
ngx_wa_*
facilities getters~