[Solved] lighttpd upload 32M file with openssl, but OOM failed
I'm new here. I face a problem, and wonder to clarify it.
Can I consult with somebody?
I am using lighttpd-1.4.X on a small embedded platform, it has 85MB free Memory.
I need to upload a file(the size of file is 32MB). After executing, it failed because OOM error.
So I do the other test, upload a 10MB file. After success, I found my free memory lose(?) 10MB.
As far as I know, during read data from ssl, it will put data into chunk memory. Then write those data into temp file(cache memory).
During the process, it needs 2*filesize memory, right?
Until all data write done, it will remove finished chunk. And finally, delete temp file.
So, I thought after result, my memory shouldn't lose 10MB(sizeof my file).
Can somebody help me?
Please see https://redmine.lighttpd.net/boards/2/topics/7520 for a similar problem.
My lighttpd version is 1.4.35, I know it is too old.
So, base on your version, after upload file(larger than 64Kb), it will not lose memory?
Thank you for all your assistance!
Newer versions do indeed have more options to control memory usage in such situations. Perhaps you should consider upgrading.
Thanks for your advice.
I have the other question,
does function chunkqueue_remove_finished_chunks(), will release memory which was alloc during read file form ssl?
I don't know about that (I'm not a developer), but I believe setting
ssl.read-ahead = "disable" and
server.stream-request-body = 1 (or perhaps
server.stream-request-body = 2) would solve your problem on a more recent lighttpd version.
As noted by avij, the following is recommended for small memory systems using a modern version of lighttpd and https (TLS/SSL)
server.stream-request-body = 2 ssl.read-ahead = "disable"