From d708dc648b17a9ac064a4ff5cfbed8c4537c22b3 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 21 Jan 2026 13:56:37 -1000 Subject: [PATCH] fix cleanup crash (existing bug) [13:35:00.591][I][http_request.ota:175]: Done in 542 seconds [13:35:00.696][V][esp-idf:000]: E (669073) boot_comm: mismatch chip ID, expected 9, found 3424 [13:35:00.698][V][esp-idf:000]: E (669076) esp_ota_ops: New image failed verification [13:35:00.699][W][http_request.ota:198]: Error ending update! error_code: 132 [13:35:00.701][V][http_request.ota:073]: Aborting OTA backend [13:35:00.702][V][http_request.ota:076]: Aborting HTTP connection [13:35:00.703]Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled. [13:35:00.703]Core 1 register dump: [13:35:00.703]PC : 0x11101080 PS : 0x00060630 A0 : 0x8203e461 A1 : 0x3fceded0 [13:35:00.703]A2 : 0x3fc9e45c A3 : 0x3fcee840 A4 : 0x0000003f A5 : 0x3fcee840 [13:35:00.703]A6 : 0x0000003e A7 : 0x3fcafccc A8 : 0x8203e43a A9 : 0x3fcede40 [13:35:00.703]A10 : 0x3fc9e45c A11 : 0x00000001 A12 : 0x0000003f A13 : 0x3fc9ee08 [13:35:00.704]A14 : 0x0000006d A15 : 0x3fcee674 SAR : 0x00000008 EXCCAUSE: 0x00000014 [13:35:00.704]EXCVADDR: 0x11101080 LBEG : 0x40056f08 LEND : 0x40056f12 LCOUNT : 0x00000000 [13:35:00.706]Backtrace: 0x1110107d:0x3fceded0 0x4203e45e:0x3fcedef0 0x4203e46e:0x3fcedf10 0x4201f561:0x3fcedf30 0x420078fc:0x3fcedf50 0x4200817f:0x3fcedf80 0x42008c89:0x3fcedfa0 0x42008da9:0x3fcee1d0 0x42014e45:0x3fcee1f0 0x4209e323:0x3fcee230 0x4209e337:0x3fcee250 0x4209e505:0x3fcee270 0x4201402e:0x3fcee290 0x42006555:0x3fcee2b0 0x4200376c:0x3fcee2d0 0x4209d809:0x3fcee2f0 0x42005b6d:0x3fcee310 0x42005cb9:0x3fcee350 0x420042b4:0x3fcee370 0x4200620f:0x3fcee3a0 0x4209e0ed:0x3fcee3f0 0x42012889:0x3fcee410 0x4201243e:0x3fcee430 0x420140d2:0x3fcee490 0x420070fe:0x3fcee4b0 WARNING Found stack trace! Trying to decode it WARNING Decoded 0x4203e45e: esp_transport_list_clean at /Users/bdraco/.platformio/packages/framework-espidf/components/tcp_transport/transport.c:85 WARNING Decoded 0x4203e46e: esp_transport_list_destroy at /Users/bdraco/.platformio/packages/framework-espidf/components/tcp_transport/transport.c:74 WARNING Decoded 0x4201f561: esp_http_client_cleanup at /Users/bdraco/.platformio/packages/framework-espidf/components/esp_http_client/esp_http_client.c:1027 WARNING Decoded 0x420078fc: esphome::http_request::HttpContainerIDF::end() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/http_request/http_request_idf.cpp:270 WARNING Decoded 0x4200817f: esphome::http_request::OtaHttpRequestComponent::cleanup_(std::unique_ptr >, std::shared_ptr const&) at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/http_request/ota/ota_http_request.cpp:77 (discriminator 1) WARNING Decoded 0x42008c89: esphome::http_request::OtaHttpRequestComponent::do_ota_() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/http_request/ota/ota_http_request.cpp:199 (discriminator 1) WARNING Decoded 0x42008da9: esphome::http_request::OtaHttpRequestComponent::flash() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/http_request/ota/ota_http_request.cpp:49 WARNING Decoded 0x42014e45: esphome::http_request::OtaHttpRequestComponentFlashAction<>::play() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/http_request/ota/automation.h:33 WARNING Decoded 0x4209e323: esphome::Action<>::play_complex() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/core/automation.h:268 WARNING Decoded 0x4209e337: esphome::Action<>::play_next_() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/core/automation.h:299 (inlined by) esphome::Action<>::play_complex() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/core/automation.h:269 WARNING Decoded 0x4209e505: esphome::ActionList<>::play() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/core/automation.h:347 (inlined by) esphome::Automation<>::trigger() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/core/automation.h:389 (inlined by) esphome::Trigger<>::trigger() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/core/automation.h:241 WARNING Decoded 0x4201402e: esphome::button::ButtonPressTrigger::ButtonPressTrigger(esphome::button::Button*)::{lambda()#1}::operator()() const at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/button/automation.h:22 (inlined by) void std::__invoke_impl(std::__invoke_other, esphome::button::ButtonPressTrigger::ButtonPressTrigger(esphome::button::Button*)::{lambda()#1}&) at /Users/bdraco/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/14.2.0/bits/invoke.h:61 (inlined by) std::enable_if, void>::type std::__invoke_r(esphome::button::ButtonPressTrigger::ButtonPressTrigger(esphome::button::Button*)::{lambda()#1}&) at /Users/bdraco/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/14.2.0/bits/invoke.h:111 (inlined by) std::_Function_handler::_M_invoke(std::_Any_data const&) at /Users/bdraco/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/14.2.0/bits/std_function.h:290 WARNING Decoded 0x42006555: std::function::operator()() const at /Users/bdraco/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/14.2.0/bits/std_function.h:591 (inlined by) esphome::CallbackManager::call() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/core/helpers.h:1335 (inlined by) esphome::LazyCallbackManager::call() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/core/helpers.h:1387 (inlined by) esphome::button::Button::press() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/button/button.cpp:24 WARNING Decoded 0x4200376c: esphome::api::APIConnection::button_command(esphome::api::ButtonCommandRequest const&) at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/api/api_connection.cpp:941 WARNING Decoded 0x4209d809: esphome::api::APIServerConnection::on_button_command_request(esphome::api::ButtonCommandRequest const&) at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/api/api_pb2_service.cpp:692 WARNING Decoded 0x42005b6d: esphome::api::APIServerConnectionBase::read_message(unsigned long, unsigned long, unsigned char const*) at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/api/api_pb2_service.cpp:526 WARNING Decoded 0x42005cb9: esphome::api::APIServerConnection::read_message(unsigned long, unsigned long, unsigned char const*) at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/api/api_pb2_service.cpp:864 WARNING Decoded 0x420042b4: esphome::api::APIConnection::loop() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/api/api_connection.cpp:210 WARNING Decoded 0x4200620f: esphome::api::APIServer::loop() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/api/api_server.cpp:183 (discriminator 1) WARNING Decoded 0x4209e0ed: esphome::Component::call_loop() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/core/component.cpp:211 WARNING Decoded 0x42012889: esphome::Component::call() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/core/component.cpp:266 WARNING Decoded 0x4201243e: esphome::Application::loop() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/core/application.cpp:164 WARNING Decoded 0x420140d2: loop() at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/test_http_ota_esp32s3.yaml:162 WARNING Decoded 0x420070fe: esphome::loop_task(void*) at /Users/bdraco/esphome/.esphome/build/test-http-ota-s3/src/esphome/components/esp32/core.cpp:62 (discriminator 1) [13:35:00.706]ELF file SHA256: 84cefc24a [13:35:00.706]Rebooting... [13:35:02.193]ESP-ROM:esp32s3-20210327 [13:35:02.193]Build:Mar 27 2021 [13:35:02.193]rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT) [13:35:02.193]Saved PC:0x40378c02 WARNING Decoded 0x40378c02: esp_cpu_wait_for_intr at /Users/bdraco/.platformio/packages/framework-espidf/components/esp_hw_support/cpu.c:64 [13:35:02.193]SPIWP:0xee [13:35:02.193]mode:DIO, clock div:1 [13:35:02.193]load:0x3fce2820,len:0x15c8 [13:35:02.193]load:0x403c8700,len:0xce4 [13:35:02.193]load:0x403cb700,len:0x2f98 --- esphome/components/http_request/http_request_idf.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/esphome/components/http_request/http_request_idf.cpp b/esphome/components/http_request/http_request_idf.cpp index 583c9b5e19..c1de226fef 100644 --- a/esphome/components/http_request/http_request_idf.cpp +++ b/esphome/components/http_request/http_request_idf.cpp @@ -264,10 +264,14 @@ int HttpContainerIDF::read(uint8_t *buf, size_t max_len) { } void HttpContainerIDF::end() { + if (this->client_ == nullptr) { + return; // Already cleaned up + } watchdog::WatchdogManager wdm(this->parent_->get_watchdog_timeout()); esp_http_client_close(this->client_); esp_http_client_cleanup(this->client_); + this->client_ = nullptr; } void HttpContainerIDF::feed_wdt() {