Project

General

Profile

[Solved] lighttpd upload 32M file with openssl, but OOM failed

Added by Actionpoint about 1 month ago

Hi,

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?


Replies (6)

RE: lighttpd upload 32M file with openssl, but OOM failed - Added by Actionpoint about 1 month ago

Oh,
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!

RE: lighttpd upload 32M file with openssl, but OOM failed - Added by avij about 1 month ago

Newer versions do indeed have more options to control memory usage in such situations. Perhaps you should consider upgrading.

RE: lighttpd upload 32M file with openssl, but OOM failed - Added by Actionpoint about 1 month ago

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?

RE: lighttpd upload 32M file with openssl, but OOM failed - Added by avij about 1 month ago

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.

RE: [Solved] lighttpd upload 32M file with openssl, but OOM failed - Added by gstrauss 23 days ago

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" 

    (1-6/6)