Sanity check: Heap corruptions in latest ESP-IDF?

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Sanity check: Heap corruptions in latest ESP-IDF?

Postby permal » Wed Jan 31, 2018 11:23 pm

Hi,

I've had this code that has been running for days without interruption, but after updating ESP-IDF and the tool chain I'm getting crashes with stack traces like the those below. I am well aware that this might very well be something that has been latent in my own code and I'm not pointing fingers, I just want to see if anyone else has experienced an increase in heap corruptions after updating ESP-IDF lately? As you all know, debugging these issues are a real pain so any leads are helpful.

I'm running:
ESP-IDF daa8cfa800677a71a3447eba418a4336979a3cb8
Tool chain: crosstool-ng-1.22.0-80-g6c4433a

Update: Not sure if this info adds anything, but I'm adding it just in case. I realized now that the device is running in a new use case compared to previously, which causes *alot* of strings to be copied, which is actually reflected by three of the four stack traces below.

Code: Select all

assertion "res == coreID || res == portMUX_FREE_VAL" failed: file "/home/permal/esp/esp-idf/components/freertos/./portmux_impl.h", line 105, function: vPortCPUAcquireMutexIntsDisabled
abort() was called at PC 0x4012c11b on core 0
0x4012c11b: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:135
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:170
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:179
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:544
 (inlined by) Idle::Idle(AlarmFSM<AlarmBaseState>&) at /home/permal/code/G2-Alarmsystem/main/states/Idle.h:10
 (inlined by) Tripped::disarm() at /home/permal/code/G2-Alarmsystem/main/states/Tripped.cpp:37


Backtrace: 0x400890fc:0x3ffd60b0 0x4008929f:0x3ffd60d0 0x4012c11b:0x3ffd60f0 0x400865eb:0x3ffd6120 0x40085abc:0x3ffd6140 0x400fc5a9:0x3ffd6180 0x400fe494:0x3ffd61a0 0x40165cf2:0x3ffd6210 0x4015e94f:0x3ffd6430 0x4015eb2d:0x3ffd6560 0x401a119d:0x3ffd6580 0x4013c44f:0x3ffd65b0
0x400890fc: invoke_abort at /home/permal/esp/esp-idf/components/esp32/./panic.c:648

0x4008929f: abort at /home/permal/esp/esp-idf/components/esp32/./panic.c:648

0x4012c11b: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:135
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:170
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:179
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:544
 (inlined by) Idle::Idle(AlarmFSM<AlarmBaseState>&) at /home/permal/code/G2-Alarmsystem/main/states/Idle.h:10
 (inlined by) Tripped::disarm() at /home/permal/code/G2-Alarmsystem/main/states/Tripped.cpp:37

0x400865eb: vPortCPUAcquireMutexIntsDisabled at /home/permal/esp/esp-idf/components/freertos/./tasks.c:4702
 (inlined by) vTaskEnterCritical at /home/permal/esp/esp-idf/components/freertos/./tasks.c:4216

0x40085abc: xQueueGenericReceive at /home/permal/esp/esp-idf/components/freertos/./queue.c:2037

0x400fc5a9: sys_mutex_unlock at /home/permal/esp/esp-idf/components/lwip/port/freertos/sys_arch.c:548

0x400fe494: lwip_select at /home/permal/esp/esp-idf/components/lwip/api/sockets.c:3309

0x40165cf2: smooth::core::network::SocketDispatcher::check_socket_send_timeout() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/forward_list.h:330

0x4015e94f: smooth::core::Task::exec() at /home/permal/code/G2-Alarmsystem/components/Smooth/core/Task.cpp:85

0x4015eb2d: smooth::core::timer::ElapsedTime::zero() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/timer/ElapsedTime.h:46
 (inlined by) smooth::core::timer::ElapsedTime::start() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/timer/ElapsedTime.h:25
 (inlined by) smooth::core::timer::ElapsedTime::reset() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/timer/ElapsedTime.h:40
 (inlined by) smooth::core::Task::exec() at /home/permal/code/G2-Alarmsystem/components/Smooth/core/Task.cpp:137

0x401a119d: esp_aes_release_hardware at /home/permal/esp/esp-idf/components/esp32/hwcrypto/aes.c:75

0x4013c44f: pthread_setspecific at /home/permal/esp/esp-idf/components/pthread/./pthread_local_storage.c:215


CPU halted.

Code: Select all

