-
Notifications
You must be signed in to change notification settings - Fork 92
Description
Ngrest is trying to write 6.6 MB response, but the client receives partial response and nginx closes connection after timeout.
The call sequence is: mod_ngrest_handler -> ngrest_server_dispatch:
here context and poolbody are allocated. There is also a PoolRecycler recyclerBody(context.response->poolBody);
This cleans up the poolbody (by destructor) once the ngrest_server_dispatch is returned.
Pool memory is allocated from heap.
However for large nginx handles asynchronously and so response is queued and then written into socket. However by the time, the response is written into socket, the poolbody is cleaned up and so only partial response could be written.
The fix is to copy the response to memory allocated by nginx memory pool in mod_ngrest_write_client_callback and this memory is retained by nginx till the response is completely written to socket.
The fix attached includes other fixes for issues described in #98