Opened 9 years ago

Closed 5 years ago

#871 closed enhancement (invalid)

Memory leak in directio mode

Reported by: upliner@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.9.x
Keywords: Cc:
uname -a: Linux upl 3.19.0-42-generic #48-Ubuntu SMP Thu Dec 17 22:54:45 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.8.0
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/ --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-file-aio --with-http_geoip_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --add-module=/dat2/src/nginx-debian/nginx-1.8.0/debian/modules/nginx-auth-pam --add-module=/dat2/src/nginx-debian/nginx-1.8.0/debian/modules/nginx-echo --add-module=/dat2/src/nginx-debian/nginx-1.8.0/debian/modules/nginx-upstream-fair --add-module=/dat2/src/nginx-debian/nginx-1.8.0/debian/modules/nginx-rtmp-module --add-module=/dat2/src/nginx-debian/nginx-1.8.0/debian/modules/nginx-vod-module --add-module=/dat2/src/nginx-debian/nginx-1.8.0/debian/modules/nginx-mp4mux-module


Our module assembles large files from small fragments of other files. As result, very large count of temporary buffers are allocated with ngx_output_chain_align_file_buf when directio is on. These buffers remain in memory until request pool is destroyed. Why reusable buffers can't be used for this purpose?

Change History (3)

comment:1 by upliner@…, 9 years ago

Component should be changed to nginx-core

comment:2 by Maxim Dounin, 9 years ago

Component: documentationnginx-core
Type: defectenhancement

Alignment buffers are not reused as they are not expected to be needed many times. Normally, at most one alignment buffer will be enough.

If it's a problem for your module - feel free to suggest improvements, see for some hints.

Note well that it's not a memory leak - all buffers are freed when request terminates, they are not leaked.

comment:3 by Maxim Dounin, 5 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.