CORRUPT HEAP: Bad tail at 0x3ffe0ccc. Expected 0xbaad5678 got 0xcececece
assertion "head != NULL" failed: file "/home/permal/esp/esp-idf/cCORRUPT HEAP: multi_heap.c:370 detected at 0x3ffe0cd0
abort() was called at PC 0x400889af on core 1
0x400889af: multi_heap_assert at /home/permal/esp/esp-idf/components/heap/./multi_heap.c:339
 (inlined by) multi_heap_malloc_impl at /home/permal/esp/esp-idf/components/heap/./multi_heap.c:370


Backtrace: 0x400890fc:0x3ffdf680 0x4008929f:0x3ffdf6a0 0x400889af:0x3ffdf6c0 0x40088d51:0x3ffdf6e0 0x40082e80:0x3ffdf700 0x40082eb1:0x3ffdf720 0x40083355:0x3ffdf740 0x4000beaf:0x3ffdf760 0x4018ad39:0x3ffdf780 0x4018bb77:0x3ffdf7a0 0x401717dd:0x3ffdf7e0 0x401745a7:0x3ffdf820 0x4017480a:0x3ffdf8a0 0x4012b99a:0x3ffdf8c0 0x40127e50:0x3ffdf900 0x40127ea0:0x3ffdf970 0x401274ed:0x3ffdf990 0x401274fe:0x3ffdf9c0 0x4015e97a:0x3ffdf9e0 0x4015eb2d:0x3ffdfb10 0x401a119d:0x3ffdfb30 0x4013c44f:0x3ffdfb60
0x400890fc: invoke_abort at /home/permal/esp/esp-idf/components/esp32/./panic.c:648

0x4008929f: abort at /home/permal/esp/esp-idf/components/esp32/./panic.c:648

0x400889af: multi_heap_assert at /home/permal/esp/esp-idf/components/heap/./multi_heap.c:339
 (inlined by) multi_heap_malloc_impl at /home/permal/esp/esp-idf/components/heap/./multi_heap.c:370

0x40088d51: multi_heap_malloc at /home/permal/esp/esp-idf/components/heap/./multi_heap_poisoning.c:339

0x40082e80: heap_caps_malloc at /home/permal/esp/esp-idf/components/heap/./heap_caps.c:136

0x40082eb1: heap_caps_malloc_default at /home/permal/esp/esp-idf/components/heap/./heap_caps.c:136

0x40083355: _free_r at /home/permal/esp/esp-idf/components/newlib/./syscalls.c:42

0x4018ad39: i2c_reset_tx_fifo at /home/permal/esp/esp-idf/components/driver/./i2c.c:778

0x4018bb77: i2c_master_read at /home/permal/esp/esp-idf/components/driver/./i2c.c:1005

0x401717dd: smooth::core::logging::BaseArg::~BaseArg() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/logging/log.h:18
 (inlined by) smooth::core::logging::BaseArgWithData::~BaseArgWithData() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/logging/log.h:29
 (inlined by) smooth::core::logging::Int32::~Int32() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/logging/log.h:83
 (inlined by) smooth::core::io::i2c::I2CMasterDevice::log_error(int, char const*) at /home/permal/code/G2-Alarmsystem/components/Smooth/core/io/i2c/I2CMasterDevice.cpp:176

0x401745a7: std::_Vector_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_allocate(unsigned int) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_vector.h:170
 (inlined by) void std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_emplace_back_aux<char*&>(char*&) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/vector.tcc:412

0x4017480a: unsigned int const& std::max<unsigned int>(unsigned int const&, unsigned int const&) at /home/permal/code/G2-Alarmsystem/components/Smooth/application/io/ADS1115.cpp:104
 (inlined by) smooth::core::util::FixedBuffer<unsigned char, 2u>::operator[](unsigned int) at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/util/FixedBuffer.h:51
 (inlined by) smooth::application::io::ADS1115::read_conversion(unsigned short&) at /home/permal/code/G2-Alarmsystem/components/Smooth/application/io/ADS1115.cpp:115

0x4012b99a: __gnu_cxx::new_allocator<char>::deallocate(char*, unsigned int) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/ext/new_allocator.h:110
 (inlined by) std::allocator_traits<std::allocator<char> >::deallocate(std::allocator<char>&, char*, unsigned int) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/alloc_traits.h:386
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_destroy(unsigned int) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:185
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:180
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:544
 (inlined by) ArmByNumber::number(int) at /home/permal/code/G2-Alarmsystem/main/./ArmByNumber.cpp:30

