From: Dmitry Volyntsev Date: Mon, 28 Sep 2026 22:42:40 +0000 (-0700) Subject: QuickJS: stop tracking rejections during final report X-Git-Tag: 1.0.2~9 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=353c202022f3d149218e53d09567cdb7c01fdf6a;p=njs.git 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. --- 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))) {