Commit 6fec23e
committed
bugfix: leaked ctxs slot when ngx_lua_ffi_set_ctx_ref failed.
ref_in_table() reserves a slot in the shared ctxs table before the FFI
call. When ngx_http_lua_ffi_set_ctx_ref() returned non-FFI_OK (OOM
registering the request-pool cleanup), the slot was never released and
accumulated until the worker exited.
- get_ctx_table(): release the slot before returning nil.
- set_ctx_table(): the return value of the FFI call was ignored; now
release the slot and raise "no memory", matching the C-side
luaL_error(L, "no memory") convention.
Add base.unref_in_table() as the public counterpart to base.ref_in_table()
that pushes the ref onto the free list at FREE_LIST_REF, mirroring the
layout used by luaL_ref/luaL_unref on the C side (both operate on the
same table via the ngx_lua_ctx_tables registry key).1 parent fb7710e commit 6fec23e
2 files changed
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
225 | 235 | | |
226 | 236 | | |
227 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| 110 | + | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
| |||
136 | 138 | | |
137 | 139 | | |
138 | 140 | | |
139 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
140 | 145 | | |
141 | 146 | | |
142 | 147 | | |
| |||
0 commit comments