Project

General

Profile

Bug #1265

SSL + file upload = lots of memory

Added by mlcreech over 9 years ago. Updated 9 months ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
core
Target version:
Start date:
Due date:
% Done:

100%

Missing in 1.5.x:

Description

I'm using lighttpd (1.4.15) in an embedded device, and attempting to upload a file (~6MB). Without SSL enabled, lighttpd doesn't use much more than 6-7MB (lighttpd process grows by <1MB, ~6MB are written to /tmp). With SSL enabled, lighttpd's memory usage quickly jumps to over 26MB (lighttpd process grows to 20+MB, ~6MB are written to /tmp), exhausting all available memory and bringing the device to a grinding halt.

I also noticed that the <1MB of extra size on a non-SSL upload goes away once the upload is complete; in contrast, if I upload a smaller file (900kB) via SSL, the process size grows by ~7MB and stays that large, even after the connection is closed. However, uploading a similarly-sized file again does not cause it to grow any larger, i.e. the memory doesn't seem to be permanently leaked.

I found this ticket:

http://trac.lighttpd.net/trac/ticket/881

which sounds somewhat similar, but no additional information was ever posted about a potential cause. Any ideas? Thanks!

04-limit-ssl-mem.patch View - File which fixes this on my system (though it's probably not a "proper" fix) (1.14 KB) mlcreech, 2007-07-25 17:43


Related issues

Related to Bug #881: memory usage when ssl.engine used and large data uploaded through CGI Fixed
Related to Bug #949: fastcgi, cgi, flush, php5 problem. Fixed

Associated revisions

Revision 5ab7944d (diff)
Added by gstrauss 9 months ago

[TLS] release openssl buffers as used (fixes #1265, fixes #1283, #881)

use SSL_MODE_RELEASE_BUFFERS (OpenSSL >= 1.0.0) to free buffers
as they are used, to potentially reduce memory footprint of
idle SSL connections

x-ref:
"memory usage when ssl.engine used and large data uploaded through CGI"
https://redmine.lighttpd.net/issues/881
"SSL + file upload = lots of memory"
https://redmine.lighttpd.net/issues/1265
"Memory usage increases when proxy+ssl+large file"
https://redmine.lighttpd.net/issues/1283

History

#1 Updated by Anonymous over 9 years ago

Someone should remove the Propaganda: najdyh-najd-al7oob43.gif

#2 Updated by Anonymous over 8 years ago

I have exactly the same problem.
Though, I'm not entirely sure that it's really a bug - if it is, is there going to be a fix for this?

#3 Updated by stbuehler over 8 years ago

  • Status changed from New to Fixed
  • Resolution set to wontfix

I don't think we want this patch upstream (i don't think it will perform well), but you may use it for embedded systems of course to safe a little bit memory.

#4 Updated by stbuehler over 8 years ago

  • Status changed from Fixed to Wontfix

#5 Updated by gstrauss 10 months ago

  • Related to Bug #881: memory usage when ssl.engine used and large data uploaded through CGI added

#6 Updated by gstrauss 10 months ago

  • Related to Bug #949: fastcgi, cgi, flush, php5 problem. added

#7 Updated by gstrauss 10 months ago

  • Description updated (diff)
  • Status changed from Wontfix to Patch Pending
  • Target version changed from 1.5.0 to 1.4.40

New: asynchronous, bidirectional streaming support for request and response
Submitted pull request: https://github.com/lighttpd/lighttpd1.4/pull/66

included in the pull request are flags to openssl (SSL_MODE_RELEASE_BUFFERS) to release memory buffers when finished with them, instead of holding onto the buffers.

#8 Updated by gstrauss 9 months ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100

Also available in: Atom