0x40127e50: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/forward_list.h:330
 (inlined by) smooth::core::logging::Bool::Bool(bool) at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/logging/log.h:133
 (inlined by) I2CTask::init() at /home/permal/code/G2-Alarmsystem/main/./I2CTask.cpp:56

0x40127ea0: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/forward_list.h:330
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:170
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:179
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:544
 (inlined by) smooth::core::logging::Bool::Bool(bool) at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/logging/log.h:133
 (inlined by) I2CTask::init() at /home/permal/code/G2-Alarmsystem/main/./I2CTask.cpp:56

0x401274ed: smooth::core::ipc::TaskEventQueue<I2CSetOutput>::size() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/forward_list.h:330

0x401274fe: std::mutex::lock() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/forward_list.h:330
 (inlined by) std::lock_guard<std::mutex>::lock_guard(std::mutex&) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/mutex:377
 (inlined by) smooth::core::ipc::Queue<I2CSetOutput>::size() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/ipc/Queue.h:61
 (inlined by) smooth::core::ipc::TaskEventQueue<I2CSetOutput>::size() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/ipc/TaskEventQueue.h:64

0x4015e97a: std::unique_lock<std::mutex>::~unique_lock() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/mutex:441
 (inlined by) smooth::core::Task::exec() at /home/permal/code/G2-Alarmsystem/components/Smooth/core/Task.cpp:89

0x4015eb2d: smooth::core::timer::ElapsedTime::zero() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/timer/ElapsedTime.h:46
 (inlined by) smooth::core::timer::ElapsedTime::start() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/timer/ElapsedTime.h:25
 (inlined by) smooth::core::timer::ElapsedTime::reset() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/timer/ElapsedTime.h:40
 (inlined by) smooth::core::Task::exec() at /home/permal/code/G2-Alarmsystem/components/Smooth/core/Task.cpp:137

0x401a119d: esp_aes_release_hardware at /home/permal/esp/esp-idf/components/esp32/hwcrypto/aes.c:75

0x4013c44f: pthread_setspecific at /home/permal/esp/esp-idf/components/pthread/./pthread_local_storage.c:215


CPU halted.

Code: Select all

CORRUPT HEAP: Bad tail at 0x3ffe0ccc. Expected 0xbaad5678 got 0xcececece
assertion "head != NULL" failed: file "/home/permal/esp/esp-idf/cCORRUPT HEAP: multi_heap.c:370 detected at 0x3ffe0cd0
abort() was called at PC 0x400889af on core 1
0x400889af: multi_heap_assert at /home/permal/esp/esp-idf/components/heap/./multi_heap.c:339
 (inlined by) multi_heap_malloc_impl at /home/permal/esp/esp-idf/components/heap/./multi_heap.c:370


Backtrace: 0x400890fc:0x3ffdf680 0x4008929f:0x3ffdf6a0 0x400889af:0x3ffdf6c0 0x40088d51:0x3ffdf6e0 0x40082e80:0x3ffdf700 0x40082eb1:0x3ffdf720 0x40083355:0x3ffdf740 0x4000beaf:0x3ffdf760 0x4018ad39:0x3ffdf780 0x4018bb77:0x3ffdf7a0 0x401717dd:0x3ffdf7e0 0x401745a7:0x3ffdf820 0x4017480a:0x3ffdf8a0 0x4012b99a:0x3ffdf8c0 0x40127e50:0x3ffdf900 0x40127ea0:0x3ffdf970 0x401274ed:0x3ffdf990 0x401274fe:0x3ffdf9c0 0x4015e97a:0x3ffdf9e0 0x4015eb2d:0x3ffdfb10 0x401a119d:0x3ffdfb30 0x4013c44f:0x3ffdfb60
0x400890fc: invoke_abort at /home/permal/esp/esp-idf/components/esp32/./panic.c:648

0x4008929f: abort at /home/permal/esp/esp-idf/components/esp32/./panic.c:648

0x400889af: multi_heap_assert at /home/permal/esp/esp-idf/components/heap/./multi_heap.c:339
 (inlined by) multi_heap_malloc_impl at /home/permal/esp/esp-idf/components/heap/./multi_heap.c:370

0x40088d51: multi_heap_malloc at /home/permal/esp/esp-idf/components/heap/./multi_heap_poisoning.c:339

