From 353c202022f3d149218e53d09567cdb7c01fdf6a Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Mon, 28 Sep 2026 15:42:40 -0700 Subject: [PATCH] QuickJS: stop tracking rejections during final report Converting the rejection reason to a log string may reject another promise. Disable the tracker before reporting so new rejections cannot leave references in the request context after its list has been drained. --- nginx/ngx_js.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nginx/ngx_js.c b/nginx/ngx_js.c index cfa9ec14..b7d04a5d 100644 --- a/nginx/ngx_js.c +++ b/nginx/ngx_js.c @@ -1378,11 +1378,12 @@ ngx_engine_qjs_destroy(ngx_engine_t *e, ngx_js_ctx_t *ctx, ngx_qjs_clear_events(ctx); + JS_SetHostPromiseRejectionTracker(JS_GetRuntime(cx), NULL, NULL); + if (ngx_qjs_unhandled_rejection(ctx)) { ngx_qjs_log_exception(e, ctx->log, "unhandled rejection"); } - JS_SetHostPromiseRejectionTracker(JS_GetRuntime(cx), NULL, NULL); ngx_qjs_detach_ctx(ctx, cx); if (JS_IsJobPending(JS_GetRuntime(cx))) { -- 2.47.3