__cxa_allocate_exception

RipperR
Posts: 1
Joined: Wed Feb 21, 2024 10:28 am

__cxa_allocate_exception

Postby RipperR » Wed Feb 21, 2024 10:51 am

Hi everyone i have issue with that exeception is any way to catch it in try catch block to avoid abort() ? My app randomly crash in random places but almost evry where i got that block of backtrace

Code: Select all


abort() was called at PC 0x40156e93 on core 0





Backtrace: 0x40083799:0x3ffcf8c0 0x4008da99:0x3ffcf8e0 0x40092e11:0x3ffcf900 0x40156e93:0x3ffcf980 0x40156eda:0x3ffcf9a0 0x401571a1:0x3ffcf9c0 0x40157258:0x3ffcf9e0 0x400d35c9:0x3ffcfa00 0x400d4c6a:0x3ffcfa60 0x400d4d9a:0x3ffcfac0 0x400da0a2:0x3ffcfb00


  #0  0x40083799:0x3ffcf8c0 in [b]panic_abort[/b] at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:408
  #1  0x4008da99:0x3ffcf8e0 in [b]esp_system_abort[/b] at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:137
  #2  0x40092e11:0x3ffcf900 in [b]abort[/b] at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/abort.c:46
  #3  0x40156e93:0x3ffcf980 in __cxxabiv1::__terminate(void (*)()) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:47
  #4  0x40156eda:0x3ffcf9a0 in std::terminate() at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:57
  #5  0x401571a1:0x3ffcf9c0 in [b]__cxa_allocate_exception[/b] at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_alloc.cc:300
  #6  0x40157258:0x3ffcf9e0 in 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
  #7  0x400d35c9:0x3ffcfa00 in std::_Function_base::_Base_manager<std::_Bind<String const& (Alarm::*(Alarm*, String))(String const&) const> >::_M_init_functor(std::_Any_data&, std::_Bind<String const& (Alarm::*(Alarm*, String))(String const&) const>&&, std::integral_constant<bool, false>) at c:\users\cubei7\.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:249

      (inlined by) std::_Function_base::_Base_manager<std::_Bind<String const& (Alarm::*(Alarm*, String))(String const&) const> >::_M_init_functor(std::_Any_data&, std::_Bind<String const& (Alarm::*(Alarm*, String))(String const&) const>&&) at c:\users\cubei7\.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:220

      (inlined by) std::function<String (String)>::function<std::_Bind<String const& (Alarm::*(Alarm*, String))(String const&) const>, void, void>(std::_Bind<String const& (Alarm::*(Alarm*, String))(String const&) const>) at c:\users\cubei7\.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:674

      (inlined by) std::enable_if<std::function<String (String)>::_Callable<std::decay<std::_Bind<String const& (Alarm::*(Alarm*, String))(String const&) const> >::type, std::result_of<std::decay<std::_Bind<String const& (Alarm::*(Alarm*, String))(String const&) const> >::type& (String)>::type>::value, std::function<String (String)>&>::type std::function<String (String)>::operator=<std::_Bind<String const& (Alarm::*(Alarm*, String))(String const&) const> >(std::_Bind<String const& (Alarm::*(Alarm*, String))(String const&) const>&&) at c:\users\cubei7\.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:524
  #8  0x400d4c6a:0x3ffcfa60 in Alarm::Alarm(String const&, extra_data const&) at src/alarm.cpp:22
  #9  0x400d4d9a:0x3ffcfac0 in void __gnu_cxx::new_allocator<Alarm>::construct<Alarm, __FlashStringHelper const*, extra_data&>(Alarm*, __FlashStringHelper const*&&, extra_data&) at c:\users\cubei7\.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\ext/new_allocator.h:136

      (inlined by) void std::allocator_traits<std::allocator<Alarm> >::construct<Alarm, __FlashStringHelper const*, extra_data&>(std::allocator<Alarm>&, Alarm*, __FlashStringHelper const*&&, extra_data&) at c:\users\cubei7\.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/alloc_traits.h:475

      (inlined by) std::_Sp_counted_ptr_inplace<Alarm, std::allocator<Alarm>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<__FlashStringHelper const*, extra_data&>(std::allocator<Alarm>, __FlashStringHelper const*&&, extra_data&) at c:\users\cubei7\.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/shared_ptr_base.h:545

      (inlined by) std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<Alarm, std::allocator<Alarm>, __FlashStringHelper const*, extra_data&>(Alarm*&, std::_Sp_alloc_shared_tag<std::allocator<Alarm> >, __FlashStringHelper const*&&, extra_data&) at c:\users\cubei7\.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/shared_ptr_base.h:677

      (inlined by) std::__shared_ptr<Alarm, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<Alarm>, __FlashStringHelper const*, extra_data&>(std::_Sp_alloc_shared_tag<std::allocator<Alarm> >, __FlashStringHelper const*&&, extra_data&) at c:\users\cubei7\.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/shared_ptr_base.h:1342

      (inlined by) std::shared_ptr<Alarm>::shared_ptr<std::allocator<Alarm>, __FlashStringHelper const*, extra_data&>(std::_Sp_alloc_shared_tag<std::allocator<Alarm> >, __FlashStringHelper const*&&, extra_data&) at c:\users\cubei7\.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/shared_ptr.h:359

      (inlined by) std::shared_ptr<Alarm> std::allocate_shared<Alarm, std::allocator<Alarm>, __FlashStringHelper const*, extra_data&>(std::allocator<Alarm> const&, __FlashStringHelper const*&&, extra_data&) at c:\users\cubei7\.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/shared_ptr.h:706

      (inlined by) std::shared_ptr<Alarm> std::make_shared<Alarm, __FlashStringHelper const*, extra_data&>(__FlashStringHelper const*&&, extra_data&) at c:\users\cubei7\.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/shared_ptr.h:722
  #10 0x400da0a2:0x3ffcfb00 in taskFunctionProbe(void*) at src/main.cpp:677

