openbmc / bmcweb

A do everything Redfish, KVM, GUI, and DBus webserver for OpenBMC
Apache License 2.0
154 stars 131 forks source link

Cannot upload large files (e.g. 1G in size) #231

Closed lzy1212003 closed 2 years ago

lzy1212003 commented 2 years ago

Describe the bug When uploading a large file(The file size is larger than the embedded system memory), the bmcweb process exits because the memory request fails

Environment linux embedded system df Filesystem 1K-blocks Used Available Use% Mounted on dev 220092 0 220092 0% /dev tmpfs 245960 62508 183452 25% /run ... tmpfs 245960 344 245616 0% /dev/shm tmpfs 245960 0 245960 0% /sys/fs/cgroup tmpfs 245960 8 245952 0% /tmp tmpfs 245960 12 245948 0% /var/volatile /dev/mmcblk0p1 2093048 4 2093044 0% /mnt

uname -a Linux eeff55ab 5.1.5-yocto-s-dirty-f8ff036 #1 Wed Jan 19 13:38:49 UTC 2022 armv6l GNU/Linux

What specific OpenBMC versions (SHA1) did you use? (note, SHA1 should be resolvable to https://github.com/openbmc/openbmc)

To Reproduce Steps to reproduce the behavior: 1、modify meson_options.txt option('http-body-limit', type: 'integer', min : 0, max : 2048, value : 1024, description : 'Specifies the http request body length limit') 2、mount sd card /mnt the capacity of sd card is 4G 3、upload 800M image file to /mnt through rest interface

Jan 20 07:57:11 N/A bmcweb[10838]: terminate called after throwing an instance of 'std::bad_alloc' Jan 20 07:57:11 N/A bmcweb[10838]: what(): std::bad_alloc Jan 20 07:57:11 N/A systemd[1]: bmcweb.service: Main process exited, code=killed, status=6/ABRT Jan 20 07:57:11 N/A systemd[1]: bmcweb.service: Failed with result 'signal'.

reason: when upload files, doRead will call boost::beast::http::async_read,This function writes the contents of the file into embedded system memory until the memory malloc fails

Is this a regression Has this behavior worked in the past? If yes, on which commit did it work, and what commit was broken?

it does not work on any commit

edtanous commented 2 years ago

Please don't ignore the bug template. It's there for a reason.

"linux embedded system" is not an appropriate answer to the environment section. Considering this behavior has configure options that are set on a per-system basis, we need to know what environment you actually used to help triage. Specifically, was http-body-limit set to the defaults? In its defaults, it should prevent this crash, and considering it has a max of 512MB, it's not clear if you've modified bmcweb to accept a larger parameter for that, or if you're on a totally different environment.

"To Reproduce" section is also not filled out.

"What specific OpenBMC versions (SHA1) did you use?" is also not filled out.

I'm going to close this for the time being. Please reopen when you've provided the details that the template requests.