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

esp-wifi: Possible footgun when initializing #3062

Open
bjoernQ opened this issue Jan 30, 2025 · 0 comments
Open

esp-wifi: Possible footgun when initializing #3062

bjoernQ opened this issue Jan 30, 2025 · 0 comments
Labels
package:esp-wifi Issues related to the esp-wifi package

Comments

@bjoernQ
Copy link
Contributor

bjoernQ commented Jan 30, 2025

On Matrix a user reported a case where calling new_with_mode got stuck (https://matrix.to/#/!LdaNPfUfvefOLewEIM:matrix.org/$Twxz-4_dqbWmhn3qiXD-qUYLScmE3Nk62QFclcB7eTY)

The reason is that the user's code called it inside a locked critical_section::Mutex and WiFi wasn't initialized, yet. The function will call wifi_init which calls into the WiFi drivers. There it tried to take a semaphore which is to be given by the WiFi task.

semaphore_take will see the locked semaphore and try to yield (i.e. to let some other task make progress und unlock it). Since we are inside a critical-section this cannot work

We should

  • document that behavior
  • assert or at least error-log when yield is tried with interrupts disabled (was already suggested before)
@bjoernQ bjoernQ added the package:esp-wifi Issues related to the esp-wifi package label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:esp-wifi Issues related to the esp-wifi package
Projects
Status: Todo
Development

No branches or pull requests

1 participant