[njs] HTTP: fixed stub_status statistic when js_periodic is enabled.

Dmitry Volyntsev xeioex at nginx.com
Thu Feb 1 04:08:27 UTC 2024


details:   https://hg.nginx.org/njs/rev/673d78618fc9
branches:  
changeset: 2279:673d78618fc9
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed Jan 31 17:06:58 2024 -0800
description:
HTTP: fixed stub_status statistic when js_periodic is enabled.

Previously, when js_periodic is enabled the Reading statistic
was growing each time the js_periodic handler was called.

The issue was introduced in f1bd0b1db065 (0.8.1).

This fixes #692 issue on Github.

diffstat:

 nginx/ngx_http_js_module.c |  16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diffs (39 lines):

diff -r fca50ba4db9d -r 673d78618fc9 nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.c	Mon Jan 29 17:16:08 2024 -0800
+++ b/nginx/ngx_http_js_module.c	Wed Jan 31 17:06:58 2024 -0800
@@ -4323,30 +4323,24 @@ ngx_http_js_periodic_finalize(ngx_http_r
 static void
 ngx_http_js_periodic_destroy(ngx_http_request_t *r, ngx_js_periodic_t *periodic)
 {
-    ngx_connection_t    *c;
-    ngx_http_cleanup_t  *cln;
+    ngx_connection_t  *c;
 
     c = r->connection;
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
-                   "http js periodic destroy: \"%V\"",
-                   &periodic->method);
+                   "http js periodic destroy: \"%V\"", &periodic->method);
 
     periodic->connection = NULL;
 
-    for (cln = r->cleanup; cln; cln = cln->next) {
-        if (cln->handler) {
-            cln->handler(cln->data);
-        }
-    }
+    r->logged = 1;
+
+    ngx_http_free_request(r, NGX_OK);
 
     ngx_free_connection(c);
 
     c->fd = (ngx_socket_t) -1;
     c->pool = NULL;
     c->destroyed = 1;
-
-    ngx_destroy_pool(r->pool);
 }
 
 


More information about the nginx-devel mailing list