atanisoft / HttpServer

HTTP Server implemented using OpenMRN StateFlow patterns.
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Out-of-memory issue when allocating a http request header buffer #6

Open TrainzLuvr opened 4 years ago

TrainzLuvr commented 4 years ago

Trying to setup a 512 byte buffer for reading the http request headers and failing to allocate it.

There could be an IDF setting that can be used to suppress the abort() call and instead just return nullptr.

stack:
0x40089235: esp_system_abort at C:/espressif/esp-idf/components/esp_system/system_api.c:106
0x4008fbfd: abort at C:/espressif/esp-idf/components/newlib/abort.c:46
0x400d5d13: __cxa_end_catch at C:/espressif/esp-idf/components/cxx/cxx_exception_stubs.cpp:13
0x40195331: operator new(unsigned int) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/new_op.cc:54
0x400f18de: std::vector<unsigned char, std::allocator<unsigned char> >::_M_default_append(unsigned int) at c:\espressif\tools\xtensa-esp32-elf\esp-2020r2-8.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\8.2.0\ext/new_allocator.h:111
  \-> inlined by: ?? at c:\espressif\tools\xtensa-esp32-elf\esp-2020r2-8.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\8.2.0\bits/alloc_traits.h:436
  \-> inlined by: ?? at c:\espressif\tools\xtensa-esp32-elf\esp-2020r2-8.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\8.2.0\bits/stl_vector.h:296
  \-> inlined by: std::vector<unsigned char, std::allocator<unsigned char> >::_M_default_append(unsigned int) at c:\espressif\tools\xtensa-esp32-elf\esp-2020r2-8.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\8.2.0\bits/vector.tcc:604
0x4011686a: http::HttpRequestFlow::start_request() at c:\espressif\tools\xtensa-esp32-elf\esp-2020r2-8.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\8.2.0\bits/stl_vector.h:827
  \-> inlined by: http::HttpRequestFlow::start_request() at r:\code\esp32commandstation\build/../components/HttpServer/src/HttpRequestFlow.cpp:83
0x401194d1: StateFlowBase::run() at r:\code\esp32commandstation\build/../components/OpenMRNLite/src/executor/StateFlow.cpp:63 (discriminator 4)
0x401192dd: ExecutorBase::entry() at r:\code\esp32commandstation\build/../components/OpenMRNLite/src/executor/Executor.cpp:324
0x401a7985: OSThread::start(void*) at r:\code\esp32commandstation\build/../components/OpenMRNLite/src/os/OS.hxx:193
0x40125703: os_thread_start at r:\code\esp32commandstation\build/../components/OpenMRNLite/src/os/os.c:391
atanisoft commented 4 years ago

Partially addressed via https://github.com/atanisoft/HttpServer/commit/35230a02be32ccdada5f41c5d00489f1c07f9b83