PsychicHttp icon indicating copy to clipboard operation
PsychicHttp copied to clipboard

Fix crash with Event Source

Open dzungpv opened this issue 5 months ago • 5 comments

dzungpv avatar Jul 19 '25 11:07 dzungpv

I will try that because I have observed several crashes regarding event source. Can you summarise?

zekageri avatar Jul 19 '25 16:07 zekageri

I will try that because I have observed several crashes regarding event source. Can you summarise?

I have many crash with core dump from multiple ESP32 so I have to find the way to fix it. I am sure those will fix the problem.

This is the core dump

#0  0x400813c9 in panic_abort (details=0x3ffe3160 "assert failed: 0x4008ba47") at /Users/vietdzung/esp/esp-idf-v5.3.x/components/esp_system/panic.c:463
#1  0x40089264 in esp_system_abort (details=0x3ffe3160 "assert failed: 0x4008ba47") at /Users/vietdzung/esp/esp-idf-v5.3.x/components/esp_system/port/esp_system_chip.c:87
#2  0x40090174 in __assert_func (file=0x0, line=0, func=0x0, expr=0x0) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/newlib/assert.c:39
#3  0x4008ba4a in multi_heap_free (heap=0x3ffe4350, p=0x3ffec7d0) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/heap/multi_heap_poisoning.c:279
#4  0x40081e30 in heap_caps_free (ptr=<optimized out>) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/heap/heap_caps_base.c:75
#5  0x40081c46 in trace_free (p=0x3ffec7d0) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/heap/include/heap_trace.inc:164
#6  0x40081dc4 in __wrap_heap_caps_free (p=0x3ffec7d0) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/heap/include/heap_trace.inc:168
#7  0x400901a4 in free (ptr=0x3ffec7d0) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/newlib/heap.c:39
#8  0x401c9dcc in operator delete (ptr=0x3ffec7d0) at /Users/brnomac003/.gitlab-runner/builds/qR2TxTby/0/idf/crosstool-NG/.build/xtensa-esp-elf/src/gcc/libstdc++-v3/libsupc++/del_op.cc:49
#9  0x401c8f4c in operator delete (ptr=0x3ffec7d0) at /Users/brnomac003/.gitlab-runner/builds/qR2TxTby/0/idf/crosstool-NG/.build/xtensa-esp-elf/src/gcc/libstdc++-v3/libsupc++/del_ops.cc:33
#10 0x400f862c in PsychicEventSource::removeClient (this=0x3ffb5178 <app+2536>, client=0x3ffee324) at /Users/vietdzung/dev/projects/esp32/sdks/v3/5.3.3/PsychicHttp/src/PsychicEventSource.cpp:93
#11 0x400f8795 in PsychicHandler::checkForClosedClient (this=0x3ffb5178 <app+2536>, client=0x3ffee324) at /Users/vietdzung/dev/projects/esp32/sdks/v3/5.3.3/PsychicHttp/src/PsychicHandler.cpp:83
#12 0x400f8e89 in PsychicHttpServer::closeCallback (hd=0x3ffc7f64, sockfd=51) at /Users/vietdzung/dev/projects/esp32/sdks/v3/5.3.3/PsychicHttp/src/PsychicHttpServer.cpp:280
#13 0x40179460 in httpd_sess_delete (session=0x3ffe05ec, hd=0x3ffc7f64) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/esp_http_server/src/httpd_sess.c:373
#14 httpd_sess_delete (hd=0x3ffc7f64, session=0x3ffe05ec) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/esp_http_server/src/httpd_sess.c:354
#15 0x401786dc in httpd_process_session (context=0x3ffe3390, session=0x3ffe05ec) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/esp_http_server/src/httpd_main.c:268
#16 httpd_process_session (session=0x3ffe05ec, context=0x3ffe3390) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/esp_http_server/src/httpd_main.c:247
#17 0x401efa99 in httpd_sess_enum (hd=<optimized out>, enum_function=0x40178690 <httpd_process_session>, context=0x3ffe3390) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/esp_http_server/src/httpd_sess.c:50
#18 0x4017883a in httpd_server (hd=0x3ffc7f64) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/esp_http_server/src/httpd_main.c:317
#19 httpd_thread (arg=0x3ffc7f64) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/esp_http_server/src/httpd_main.c:339
#20 0x40089640 in vPortTaskWrapper (pxCode=0x40178714 <httpd_thread>, pvParameters=0x3ffc7f64) at /Users/vietdzung/esp/esp-idf-v5.3.x/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

The crash cause by void PsychicEventSource::send() also not occur from that day I have fix it, I have product running on hundreds client devices. Tested from 3 weeks ago

dzungpv avatar Jul 19 '25 17:07 dzungpv

The CI error only with ESP IDF 5.4.1 and it not relate to the lib, so you can ignore.

dzungpv avatar Jul 19 '25 17:07 dzungpv

This PR is for V1 right?

zekageri avatar Jul 22 '25 07:07 zekageri

This PR is for V1 right?

Yes master branch is V1. I tried v2 but it crash with ESP IDF so stay with V1 for now

dzungpv avatar Jul 22 '25 08:07 dzungpv