Code Monkey home page Code Monkey logo

httpserver's People

Contributors

atanisoft avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

httpserver's Issues

HttpRequest::param(string, int) crashes if param value is not numeric

Incoming connection from 192.168.10.170, fd 53.
abort() was called at PC 0x400d66e3 on core 1
0x400d66e3: __cxa_end_catch at esp-idf/components/cxx/cxx_exception_stubs.cpp:13

ELF file SHA256: 2cde1b2b81f68a5e

Backtrace: 0x400873b0:0x3ffc74e0 0x400877a5:0x3ffc7500 0x400d66e3:0x3ffc7520 0x40196e39:0x3ffc7540 0x4010f005:0x3ffc7560 0x400edd4f:0x3ffc7590 0x401a8b27:0x3ffc76a0 0x40117157:0x3ffc76c0 0x4011b7fd:0x3ffc7710 0x4011b609:0x3ffc7740 0x401a9679:0x3ffc7770 0x40126f6f:0x3ffc7790
0x400873b0: invoke_abort at esp-idf/components/esp32/panic.c:157
0x400877a5: abort at esp-idf/components/esp32/panic.c:172
0x400d66e3: __cxa_end_catch at esp-idf/components/cxx/cxx_exception_stubs.cpp:13
0x40196e39: std::__throw_invalid_argument(char const*) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/src/c++11/functexcept.cc:74
0x4010f005: http::HttpRequest::param(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int) at xtensa-esp32-elf\include\c++\8.4.0\ext/string_conversions.h:83
 (inlined by) ?? at xtensa-esp32-elf\include\c++\8.4.0\bits/basic_string.h:6411
 (inlined by) http::HttpRequest::param(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int) at 
HttpServer/src/HttpRequest.cpp:273
0x400edd4f: process_config(http::HttpRequest*) at esp32commandstation\build/../main/WebServer.cpp:624 (discriminator 2)
0x401a8b27: std::_Function_handler<http::AbstractHttpResponse* (http::HttpRequest*), http::AbstractHttpResponse* (*)(http::HttpRequest*)>::_M_invoke(std::_Any_data const&, http::HttpRequest*&&) at xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:282
0x40117157: http::HttpRequestFlow::process_request_handler() at xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:687
 (inlined by) http::HttpRequestFlow::process_request_handler() at HttpServer/src/HttpRequestFlow.cpp:395
0x4011b7fd: StateFlowBase::run() at OpenMRNLite/src/executor/StateFlow.cpp:63 (discriminator 4)
0x4011b609: ExecutorBase::entry() at OpenMRNLite/src/executor/Executor.cpp:324
0x401a9679: OSThread::start(void*) at OpenMRNLite/src/os/OS.hxx:193
0x40126f6f: os_thread_start at OpenMRNLite/src/os/os.c:391

Websocket: handler is invoked for disconnect prior to connect

If the handshake process fails the websocket handler is being invoked during disconnect even though it has not been invoked for the connect event:

[WebSocket fd:52] read-error (22: Invalid argument), disconnecting (handshake)
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400ee4fb  PS      : 0x00060630  A0      : 0x800f0dd8  A1      : 0x3ffd2de0  
A2      : 0xfffffffc  A3      : 0x3ffb4864  A4      : 0x00000000  A5      : 0x3ffae9d8  
A6      : 0x00000000  A7      : 0x00000000  A8      : 0x800dd668  A9      : 0x3ffd2da0  
A10     : 0x00000001  A11     : 0x00000000  A12     : 0x3ffbc064  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x00000004  EXCCAUSE: 0x0000001c  
EXCVADDR: 0xfffffffc  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xfffffffc  

Backtrace:0x400ee4f8:0x3ffd2de0 0x400f0dd5:0x3ffd2e00 0x401a8bc5:0x3ffd2e60 0x40111392:0x3ffd2e80 0x401114a5:0x3ffd2eb0 0x4011d0ad:0x3ffd2ee0 0x4011ceb9:0x3ffd2f10 0x401a9829:0x3ffd2f40 0x40128727:0x3ffd2f60
0x400ee4f8: std::unique_ptr<WebSocketClient, std::default_delete<WebSocketClient> >::~unique_ptr() at xtensa-esp32-elf/include/c++/8.2.0/bits/unique_ptr.h:270

0x400f0dd5: process_websocket_event(http::WebSocketFlow*, http::WebSocketEvent, unsigned char const*, unsigned int) at xtensa-esp32-elf/include/c++/8.2.0/ext/new_allocator.h:140
 (inlined by) ?? at xtensa-esp32-elf/include/c++/8.2.0/bits/alloc_traits.h:487
 (inlined by) ?? at xtensa-esp32-elf/include/c++/8.2.0/bits/vector.tcc:165
 (inlined by) ?? at xtensa-esp32-elf/include/c++/8.2.0/bits/stl_vector.h:1318
 (inlined by) process_websocket_event(http::WebSocketFlow*, http::WebSocketEvent, unsigned char const*, unsigned int) at ESP32CommandStation/build/../main/WebServer.cpp:451