Code: Select all

          try{
            std::unique_lock<std::mutex> alarm_lock(alarm_vector_mutex);       
            alarm_messages.push_back(std::make_shared<Alarm>(F("AC_POWER_ON"), _extra_data));      <= src/main.cpp:677                            //CREATE ALARM MESSAGE
            alarm_lock.unlock();
            alarm_cv.notify_all();                                                                                            //ALARM TRIGGER 
          }catch(const std::exception &ex){
            custom_logger.SET_NEW_MESSAGE(voltmetr_path, 
            "CANT CREATE ALARM MESSAGE !!! [E]" + String(ex.what()), CONSOLE_LOG::FAILURE);
            return;
          }

Code: Select all

Alarm::Alarm(const String& _alarm_event_type, const extra_data& _extra_data_struct) {
    
    if (_alarm_event_type.isEmpty() || _extra_data_struct.alarm_event_datetime < 0) {
    throw std::runtime_error("ALARM INCORRECT DATA extra_data");
    }

alarm_event_type = _alarm_event_type;
_extra_data.reserve(300);
_extra_data = CreateExtraData(_extra_data_struct);
alarmHandler["AC_POWER_ON"] = std::bind(&Alarm::AlarmHandlerAcPowerOn, this, _extra_data);
alarmHandler["AC_POWER_OFF"] = std::bind(&Alarm::AlarmHandlerAcPowerOff, this, _extra_data);
alarmHandler["CONNECTION_LOST"] = std::bind(&Alarm::AlarmHandleryConnectionLost, this, _extra_data);
alarmHandler["DOOR"] = std::bind(&Alarm::AlarmHandlerDoor, this, _extra_data);
alarmHandler["SITE_UP"] = std::bind(&Alarm::AlarmHandlerUP, this, _extra_data);  <= at src/alarm.cpp:22

}
but verystrange that if it call src/main.cpp:677 should alarmHandler["AC_POWER_ON"] = std::bind(&Alarm::AlarmHandlerAcPowerOn, this, _extra_data); Im almost slice half of my app for localize problem part but issue still that app can work for 2 days to several hours to crash (((

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: __cxa_allocate_exception

Postby ESP_Sprite » Thu Feb 22, 2024 2:35 pm

Fyi, if you haven't deduced it yet, you get those exceptions because you're running out of RAM.

Who is online

Users browsing this forum: No registered users and 46 guests