- Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
- Core 0 register dump:
- PC : 0x40100e47 PS : 0x00060d30 A0 : 0x800d7f4a A1 : 0x3ffcfc40
- 0x40100e47: httpd_resp_set_hdr at components/esp_http_server/src/httpd_txrx.c:176
- A2 : 0x3ffb1dc4 A3 : 0x3f40452c A4 : 0x3f404520 A5 : 0x3ffaf02c
- A6 : 0x3f403910 A7 : 0x3f4045c0 A8 : 0x00000000 A9 : 0x00000000
- A10 : 0x00000000 A11 : 0x3ffaf02c A12 : 0x00000001 A13 : 0x00000013
- A14 : 0x3ffaf02c A15 : 0x3f4044fc SAR : 0x00000000 EXCCAUSE: 0x0000001c
- EXCVADDR: 0x0000021c LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffc
After some digging, it turns out that void *aux, member of httpd_req_t is NULL when referenced from inside the task (but is non-NULL just before entering the task (see below). If it's an issue of allocation/copying something somewhere properly, then I'd like to know this by example, since aux is patently a private variable.
Here's the stack trace:
- void indirect_task_fn (void*par)
- {
- debug_req_type ("task", par); /* prints some info about par, see below */
- simple_handler(par);
- vTaskDelete(NULL); /* Does not reach this point */
- }
- /* debug_req_type: ooops
- task : Debugging http_req_t
- task : pointer=0x3ffb1dc4
- task : aux=0x0
- ...
- */
- esp_err_t indirect_handler(httpd_req_t *req)
- {
- debug_req_type("indirect handler", req); /* see below */
- BaseType_t status = xTaskCreate(indirect_task_fn,"indirect task",100,req,1,NULL);
- if(status != pdTRUE) /* do something */
- return ESP_OK;
- }
- /* So far so good
- indirect handler : pointer=0x3ffb1dc4
- indirect handler : aux=0x3ffb1fe8
- ...
- */
- const httpd_uri_t indirect = {
- .uri = "/indirect",
- .method = HTTP_GET,
- .handler = indirect_handler,
- .user_ctx = NULL
- };
- httpd_register_uri_handler(server, &indirect);
- esp_err_t simple_handler(httpd_req_t *req)
- {
- debug_req_type("simple handler", req);
- httpd_resp_set_hdr(req, "Content-type", "text/html"); /* irrelevant, but fine */
- httpd_resp_send(req, "<html><head></head><body><h1>debugging is fun</h1><div><p>(sometimes)</p></div></body></html>", HTTPD_RESP_USE_STRLEN); /* same here */
- return ESP_OK;
- }
- /* All is fine
- simple handler : pointer=0x3ffb1dc4
- simple handler : aux=0x3ffb1fe8
- ...
- */
- const httpd_uri_t simple = {
- .uri = "/simple",
- .method = HTTP_GET,
- .handler = simple_handler,
- .user_ctx = NULL
- };
- httpd_register_uri_handler(server, &simple); /* So far so good. */