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

[BUG] esp32s3 wifi deadlock #15314

Closed
1 task done
yamt opened this issue Dec 23, 2024 · 5 comments · Fixed by #15445 or #15532
Closed
1 task done

[BUG] esp32s3 wifi deadlock #15314

yamt opened this issue Dec 23, 2024 · 5 comments · Fixed by #15445 or #15532
Labels
Arch: xtensa Issues related to the Xtensa architecture Area: Drivers Drivers issues OS: Mac Issues related to MacOS (building system, etc) Type: Bug Something isn't working

Comments

@yamt
Copy link
Contributor

yamt commented Dec 23, 2024

Description / Steps to reproduce the issue

net_lock() and esp_wifi_lock() are taken in an inconsistent order.
thus it can cause a deadlock.

wlan_ifdown net_lock();
  |
  v
esp_wifi_sta_stop esp_wifi_lock(true);
esp_evt_work_cb esp_wifi_lock(true);
  |
  v
esp32s3_wlan_sta_set_linkstatus(false)
  |
  v
netdev_carrier_off
  |
  v
devif_dev_event net_lock();

the most straightforward fix: make esp_evt_work_cb (and other functions taking esp_wifi_lock first if any) acquire net_lock() before esp_wifi_lock(). (note that net_lock() is a recursive lock.)

On which OS does this issue occur?

[OS: Mac]

What is the version of your OS?

macOS 15.2

NuttX Version

master

Issue Architecture

[Arch: xtensa]

Issue Area

[Area: Drivers]

Verification

  • I have verified before submitting the report.
@yamt yamt added the Type: Bug Something isn't working label Dec 23, 2024
@github-actions github-actions bot added Arch: xtensa Issues related to the Xtensa architecture Area: Drivers Drivers issues OS: Mac Issues related to MacOS (building system, etc) labels Dec 23, 2024
@fdcavalcanti
Copy link
Contributor

Hi @yamt. Did you have issues on S3 using WiFi due to this?
What devkit did you use?

@yamt
Copy link
Contributor Author

yamt commented Dec 23, 2024

Hi @yamt. Did you have issues on S3 using WiFi due to this? What devkit did you use?

my colleague performed some tests, which connect/disconnect wifi repeatedly and found this issue. i think it was with a proprietary board with SMP enabled.

looking at the code, i don't think it's a board-specific issue. (thus reported here.)

@fdcavalcanti
Copy link
Contributor

Interesting.
Feel free to submit this modification and I can test it on our internal CI.

yamt added a commit to yamt/incubator-nuttx that referenced this issue Jan 7, 2025
@yamt
Copy link
Contributor Author

yamt commented Jan 7, 2025

Interesting. Feel free to submit this modification and I can test it on our internal CI.

see #15445

@yamt
Copy link
Contributor Author

yamt commented Jan 14, 2025

Interesting. Feel free to submit this modification and I can test it on our internal CI.

see #15445

see also #15532

@xiaoxiang781216 xiaoxiang781216 linked a pull request Jan 14, 2025 that will close this issue
linguini1 pushed a commit to linguini1/nuttx that referenced this issue Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: xtensa Issues related to the Xtensa architecture Area: Drivers Drivers issues OS: Mac Issues related to MacOS (building system, etc) Type: Bug Something isn't working
Projects
None yet
2 participants