Stack overflow on emacT when disconnecting Ethernet

Resch2061
Posts: 40
Joined: Mon May 01, 2017 1:56 pm

Stack overflow on emacT when disconnecting Ethernet

Postby Resch2061 » Tue Sep 04, 2018 11:52 am

Hi,

When trying to stop the Ethernet functions in ESP-IDF v3.1, I'm getting a stack overflow in the emac_task:

Code: Select all

I (4243) COMMS: Connected Ethernet

W (4535) COMMS: Disconnecting comms!
I (4535) MQTTplain: Disconnecting!
I (5536) ETHERNET: Stopping
mem_usage: free DRAM 173888 IRAM 239264
I (5537) emac: emac stop
I (5537***ERROR*** A stack overflow in task emacT has been detected.
abort() was called at PC 0x4008e120 on core 0
0x4008e120: vApplicationStackOverflowHook at /home/rene/esp32/apps/josuino_esp32/esp-idf/components/esp32/panic.c:649


Backtrace: 0x4008e0db:0x3ffcb040 0x4008e107:0x3ffcb060 0x4008e120:0x3ffcb080 0x4008b47e:0x3ffcb0a0 0x4008c910:0x3ffcb0d0 0x4008c8c6:0x020073b3
0x4008e0db: invoke_abort at /home/rene/esp32/apps/josuino_esp32/esp-idf/components/esp32/panic.c:649

0x4008e107: abort at /home/rene/esp32/apps/josuino_esp32/esp-idf/components/esp32/panic.c:649

0x4008e120: vApplicationStackOverflowHook at /home/rene/esp32/apps/josuino_esp32/esp-idf/components/esp32/panic.c:649

0x4008b47e: vTaskSwitchContext at /home/rene/esp32/apps/josuino_esp32/esp-idf/components/freertos/tasks.c:3564

0x4008c910: _frxt_dispatch at /home/rene/esp32/apps/josuino_esp32/esp-idf/components/freertos/portasm.S:406

0x4008c8c6: _frxt_int_exit at /home/rene/esp32/apps/josuino_esp32/esp-idf/components/freertos/portasm.S:206
As you can see, it's only 4-5 seconds in the program. You can also see how much DRAM and IRAM we're using just before the stack overflow.
It's quite cumbersome this is happening. Not sure how to resolve this, myself.

ESP_morris
Posts: 290
Joined: Wed Sep 05, 2018 6:23 am

Re: Stack overflow on emacT when disconnecting Ethernet

Postby ESP_morris » Wed Sep 05, 2018 6:49 am

Since the stack size of emacT is 2048 Bytes, and currently it can not be changed in driver(I don't know why the original author do so...)
So, thanks for your post, I will make the stack size of emacT task "mutable" via Kconfig.
If your project is in a hurry, you can try to change the stack size from 2048 to 4096 in components/ethernet/emac_main.c
Image

Resch2061
Posts: 40
Joined: Mon May 01, 2017 1:56 pm

Re: Stack overflow on emacT when disconnecting Ethernet

Postby Resch2061 » Thu Sep 06, 2018 1:30 pm

Thank you for your reply.
I'm mostly wondering myself why this even occurs in the first place. It runs just fine most of the time, it's just when we're switching from Wifi to Ethernet this happens, which I find rather odd. Again, there's quite a few tasks running in our program beside emacT. I'm looking into it further myself, I will let you know when I discover more about this issue.

Who is online

Users browsing this forum: No registered users and 119 guests