lua-io-nginx-module icon indicating copy to clipboard operation
lua-io-nginx-module copied to clipboard

Unsafe usage of memory from request pool

Open splitice opened this issue 1 year ago • 1 comments

Unfortunately my PR (#8) is insufficient to fully solve the memory issues with this module. It helps but it doesnt solve it completely, is still possible for requests to finish removing memory in use or about to be used by tasks.

To quote the lua module: https://github.com/openresty/lua-nginx-module/blob/c9a0808c89219f74e4d20cef44a322a1bbe72df3/src/ngx_http_lua_worker_thread.c#L69

 * Re-implement ngx_thread_task_alloc to avoid alloc from request pool
 * since the request may exit before worker thread finish.

Fortunately its hence now possible to implement this module in lua!

splitice avatar May 30 '23 16:05 splitice

Native nginx uses r->blocked to prevent request freeing which might be the better way to do this. Although unsure if this is safe to do in all nginx lua contexts.

splitice avatar Jun 07 '23 10:06 splitice