0x401a8bc5: std::_Function_handler<void (http::WebSocketFlow*, http::WebSocketEvent, unsigned char*, unsigned int), void (*)(http::WebSocketFlow*, http::WebSocketEvent, unsigned char const*, unsigned int)>::_M_invoke(std::_Any_data const&, http::WebSocketFlow*&&, http::WebSocketEvent&&, unsigned char*&&, unsigned int&&) at xtensa-esp32-elf/include/c++/8.2.0/bits/std_function.h:297
0x40111392: std::function<void (http::WebSocketFlow*, http::WebSocketEvent, unsigned char*, unsigned int)>::operator()(http::WebSocketFlow*, http::WebSocketEvent, unsigned char*, unsigned int) const at xtensa-esp32-elf/include/c++/8.2.0/bits/std_function.h:687
0x401114a5: http::WebSocketFlow::shutdown_connection() at ESP32CommandStation/build/../components/HttpServer/src/HttpRequestWebSocket.cpp:376
0x4011d0ad: StateFlowBase::run() at ESP32CommandStation/build/../components/OpenMRNLite/src/executor/StateFlow.cpp:63 (discriminator 4)
0x4011ceb9: ExecutorBase::entry() at ESP32CommandStation/build/../components/OpenMRNLite/src/executor/Executor.cpp:324
0x401a9829: OSThread::start(void*) at ESP32CommandStation/build/../components/OpenMRNLite/src/os/OS.hxx:193
0x40128727: os_thread_start at ESP32CommandStation/build/../components/OpenMRNLite/src/os/os.c:391

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

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

occasional assert from httpd shutdown

Restarting ESP32 Command Station
Error reading fd 50: (113) Software caused connection abort
Shutdown listening socket 80.
abort() was called at PC 0x40082cc8 on core 0
0x40082cc8: lock_acquire_generic at esp-idf/components/newlib/locks.c:143

ELF file SHA256: 8b6ec65b67d1811e

Backtrace: 0x400870bc:0x3ffbed70 0x400874b1:0x3ffbed90 0x40082cc8:0x3ffbedb0 0x40082de1:0x3ffbedf0 0x4019a415:0x3ffbee10 0x4019459d:0x3ffbf0d0 0x401944e9:0x3ffbf120 0x40117955:0x3ffbf150 0x401179b3:0x3ffbf180 0x4011c878:0x3ffbf1b0 0x401154ed:0x3ffbf1d0 0x40116295:0x3ffbf1f0 0x400da732:0x3ffbf220 0x400d3757:0x3ffbfbc0
0x400870bc: invoke_abort at esp-idf/components/esp32/panic.c:157
0x400874b1: abort at esp-idf/components/esp32/panic.c:172
0x40082cc8: lock_acquire_generic at esp-idf/components/newlib/locks.c:143
0x40082de1: _lock_acquire_recursive at esp-idf/components/newlib/locks.c:171
0x4019a415: _vfiprintf_r at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c:853 (discriminator 2)
0x4019459d: fiprintf at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/fiprintf.c:48
0x401944e9: __assert_func at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdlib/assert.c:58 (discriminator 8)
0x40117955: QList<1u>::insert(QMember*, unsigned int) at ESP32CommandStation/build/../components/OpenMRNLite/src/utils/Queue.hxx:148
 (inlined by) ?? at ESP32CommandStation/build/../components/OpenMRNLite/src/utils/Queue.hxx:498
 (inlined by) QList<1u>::insert(QMember*, unsigned int) at ESP32CommandStation/build/../components/OpenMRNLite/src/utils/Queue.hxx:485
0x401179b3: Executor<1u>::add(Executable*, unsigned int) at ESP32CommandStation/build/../components/OpenMRNLite/src/executor/Executor.hxx:308 (discriminator 4)
0x4011c878: ExecutorBase::shutdown() at ESP32CommandStation/build/../components/OpenMRNLite/src/executor/Executor.cpp:433
0x401154ed: Executor<1u>::~Executor() at ESP32CommandStation/build/../components/OpenMRNLite/src/executor/Executor.hxx:413
0x40116295: http::Httpd::~Httpd() at ESP32CommandStation/build/../components/Esp32HttpServer/HttpServer.cpp:78
0x400da732: app_main at ESP32CommandStation/build/../main/ESP32CommandStation.cpp:251
0x400d3757: main_task at esp-idf/components/esp32/cpu_start.c:553

Rebooting...

WS: Rework to queue frames rather than use a string buffer for text messages

The current approach can lead to out-of-sequence deliveries leading to the following error being shown in the browser when multiple text based messages are being sent in excess of the maximum frame size:

index.html:336 WebSocket connection to 'ws://10.0.0.189/ws' failed: Received start of new message but previous message is unfinished.
connectWebSocket @ index.html:336
index.html:343 WS: Event
(anonymous) @ index.html:343
index.html:346 WS: CloseEvent

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.