0x40082e80: heap_caps_malloc at /home/permal/esp/esp-idf/components/heap/./heap_caps.c:136

0x40082eb1: heap_caps_malloc_default at /home/permal/esp/esp-idf/components/heap/./heap_caps.c:136

0x40083355: _free_r at /home/permal/esp/esp-idf/components/newlib/./syscalls.c:42

0x4018ad39: i2c_reset_tx_fifo at /home/permal/esp/esp-idf/components/driver/./i2c.c:778

0x4018bb77: i2c_master_read at /home/permal/esp/esp-idf/components/driver/./i2c.c:1005

0x401717dd: smooth::core::logging::BaseArg::~BaseArg() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/logging/log.h:18
 (inlined by) smooth::core::logging::BaseArgWithData::~BaseArgWithData() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/logging/log.h:29
 (inlined by) smooth::core::logging::Int32::~Int32() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/logging/log.h:83
 (inlined by) smooth::core::io::i2c::I2CMasterDevice::log_error(int, char const*) at /home/permal/code/G2-Alarmsystem/components/Smooth/core/io/i2c/I2CMasterDevice.cpp:176

0x401745a7: std::_Vector_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_allocate(unsigned int) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_vector.h:170
 (inlined by) void std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_emplace_back_aux<char*&>(char*&) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/vector.tcc:412

0x4017480a: unsigned int const& std::max<unsigned int>(unsigned int const&, unsigned int const&) at /home/permal/code/G2-Alarmsystem/components/Smooth/application/io/ADS1115.cpp:104
 (inlined by) smooth::core::util::FixedBuffer<unsigned char, 2u>::operator[](unsigned int) at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/util/FixedBuffer.h:51
 (inlined by) smooth::application::io::ADS1115::read_conversion(unsigned short&) at /home/permal/code/G2-Alarmsystem/components/Smooth/application/io/ADS1115.cpp:115

0x4012b99a: __gnu_cxx::new_allocator<char>::deallocate(char*, unsigned int) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/ext/new_allocator.h:110
 (inlined by) std::allocator_traits<std::allocator<char> >::deallocate(std::allocator<char>&, char*, unsigned int) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/alloc_traits.h:386
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_destroy(unsigned int) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:185
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:180
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:544
 (inlined by) ArmByNumber::number(int) at /home/permal/code/G2-Alarmsystem/main/./ArmByNumber.cpp:30

0x40127e50: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/forward_list.h:330
 (inlined by) smooth::core::logging::Bool::Bool(bool) at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/logging/log.h:133
 (inlined by) I2CTask::init() at /home/permal/code/G2-Alarmsystem/main/./I2CTask.cpp:56

0x40127ea0: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/forward_list.h:330
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:170
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:179
 (inlined by) std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/basic_string.h:544
 (inlined by) smooth::core::logging::Bool::Bool(bool) at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/logging/log.h:133
 (inlined by) I2CTask::init() at /home/permal/code/G2-Alarmsystem/main/./I2CTask.cpp:56

0x401274ed: smooth::core::ipc::TaskEventQueue<I2CSetOutput>::size() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/forward_list.h:330

0x401274fe: std::mutex::lock() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/forward_list.h:330
 (inlined by) std::lock_guard<std::mutex>::lock_guard(std::mutex&) at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/mutex:377
 (inlined by) smooth::core::ipc::Queue<I2CSetOutput>::size() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/ipc/Queue.h:61
 (inlined by) smooth::core::ipc::TaskEventQueue<I2CSetOutput>::size() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/ipc/TaskEventQueue.h:64

0x4015e97a: std::unique_lock<std::mutex>::~unique_lock() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/mutex:441
 (inlined by) smooth::core::Task::exec() at /home/permal/code/G2-Alarmsystem/components/Smooth/core/Task.cpp:89

0x4015eb2d: smooth::core::timer::ElapsedTime::zero() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/timer/ElapsedTime.h:46
 (inlined by) smooth::core::timer::ElapsedTime::start() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/timer/ElapsedTime.h:25
 (inlined by) smooth::core::timer::ElapsedTime::reset() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/timer/ElapsedTime.h:40
 (inlined by) smooth::core::Task::exec() at /home/permal/code/G2-Alarmsystem/components/Smooth/core/Task.cpp:137

0x401a119d: esp_aes_release_hardware at /home/permal/esp/esp-idf/components/esp32/hwcrypto/aes.c:75

