Hi,
I think I have discovered a potential issue which in some scenarios could bring Nginx to a halt...
I have a small application (running on the latest Openresty bundle) which sends hundreds of thousands of HTTP requests out (doing nothing mischievous - just to build maps of the whole world and cache them on my server).
The whole application is running in ngx.timer context (since it is getting started by init_worker_by_lua), and it scans maps cache for missing parts and sends out http requests to my backend, receives back map's data and fills up gaps.
This application uses https://github.com/pintsized/lua-resty-http client - and everything works fine. However, the application slowly slows down - it gets noticeable after first 100000 requests or so - and then it just gets slower and slower (so I need to restart Nginx every 30 minutes - which corresponds to about 2 millions of sent requests).
I did some testing - this issue only exists when HTTP response has some body (even if it is a very small one - about 30 bytes of JSON in my case). Changing outgoing request's method to HEAD completely eliminates the issue.
Looking inside http client source code I have noticed that for each HTTP request it starts HTTP response body reading coroutine (to support data streaming) - looks like it is a major difference between GET and HEAD (for example) requests. Looking in to lua-nginx-module source code - I can not identify a spot where these coroutines are supposed to get collected once they are done running.
So, here is a question - are coroutines getting garbage collected when started in timer context?
Thanks,
Gene