[core] buffer large responses to tempfiles (fixes #758, fixes #760, fixes #933, fixes...
commit5a91fd4b9032e65ee4f6ebe1ee51e82db6b90a15
authorGlenn Strauss <gstrauss@gluelogic.com>
Wed, 25 May 2016 20:45:09 +0000 (25 16:45 -0400)
committerGlenn Strauss <gstrauss@gluelogic.com>
Sun, 12 Jun 2016 06:51:10 +0000 (12 02:51 -0400)
tree94b541f9d08e9db280866275fe4eb80bf06c2749
parent4f6bd422686421ea2904b35a8d386e65949b8633
[core] buffer large responses to tempfiles (fixes #758, fixes #760, fixes #933, fixes #1387, #1283, fixes #2083)

This replaces buffering entire response in memory which might lead to
huge memory footprint and possibly to memory exhaustion.

use tempfiles of fixed size so disk space is freed as each file sent

update callers of http_chunk_append_mem() and http_chunk_append_buffer()
to handle failures when writing to tempfile.

x-ref:
  "memory fragmentation leads to high memory usage after peaks"
  https://redmine.lighttpd.net/issues/758
  "Random crashing on FreeBSD 6.1"
  https://redmine.lighttpd.net/issues/760
  "lighty should buffer responses (after it grows above certain size) on disk"
  https://redmine.lighttpd.net/issues/933
  "Memory usage increases when proxy+ssl+large file"
  https://redmine.lighttpd.net/issues/1283
  "lighttpd+fastcgi memory problem"
  https://redmine.lighttpd.net/issues/1387
  "Excessive Memory usage with streamed files from PHP"
  https://redmine.lighttpd.net/issues/2083
src/chunk.c
src/chunk.h
src/http_chunk.c
src/http_chunk.h
src/mod_cgi.c
src/mod_fastcgi.c
src/mod_proxy.c
src/mod_scgi.c