Skip to content

Commit b771a2e

Browse files
committed
bugfix: when a coroutine aborts with errors, its status might not be updated to "dead".
1 parent 3b5dc53 commit b771a2e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/ngx_http_lua_util.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,27 +1094,22 @@ ngx_http_lua_run_thread(lua_State *L, ngx_http_request_t *r,
10941094
continue;
10951095

10961096
case LUA_ERRRUN:
1097-
ctx->cur_co_ctx->co_status = NGX_HTTP_LUA_CO_DEAD;
10981097
err = "runtime error";
10991098
break;
11001099

11011100
case LUA_ERRSYNTAX:
1102-
ctx->cur_co_ctx->co_status = NGX_HTTP_LUA_CO_DEAD;
11031101
err = "syntax error";
11041102
break;
11051103

11061104
case LUA_ERRMEM:
1107-
ctx->cur_co_ctx->co_status = NGX_HTTP_LUA_CO_DEAD;
11081105
err = "memory allocation error";
11091106
break;
11101107

11111108
case LUA_ERRERR:
1112-
ctx->cur_co_ctx->co_status = NGX_HTTP_LUA_CO_DEAD;
11131109
err = "error handler error";
11141110
break;
11151111

11161112
default:
1117-
ctx->cur_co_ctx->co_status = NGX_HTTP_LUA_CO_DEAD;
11181113
err = "unknown error";
11191114
break;
11201115
}
@@ -1127,6 +1122,8 @@ ngx_http_lua_run_thread(lua_State *L, ngx_http_request_t *r,
11271122
msg = "unknown reason";
11281123
}
11291124

1125+
ctx->cur_co_ctx->co_status = NGX_HTTP_LUA_CO_DEAD;
1126+
11301127
ngx_http_lua_thread_traceback(L, ctx->cur_co_ctx->co,
11311128
ctx->cur_co_ctx);
11321129
trace = lua_tostring(L, -1);

0 commit comments

Comments
 (0)