Closed
Description
Platform
ESP32
IDE / Tooling
pioarduino
What happened?
i got this error while using this function.
there's not much detail on this function in the documentation, so maybe it's just me using it wrong.
Stack Trace
> testAuth_ok
>
> Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
>
>
>
> Core 1 register dump:
>
> PC : 0x40136e31 PS : 0x00060c30 A0 : 0x800ed826 A1 : 0x3ffdabf0
>
> A2 : 0x00000000 A3 : 0x3ffe2164 A4 : 0x3ffe2798 A5 : 0x00000001
>
> A6 : 0x00000000 A7 : 0xff000000 A8 : 0x8014fe18 A9 : 0x3ffdabf0
>
> A10 : 0x3ffdac50 A11 : 0x0000000f A12 : 0x00000010 A13 : 0x0000ff00
>
> A14 : 0x00ff0000 A15 : 0x3ffe2164 SAR : 0x0000001c EXCCAUSE: 0x0000001c
>
> EXCVADDR: 0x00000008 LBEG : 0x4008ae80 LEND : 0x4008ae9c LCOUNT : 0xffffffff
>
>
>
>
>
> Backtrace: 0x40136e2e:0x3ffdabf0 0x400ed823:0x3ffdac30 0x400f0dc2:0x3ffdac50 0x400eef73:0x3ffdac90 0x40134442:0x3ffdacc0 0x400eef5b:0x3ffdacf0 0x400ef536:0x3ffdad10 0x400ee1c9:0x3ffdad70 0x40134442:0x3ffdadb0 0x400eef5b:0x3ffdade0 0x40134532:0x3ffdae00 0x40134fb2:0x3ffdae70 0x400eef5b:0x3ffdaea0 0x4013441d:0x3ffdaec0 0x400eef5b:0x3ffdaef0 0x4013432d:0x3ffdaf10 0x40134442:0x3ffdaf40 0x400eef5b:0x3ffdaf70 0x40134532:0x3ffdaf90 0x40134f5f:0x3ffdb000 0x40135b43:0x3ffdb030 0x40136862:0x3ffdb060 0x40136a01:0x3ffdb080 0x40132ae9:0x3ffdb0a0 0x40132b85:0x3ffdb0d0 0x40133776:0x3ffdb0f0 0x4008d4aa:0x3ffdb120
>
> #0 0x40136e2e in AsyncWebServerResponse::addHeader(char const*, char const*, bool) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/WebResponses.cpp:137
> #1 0x400ed823 in AsyncWebServerResponse::addHeader(String const&, String const&, bool) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/ESPAsyncWebServer.h:1022 (discriminator 2)
> #2 0x400f0dc2 in std::_Function_handler<bool (AsyncWebServerRequest*), authz::{lambda(AsyncWebServerRequest*)#1}>::_M_invoke(std::_Any_data const&, AsyncWebServerRequest*&&) at src/webservers.cpp:341 (discriminator 2)
>
> (inlined by) __invoke_impl<bool, <lambda(AsyncWebServerRequest*)>&, AsyncWebServerRequest*> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:61 (discriminator 2)
>
> (inlined by) __invoke_r<bool, <lambda(AsyncWebServerRequest*)>&, AsyncWebServerRequest*> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:114 (discriminator 2)
>
> (inlined by) _M_invoke at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:290 (discriminator 2)
> #3 0x400eef73 in std::function<bool (AsyncWebServerRequest*)>::operator()(AsyncWebServerRequest*) const at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:591
>
> (inlined by) AsyncAuthorizationMiddleware::run(AsyncWebServerRequest*, std::function<void ()>) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/ESPAsyncWebServer.h:778
> #4 0x40134442 in std::_Function_handler<void (), AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, std::function<void ()>)::{lambda()#1}>::_M_invoke(std::_Any_data const&) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/Middleware.cpp:66 (discriminator 2)
>
> (inlined by) __invoke_impl<void, AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, ArMiddlewareNext)::<lambda()>&> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:61 (discriminator 2)
>
> (inlined by) __invoke_r<void, AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, ArMiddlewareNext)::<lambda()>&> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:111 (discriminator 2)
>
> (inlined by) _M_invoke at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:290 (discriminator 2)
> #5 0x400eef5b in std::function<void ()>::operator()() const at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:591
> #6 0x400ef536 in std::_Function_handler<void (AsyncWebServerRequest*, std::function<void ()>), digestAuth::{lambda(AsyncWebServerRequest*, std::function<void ()>)#1}>::_M_invoke(std::_Any_data const&, AsyncWebServerRequest*&&, std::function<void ()>&&) at src/webservers.cpp:304
>
> (inlined by) __invoke_impl<void, <lambda(AsyncWebServerRequest*, ArMiddlewareNext)>&, AsyncWebServerRequest*, std::function<void()> > at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:61
>
> (inlined by) __invoke_r<void, <lambda(AsyncWebServerRequest*, ArMiddlewareNext)>&, AsyncWebServerRequest*, std::function<void()> > at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:111
>
> (inlined by) _M_invoke at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:290
> #7 0x400ee1c9 in std::function<void (AsyncWebServerRequest*, std::function<void ()>)>::operator()(AsyncWebServerRequest*, std::function<void ()>) const at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:591
>
> (inlined by) AsyncMiddlewareFunction::run(AsyncWebServerRequest*, std::function<void ()>) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/ESPAsyncWebServer.h:695
> #8 0x40134442 in std::_Function_handler<void (), AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, std::function<void ()>)::{lambda()#1}>::_M_invoke(std::_Any_data const&) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/Middleware.cpp:66 (discriminator 2)
>
> (inlined by) __invoke_impl<void, AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, ArMiddlewareNext)::<lambda()>&> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:61 (discriminator 2)
>
> (inlined by) __invoke_r<void, AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, ArMiddlewareNext)::<lambda()>&> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:111 (discriminator 2)
>
> (inlined by) _M_invoke at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:290 (discriminator 2)
> #9 0x400eef5b in std::function<void ()>::operator()() const at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:591
> #10 0x40134532 in AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, std::function<void ()>) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/Middleware.cpp:68
> #11 0x40134fb2 in std::_Function_handler<void (), AsyncWebServerRequest::_runMiddlewareChain()::{lambda()#2}>::_M_invoke(std::_Any_data const&) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/WebRequest.cpp:698 (discriminator 1)
>
> (inlined by) __invoke_impl<void, AsyncWebServerRequest::_runMiddlewareChain()::<lambda()>&> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:61 (discriminator 1)
>
> (inlined by) __invoke_r<void, AsyncWebServerRequest::_runMiddlewareChain()::<lambda()>&> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:111 (discriminator 1)
>
> (inlined by) _M_invoke at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:290 (discriminator 1)
> #12 0x400eef5b in std::function<void ()>::operator()() const at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:591
> #13 0x4013441d in std::_Function_handler<void (), AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, std::function<void ()>)::{lambda()#1}>::_M_invoke(std::_Any_data const&) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/Middleware.cpp:62
>
> (inlined by) __invoke_impl<void, AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, ArMiddlewareNext)::<lambda()>&> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:61
>
> (inlined by) __invoke_r<void, AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, ArMiddlewareNext)::<lambda()>&> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:111
>
> (inlined by) _M_invoke at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:290
> #14 0x400eef5b in std::function<void ()>::operator()() const at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:591
> #15 0x4013432d in AsyncCorsMiddleware::run(AsyncWebServerRequest*, std::function<void ()>) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/Middleware.cpp:255
> #16 0x40134442 in std::_Function_handler<void (), AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, std::function<void ()>)::{lambda()#1}>::_M_invoke(std::_Any_data const&) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/Middleware.cpp:66 (discriminator 2)
>
> (inlined by) __invoke_impl<void, AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, ArMiddlewareNext)::<lambda()>&> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:61 (discriminator 2)
>
> (inlined by) __invoke_r<void, AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, ArMiddlewareNext)::<lambda()>&> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:111 (discriminator 2)
>
> (inlined by) _M_invoke at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:290 (discriminator 2)
> #17 0x400eef5b in std::function<void ()>::operator()() const at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:591
> #18 0x40134532 in AsyncMiddlewareChain::_runChain(AsyncWebServerRequest*, std::function<void ()>) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/Middleware.cpp:68
> #19 0x40134f5f in AsyncWebServerRequest::_runMiddlewareChain() at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/WebRequest.cpp:696 (discriminator 1)
> #20 0x40135b43 in AsyncWebServerRequest::_parseLine() at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/WebRequest.cpp:681
> #21 0x40136862 in AsyncWebServerRequest::_onData(void*, unsigned int) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/WebRequest.cpp:158
> #22 0x40136a01 in std::_Function_handler<void (void*, AsyncClient*, void*, unsigned int), AsyncWebServerRequest::AsyncWebServerRequest(AsyncWebServer*, AsyncClient*)::{lambda(void*, AsyncClient*, void*, unsigned int)#1}>::_M_invoke(std::_Any_data const&, void*&&, AsyncClient*&&, void*&&, unsigned int&&) at .pio/libdeps/esp-wrover-kit/ESPAsyncWebServer/src/WebRequest.cpp:70
>
> (inlined by) __invoke_impl<void, AsyncWebServerRequest::AsyncWebServerRequest(AsyncWebServer*, AsyncClient*)::<lambda(void*, AsyncClient*, void*, size_t)>&, void*, AsyncClient*, void*, unsigned int> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:61
>
> (inlined by) __invoke_r<void, AsyncWebServerRequest::AsyncWebServerRequest(AsyncWebServer*, AsyncClient*)::<lambda(void*, AsyncClient*, void*, size_t)>&, void*, AsyncClient*, void*, unsigned int> at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:111
>
> (inlined by) _M_invoke at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:290
> #23 0x40132ae9 in std::function<void (void*, AsyncClient*, void*, unsigned int)>::operator()(void*, AsyncClient*, void*, unsigned int) const at C:/Users/Denis/.platformio/packages/toolchain-xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:591
>
> (inlined by) AsyncClient::_recv(tcp_pcb*, pbuf*, signed char) at .pio/libdeps/esp-wrover-kit/AsyncTCP@src-3d2743e0c28a86159a81736b0029ad30/src/AsyncTCP.cpp:1122
> #24 0x40132b85 in AsyncClient::_s_recv(void*, tcp_pcb*, pbuf*, signed char) at .pio/libdeps/esp-wrover-kit/AsyncTCP@src-3d2743e0c28a86159a81736b0029ad30/src/AsyncTCP.cpp:1487
> #25 0x40133776 in _async_service_task(void*) at .pio/libdeps/esp-wrover-kit/AsyncTCP@src-3d2743e0c28a86159a81736b0029ad30/src/AsyncTCP.cpp:259
>
> (inlined by) _async_service_task at .pio/libdeps/esp-wrover-kit/AsyncTCP@src-3d2743e0c28a86159a81736b0029ad30/src/AsyncTCP.cpp:294
> #26 0x4008d4aa in vPortTaskWrapper at C:/Users/Denis/.platformio/packages/framework-espidf@src-eaaeefbba2e06723731a31c86cc03031/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139
Minimal Reproductible Example (MRE)
here's my code:
static AsyncMiddlewareFunction digestAuth([](AsyncWebServerRequest *request,
ArMiddlewareNext next) {
Serial.println("digestAuth");
AsyncWebServerResponse *response = request->beginResponse(401);
if (!request->hasHeader("Authorization")) {
response->addHeader("Access-Control-Allow-Origin", "*");
response->addHeader("WWW-Authenticate", "X-Custom-Digest realm=\"" +
ESP_Name +
"\","
"qop=\"auth\","
"nonce=\"" +
generateNonce() +
"\","
"algorithm=\"MD5\"");
return request->send(response);
} else {
Serial.println("Authorization header found");
}
next();
});
server
.on("/auth-digest", HTTP_GET,
[](AsyncWebServerRequest *request) {
Serial.println("step");
return request->send(200);
})
.addMiddlewares({&digestAuth, &authz});
static AsyncAuthorizationMiddleware authz([](AsyncWebServerRequest *request) {
Serial.println("authz");
String sessionToken = verifyDigest(request);
if (sessionToken != "") {
Serial.println("testAuth_ok");
request->getResponse()->addHeader("X-Session-Token", sessionToken);
return true;
}
Serial.println("testAuth_no");
return false;
});
I confirm that:
- I have read the documentation.
- I have searched for similar discussions.
- I have searched for similar issues.
- I have looked at the examples.
- I have upgraded to the lasted version of ESPAsyncWebServer (and AsyncTCP for ESP32).