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] Index out of bounds panic when connecting to enterprise wifi. #2201

Open
m-dahl opened this issue Sep 20, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working package:esp-wifi Issues related to the esp-wifi package status:needs-attention This should be prioritized
Milestone

Comments

@m-dahl
Copy link

m-dahl commented Sep 20, 2024

Bug description

Hi. Thanks to the work in #2004 we have been able to switch our application from idf to esp-hal + embassy. Its working well but we hit an issue the other day. I have implemented simple roaming by scanning for better access points and disconnect the current one and selecting the one I want by setting a specific BSSID. It works fine, but after a while it panics (details below).

To Reproduce

  1. Connect and disconnect to wifi (enterprise) in a loop.
  2. Panics on the 7th connection attempt.

e.g.

    controller.start().await.expect("wifi: start");
    controller.set_configuration(&client_conf).expect("wifi: set_configuration");
    loop {
        log::info!("CONNECT");
        controller.connect().await;
        Timer::after(Duration::from_millis(1000)).await;

        log::info!("DISCONNECT");
        controller.disconnect().await;
        Timer::after(Duration::from_millis(1000)).await;
    }

Result:

====================== PANIC ======================
panicked at /Users/user/.cargo/git/checkouts/esp-hal-42ec44e8c6943228/5de267a/esp-wifi/src/compat/common.rs:204:24:
index out of bounds: the len is 10 but the index is 10

Backtrace:

0x420233b6
0x420233b6 - esp_wifi::compat::common::create_recursive_mutex::{{closure}}
    at /Users/user/.cargo/git/checkouts/esp-hal-42ec44e8c6943228/5de267a/esp-wifi/src/compat/common.rs:204

It seems MUTEX_IDX_CURRENT is only ever incremented so eventually you go oob. Maybe related to warning warn!("trying to remove a mutex via sem_delete"); which looks like a TODO in common.rs?

Environment

  • esp32c3 + enterprise wifi network
  • esp-hal/wifi latest commit (5de267a).
@m-dahl m-dahl added bug Something isn't working status:needs-attention This should be prioritized labels Sep 20, 2024
@SergioGasquez SergioGasquez added the package:esp-wifi Issues related to the esp-wifi package label Sep 20, 2024
@bjoernQ bjoernQ self-assigned this Sep 20, 2024
@bjoernQ bjoernQ added this to the 0.21.0 milestone Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package:esp-wifi Issues related to the esp-wifi package status:needs-attention This should be prioritized
Projects
Status: Todo
Development

No branches or pull requests

3 participants