]> git.kaiwu.me - nginx.git/commitdiff
HTTP/3: fixed ngx_stat_active counter.
authorRoman Arutyunyan <arut@nginx.com>
Wed, 22 Sep 2021 11:08:21 +0000 (14:08 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Wed, 22 Sep 2021 11:08:21 +0000 (14:08 +0300)
Previously the counter was not incremented for HTTP/3 streams, but still
decremented in ngx_http_close_connection().  There are two solutions here, one
is to increment the counter for HTTP/3 streams, and the other one is not to
decrement the counter for HTTP/3 streams.  The latter solution looks
inconsistent with ngx_stat_reading/ngx_stat_writing, which are incremented on a
per-request basis.  The change adds ngx_stat_active increment for HTTP/3
request and push streams.

src/http/v3/ngx_http_v3_filter_module.c
src/http/v3/ngx_http_v3_request.c

index 34b2991ad9cdb1cf0061c114ae53f8c8585fafb9..43d2cd1bd32c9b0674b3b3cffc77d1d4d8a0e6e1 100644 (file)
@@ -896,6 +896,10 @@ ngx_http_v3_create_push_request(ngx_http_request_t *pr, ngx_str_t *path,
         return NGX_ABORT;
     }
 
+#if (NGX_STAT_STUB)
+    (void) ngx_atomic_fetch_add(ngx_stat_active, 1);
+#endif
+
     hc = ngx_palloc(c->pool, sizeof(ngx_http_connection_t));
     if (hc == NULL) {
         ngx_http_close_connection(c);
index 793a34816aa5ac11253b98d1d65351f22f638a12..533a50fb886aa845b1b24091edceab8b9beac7fa 100644 (file)
@@ -78,6 +78,10 @@ ngx_http_v3_init(ngx_connection_t *c)
 
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 init request stream");
 
+#if (NGX_STAT_STUB)
+    (void) ngx_atomic_fetch_add(ngx_stat_active, 1);
+#endif
+
     hc = c->data;
 
     clcf = ngx_http_get_module_loc_conf(hc->conf_ctx, ngx_http_core_module);