https://bz.apache.org/bugzilla/show_bug.cgi?id=68553
Bug ID: 68553 Summary: Memory leak detected when using httpd as a reverse proxy on Windows Product: Apache httpd-2 Version: 2.4.57 Hardware: PC Status: NEW Severity: critical Priority: P2 Component: mod_proxy Assignee: bugs@httpd.apache.org Reporter: kosaka.k...@fujitsu.com Target Milestone: --- We observed an issue where the virtual memory usage of the Apache communication process increased indefinitely during heavy HTTP traffic. This was under the following environment: - Windows OS (Windows 10) - httpd version was 2.4.58 (Win64) (Apache Lounge VS17 Server built:Oct 18 2023 13:03:18) - mod_proxy was enabled, using httpd as a reverse proxy server - MaxConnectionsPerChild set to 0 (default value) By debugging mod_proxy, I found that the backend's IP address string (16 bytes for IPv4) is added to the memory pool for DNS resolution (dns_pool) every time when a new TCP connection to the backend is opend. The problem occurs when the following function in core.c is run. /server/core.c L5259 https://github.com/apache/httpd/blob/2.4.58/server/core.c#L5259 ``` static conn_rec *core_create_conn(apr_pool_t *ptrans, server_rec *server, apr_socket_t *csd, long id, void *sbh, apr_bucket_alloc_t *alloc) ~ if (apr_sockaddr_ip_get(&c->client_ip, c->client_addr)) { //here ~ ``` This function returns an IP address string using the memory pool "c->client_addr->pool". On Windows, this pool is set to dns_pool, so the IP address string remains in memory until the process terminates. On the other hand, on Linux, scpool is used instead of dns_pool and the case does not happen. (The IP address string is reset from memory when the TCP connection is closed) #Steps to reproduce 1) Add the reverse proxy settings to httpd.conf. For example, set as follows. ``` ProxyPass "/foo" "http://foo.example.com/bar" ProxyPassReverse "/foo" "http://foo.example.com/bar" ``` 2) Send a large number of HTTP/1.1 requests with Apache Bench or JMeter, etc 3) Measure the memory usage of the httpd process using PowerShell etc. You can confirm that the memory of the httpd process increases. This issue is easily reproduced if you reduce the maximum number of HTTP Keep-Alive connections on your backend server. This issue probably also occurs with httpd versions prior to 2.4.58. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: bugs-unsubscr...@httpd.apache.org For additional commands, e-mail: bugs-h...@httpd.apache.org