0x4013c44f: pthread_setspecific at /home/permal/esp/esp-idf/components/pthread/./pthread_local_storage.c:215


CPU halted.

Code: Select all

Guru Meditation Error: Core  0 panic'ed (LoadProhibited)
. Exception was unhandled.
Core 0 register dump:
PC      : 0x40165213  PS      : 0x00060a30  A0      : 0x80165cc5  A1      : 0x3ffd5f90  
0x40165213: std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/forward_list.h:330
 (inlined by) std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:659
 (inlined by) std::__shared_ptr<smooth::core::network::ISocket, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:925
 (inlined by) std::shared_ptr<smooth::core::network::ISocket>::~shared_ptr() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr.h:93
 (inlined by) std::pair<int, std::shared_ptr<smooth::core::network::ISocket> >::~pair() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_pair.h:96
 (inlined by) operator()<std::_Rb_tree_iterator<std::pair<int const, std::shared_ptr<smooth::core::network::ISocket> > > > at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/predefined_ops.h:234
 (inlined by) __find_if<std::_Rb_tree_iterator<std::pair<int const, std::shared_ptr<smooth::core::network::ISocket> > >, __gnu_cxx::__ops::_Iter_pred<smooth::core::network::SocketDispatcher::remove_socket_from_active_sockets(std::shared_ptr<smooth::core::network::ISocket>&)::<lambda(std::pair<int, std::shared_ptr<smooth::core::network::ISocket> >)> > > at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algo.h:104
 (inlined by) __find_if<std::_Rb_tree_iterator<std::pair<int const, std::shared_ptr<smooth::core::network::ISocket> > >, __gnu_cxx::__ops::_Iter_pred<smooth::core::network::SocketDispatcher::remove_socket_from_active_sockets(std::shared_ptr<smooth::core::network::ISocket>&)::<lambda(std::pair<int, std::shared_ptr<smooth::core::network::ISocket> >)> > > at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algo.h:162
 (inlined by) find_if<std::_Rb_tree_iterator<std::pair<int const, std::shared_ptr<smooth::core::network::ISocket> > >, smooth::core::network::SocketDispatcher::remove_socket_from_active_sockets(std::shared_ptr<smooth::core::network::ISocket>&)::<lambda(std::pair<int, std::shared_ptr<smooth::core::network::ISocket> >)> > at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algo.h:3816
 (inlined by) smooth::core::network::SocketDispatcher::remove_socket_from_active_sockets(std::shared_ptr<smooth::core::network::ISocket>&) at /home/permal/code/G2-Alarmsystem/components/Smooth/core/network/SocketDispatcher.cpp:208

A2      : 0x3ffb80d0  A3      : 0x000000a0  A4      : 0x3ffdfe64  A5      : 0x3ffe09f0  
A6      : 0x3ffb8174  A7      : 0x3ffdfe64  A8      : 0x800835f2  A9      : 0x3ffd61d0  
A10     : 0xcececece  A11     : 0xffffffff  A12     : 0x3ffd3e7c  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x3ffb8220  SAR     : 0x0000000c  EXCCAUSE: 0x0000001c  
EXCVADDR: 0xcececece  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  

Backtrace: 0x40165213:0x3ffd5f90 0x40165cc2:0x3ffd6210 0x4015e94f:0x3ffd6430 0x4015eb2d:0x3ffd6560 0x401a119d:0x3ffd6580 0x4013c44f:0x3ffd65b0
0x40165213: std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/forward_list.h:330
 (inlined by) std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:659
 (inlined by) std::__shared_ptr<smooth::core::network::ISocket, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr_base.h:925
 (inlined by) std::shared_ptr<smooth::core::network::ISocket>::~shared_ptr() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/shared_ptr.h:93
 (inlined by) std::pair<int, std::shared_ptr<smooth::core::network::ISocket> >::~pair() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_pair.h:96
 (inlined by) operator()<std::_Rb_tree_iterator<std::pair<int const, std::shared_ptr<smooth::core::network::ISocket> > > > at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/predefined_ops.h:234
 (inlined by) __find_if<std::_Rb_tree_iterator<std::pair<int const, std::shared_ptr<smooth::core::network::ISocket> > >, __gnu_cxx::__ops::_Iter_pred<smooth::core::network::SocketDispatcher::remove_socket_from_active_sockets(std::shared_ptr<smooth::core::network::ISocket>&)::<lambda(std::pair<int, std::shared_ptr<smooth::core::network::ISocket> >)> > > at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algo.h:104
 (inlined by) __find_if<std::_Rb_tree_iterator<std::pair<int const, std::shared_ptr<smooth::core::network::ISocket> > >, __gnu_cxx::__ops::_Iter_pred<smooth::core::network::SocketDispatcher::remove_socket_from_active_sockets(std::shared_ptr<smooth::core::network::ISocket>&)::<lambda(std::pair<int, std::shared_ptr<smooth::core::network::ISocket> >)> > > at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algo.h:162
 (inlined by) find_if<std::_Rb_tree_iterator<std::pair<int const, std::shared_ptr<smooth::core::network::ISocket> > >, smooth::core::network::SocketDispatcher::remove_socket_from_active_sockets(std::shared_ptr<smooth::core::network::ISocket>&)::<lambda(std::pair<int, std::shared_ptr<smooth::core::network::ISocket> >)> > at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algo.h:3816
 (inlined by) smooth::core::network::SocketDispatcher::remove_socket_from_active_sockets(std::shared_ptr<smooth::core::network::ISocket>&) at /home/permal/code/G2-Alarmsystem/components/Smooth/core/network/SocketDispatcher.cpp:208

