diff --git a/src/common/metrics/ngx_wa_metrics.c b/src/common/metrics/ngx_wa_metrics.c index 4187a136d..0bf26c358 100644 --- a/src/common/metrics/ngx_wa_metrics.c +++ b/src/common/metrics/ngx_wa_metrics.c @@ -241,6 +241,10 @@ ngx_wa_metrics_init(ngx_wa_metrics_t *metrics, ngx_cycle_t *cycle) } if (metrics->old_metrics && metrics->shm_zone->noreuse) { + /* mark the old kv store for cleanup during SIGHUP old_cycle free */ + metrics->old_metrics->shm_zone->noreuse = 1; + + /* realloc old kv store */ old_shm_kv = ngx_wasm_shm_get_kv(metrics->old_metrics->shm); return realloc_metrics(metrics, old_shm_kv->rbtree.root,