Skip to content

Commit d7d4547

Browse files
committed
bugfix: avoided a potential memory issue when the request handler is aborted prematurely (via ngx.exit, for example) while a light thread is still waiting on ngx.flush(true).
1 parent 740552f commit d7d4547

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ngx_http_lua_util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,8 @@ ngx_http_lua_process_flushing_coroutines(ngx_http_request_t *r,
16491649

16501650
if (coctx[i].flushing) {
16511651
coctx[i].flushing = 0;
1652+
ctx->flushing_coros--;
1653+
n--;
16521654
ctx->cur_co_ctx = &coctx[i];
16531655

16541656
rc = ngx_http_lua_flush_resume_helper(r, ctx);
@@ -1658,8 +1660,6 @@ ngx_http_lua_process_flushing_coroutines(ngx_http_request_t *r,
16581660

16591661
/* rc == NGX_DONE */
16601662

1661-
ctx->flushing_coros--;
1662-
n--;
16631663
if (n == 0) {
16641664
return NGX_DONE;
16651665
}

0 commit comments

Comments
 (0)