Repository navigation
memory usage keeps increasing after upgrading from 3.12 to 3.18 #13999
|
Hi APISIX team, I’m investigating a memory usage issue after upgrading Apache APISIX from 3.12 to 3.18. Our main use case is LLM/AI Gateway, and we are using the ai-proxy-multi plugin. Environment
Problem After upgrading from 3.12 to 3.18, APISIX worker memory usage gradually increases. Restarting the APISIX pods temporarily brings memory usage back down, but it gradually increases again. Questions
I can provide configuration snippets, memory metrics, worker information, and relevant logs if needed. Thanks! |
Replies: 1 comment 3 replies
|
I couldn't find a reported leak in 1. Bigger Prometheus shared dict (#13688). The default size of Check 2. New HTTP client for AI requests (#13778). Since 3.18, plugin_attr:
ai-proxy:
http_client: lua-resty-httpLua heap vs other memory: call the Control API on a pod: |
Yes, it's a leak in ngx_http_ffi_client, and it's per closed upstream connection rather than per request. Every connection the client closes leaves its nginx connection pool behind and, over TLS, its OpenSSL
SSLobject too. I reproduced it on the officialapache/apisix:3.18.0-debianand3.19.0-debianimages. Both ship ngx_http_ffi_client v0.1.3 (APISIX-Runtime 1.3.16 and 1.3.18), which is also the module's latest commit.Every close path goes through
ngx_http_ffi_client_keepalive_close_connection()(src/ngx_http_ffi_client_keepalive.c#L536-L548). That function deletes the timers and callsngx_close_connection(c), which frees neitherc->pool(created for each connection at request.c#L1161)…