0x40165cc2: std::basic_istream<char, std::char_traits<char> >::~basic_istream() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/forward_list.h:330
 (inlined by) std::basic_iostream<char, std::char_traits<char> >::~basic_iostream() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/istream:856
 (inlined by) std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_stringstream() at /home/permal/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/sstream:718
 (inlined by) smooth::core::logging::Format::replace(int, smooth::core::logging::BaseArg const&) at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/logging/log.h:420
 (inlined by) smooth::core::logging::Format::Format(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, smooth::core::logging::BaseArg const&) at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/logging/log.h:273
 (inlined by) smooth::core::network::SocketDispatcher::check_socket_send_timeout() at /home/permal/code/G2-Alarmsystem/components/Smooth/core/network/SocketDispatcher.cpp:291

0x4015e94f: smooth::core::Task::exec() at /home/permal/code/G2-Alarmsystem/components/Smooth/core/Task.cpp:85

0x4015eb2d: smooth::core::timer::ElapsedTime::zero() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/timer/ElapsedTime.h:46
 (inlined by) smooth::core::timer::ElapsedTime::start() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/timer/ElapsedTime.h:25
 (inlined by) smooth::core::timer::ElapsedTime::reset() at /home/permal/code/G2-Alarmsystem/components/Smooth/include/smooth/core/timer/ElapsedTime.h:40
 (inlined by) smooth::core::Task::exec() at /home/permal/code/G2-Alarmsystem/components/Smooth/core/Task.cpp:137

0x401a119d: esp_aes_release_hardware at /home/permal/esp/esp-idf/components/esp32/hwcrypto/aes.c:75

0x4013c44f: pthread_setspecific at /home/permal/esp/esp-idf/components/pthread/./pthread_local_storage.c:215


CPU halted.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Sanity check: Heap corruptions in latest ESP-IDF?

Postby ESP_Angus » Thu Feb 01, 2018 6:13 am

Hi permal,

It does look very much like something is corrupting memory.

- Do you know what the "good" IDF revision was, before this problem started?
- If you run the same workload on the "good" IDF revision, do you experience any problems?

Angus

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: Sanity check: Heap corruptions in latest ESP-IDF?

Postby permal » Thu Feb 01, 2018 6:31 am

I have the old copy on disk still and will do comparative tests this evening. As the corruption currently happens fairly quickly it should be pretty easy to determine if there is a difference.

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: Sanity check: Heap corruptions in latest ESP-IDF?

Postby permal » Thu Feb 01, 2018 6:33 am

Btw, does -fsanitze work with xtensa-gcc?

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: Sanity check: Heap corruptions in latest ESP-IDF?

Postby permal » Thu Feb 01, 2018 5:32 pm

permal wrote:Btw, does -fsanitze work with xtensa-gcc?
Sadly, it does not :(

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: Sanity check: Heap corruptions in latest ESP-IDF?

Postby permal » Thu Feb 01, 2018 9:03 pm

For those who don't frequent GitHub, I've posted an issue/query regarding -fsanitize and code quality in general: https://github.com/espressif/esp-idf/issues/1574 If you agree with my thinking, please give it a thumbs up to tell Espressif this is something the community wants.

Who is online

Users browsing this forum: No registered users and 90 guests