esp-idf: [TW#27105] stop httpd will stuck all the time when recevie wifi disconnect event.

Environment

  • Development Kit: [ESP32-DevKitC]
  • Kit version (for WroverKit/PicoKit/DevKitC): [v4]
  • Core (if using chip or module): [ESP-WROOM-32D]
  • IDF version (3276a1316):
  • Development Env: [Make]
  • Operating System: [Ubuntu]
  • Power Supply: [USB]

Problem Description

stop httpd will stuck when wifi disconnect.

code refer to examples/protocols/http_server/simple/main/main.c

Expected Behavior

Normally works.

Actual Behavior

sometimes httpd stop will stuck all the time.

Steps to repropduce

test 24 hours reproduce this issue, the probability is about 1-10%.

Debug Logs

    while (hd->hd_td.status != THREAD_STOPPED) {
        httpd_os_thread_sleep(1000);
        ESP_LOGW(TAG, "stopping httpd status(%d)...", hd->hd_td.status);
}

I (134462841) httpd: stopping httpd status(32768)...
I (134463841) httpd: stopping httpd status(32768)...
I (134464841) httpd: stopping httpd status(32768)...
I (134465841) httpd: stopping httpd status(32768)...
I (134466841) httpd: stopping httpd status(32768)...
I (134467841) httpd: stopping httpd status(32768)...
I (134468841) httpd: stopping httpd status(32768)...

```c

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 38 (17 by maintainers)

Most upvoted comments

Also, if JTAG debugging is an option, try setting a watchpoint on the variable which gets corrupted. It will trigger when other code modifies it.

If you don’t have access to JTAG, you can also set watchpoint from your application, calling esp_set_watchpoint function. E.g. esp_set_watchpoint(0, &httpd_server, 4, ESP_WATCHPOINT_STORE);

The declaration of this function is in esp_panic.h.

Without JTAG connected, watchpoint will trigger a debug exception, and you will get the backtrace.

@anurag-kar

Thanks. Here is my test procedure:

  1. wifi connected and delay 1-2 minutes then disconnect, repeat this.
  2. open browser and request one page to httpd and then do nothing.