Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: sntp_init() crashes when network not yet initialized. (IDFGH-1691) #3931

Closed
3 tasks
vonnieda opened this issue Aug 16, 2019 · 2 comments
Closed
3 tasks

Comments

@vonnieda
Copy link
Contributor

vonnieda commented Aug 16, 2019

Environment

  • Development Kit: none
  • Module or chip used: ESP32-WROVER-B
  • IDF version (run git describe --tags to find it):
    3.0: 6cb8d16
    3.1: 9196bc7
    3.2: 90747cc
  • Build System: Make
  • Compiler version (run xtensa-esp32-elf-gcc --version to find it): xtensa-esp32-elf-gcc (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 5.2.0
  • Operating System: macOS
  • Power Supply: USB

Problem Description

Using ESP-IDF 3.2 (from today) and calling sntp_init() before WiFi is initialized, there is a crash:

/Users/jason/esp/esp-idf/components/freertos/queue.c:1442 (xQueueGenericReceive)- assert failed!
abort() was called at PC 0x40086f05 on core 0
0x40086f05: xQueueGenericReceive at /Users/jason/esp/esp-idf/components/freertos/queue.c:2038


Backtrace: 0x40089a18:0x3ffb9e20 0x40089c45:0x3ffb9e40 0x40086f05:0x3ffb9e60 0x401112b6:0x3ffb9ea0 0x4011132e:0x3ffb9ec0 0x40111648:0x3ffb9ee0 0x401116b1:0x3ffb9f00 0x4010ca51:0x3ffb9f20 0x4010ca72:0x3ffb9f40 0x4010619b:0x3ffb9f60 0x400d25ef:0x3ffb9f80 0x400d25f7:0x3ffb9fa0 0x400d26c0:0x3ffba000 0x400d0d72:0x3ffba090 0x4008668d:0x3ffba0b0
0x40089a18: invoke_abort at /Users/jason/esp/esp-idf/components/esp32/panic.c:707

0x40089c45: abort at /Users/jason/esp/esp-idf/components/esp32/panic.c:707

0x40086f05: xQueueGenericReceive at /Users/jason/esp/esp-idf/components/freertos/queue.c:2038

0x401112b6: sys_mutex_lock at /Users/jason/esp/esp-idf/components/lwip/port/esp32/freertos/sys_arch.c:444

0x4011132e: sys_arch_protect at /Users/jason/esp/esp-idf/components/lwip/port/esp32/freertos/sys_arch.c:469

0x40111648: do_memp_malloc_pool at /Users/jason/esp/esp-idf/components/lwip/lwip/src/core/memp.c:459

0x401116b1: memp_malloc at /Users/jason/esp/esp-idf/components/lwip/lwip/src/core/memp.c:459

0x4010ca51: udp_new at /Users/jason/esp/esp-idf/components/lwip/lwip/src/core/udp.c:1078

0x4010ca72: udp_new_ip_type at /Users/jason/esp/esp-idf/components/lwip/lwip/src/core/udp.c:1078

0x4010619b: sntp_init at /Users/jason/esp/esp-idf/components/lwip/lwip/src/apps/sntp/sntp.c:693

0x400d25ef: initialize_sntp at /Users/jason/esp/esp-idf/examples/protocols/sntp/main/sntp_example_main.c:122

0x400d25f7: obtain_time at /Users/jason/esp/esp-idf/examples/protocols/sntp/main/sntp_example_main.c:100

0x400d26c0: app_main at /Users/jason/esp/esp-idf/examples/protocols/sntp/main/sntp_example_main.c:69 (discriminator 9)

0x400d0d72: main_task at /Users/jason/esp/esp-idf/components/esp32/cpu_start.c:500

0x4008668d: vPortTaskWrapper at /Users/jason/esp/esp-idf/components/freertos/port.c:403

I am using the example at https://github.com/espressif/esp-idf/tree/release/v3.2/examples/protocols/sntp

The crash can be triggered simply by commenting out lines 96-99 which initializes WiFi.

I see in #944 that others have experienced this, and came to the conclusion that networking must be initialized, but this was not the case in ESP-IDF 3.1 or 3.0. It only happens in 3.2.

Expected Behavior

SNTP initializes without requiring the TCP adapter to have been initialized, and works correctly once TCP is initialized.

Actual Behavior

Crash.

Steps to repropduce

  1. Flash the SNTP example from https://github.com/espressif/esp-idf/tree/release/v3.2/examples/protocols/sntp
  2. Observe working correctly.
  3. Comment out lines 96-99 in https://github.com/espressif/esp-idf/blob/release/v3.2/examples/protocols/sntp/main/sntp_example_main.c so that WiFi is not initialized.
  4. Observe crash.
  5. For additional verification, you can perform the same process with the 3.0 branch and observe that it works fine.

Code to reproduce this issue

https://github.com/espressif/esp-idf/tree/release/v3.2/examples/protocols/sntp

Other items if possible

  • sdkconfig file (attach the sdkconfig file from your project folder)
  • elf file in the build folder (note this may contain all the code details and symbols of your project.)
  • coredump (This provides stacks of tasks.)
@github-actions github-actions bot changed the title Regression: sntp_init() crashes when network not yet initialized. Regression: sntp_init() crashes when network not yet initialized. (IDFGH-1691) Aug 16, 2019
@Alvin1Zhang
Copy link
Collaborator

Thanks for reporting the issue. Would you please help provide more details as suggested in the issue template? Thanks. @vonnieda

@vonnieda
Copy link
Contributor Author

Thanks @Alvin1Zhang, I have updated the issue with the template data.

espressif-bot pushed a commit that referenced this issue Mar 2, 2020
…ore use if not then creates it

Closes: #944
Closes: #3931
Closes: WIFI-1019
espressif-bot pushed a commit that referenced this issue Mar 18, 2020
…ore use if not then creates it

Closes: #944
Closes: #3931
Closes: WIFI-1019
espressif-bot pushed a commit that referenced this issue Mar 18, 2020
…ore use if not then creates it

Closes: #944
Closes: #3931
Closes: WIFI-1019
espressif-bot pushed a commit that referenced this issue Mar 19, 2020
…ore use if not then creates it

Closes: #944
Closes: #3931
Closes: WIFI-1019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants