Skip to content

EspWifi::is_connected causing Guru Meditation Error #617

Description

@JacksonUtsch

Bug description

When I call EspWifi::is_connected on my esp32-s3 when development flash encryption is enabled it crashes with the error

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x420245b1  PS      : 0x00060430  A0      : 0x8200777f  A1      : 0x3fcb6480  
A2      : 0x8212e308  A3      : 0x8212e308  A4      : 0x00000000  A5      : 0x00000004  
A6      : 0x00000004  A7      : 0x0000cdcd  A8      : 0x8205fdbb  A9      : 0x3fcb6450  
A10     : 0x00000001  A11     : 0x00000000  A12     : 0x00000000  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x004c4b40  SAR     : 0x0000000e  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x8212e308  LBEG    : 0x40056f5c  LEND    : 0x40056f72  LCOUNT  : 0x00000000 

The stack trace shows exactly where EspWifi::is_connected is called.

wifi: Arc<Mutex<EspWifi<'static>>>

std::thread::Builder::new()
    .stack_size(8 * 1024)
    .spawn(move || {
        loop {
            std::thread::sleep(Duration::from_millis(5000));
            if let Ok(wifi) = wifi.try_lock() {
                if let Ok(wifi_connected) = wifi.is_connected() {
                    if wifi_connected == false {
                        continue;
...

Here is the stack trace:

0x4209163e: pthread_create at pthread.c:385
0x42091b41: pthread_cond_timedwait at pthread_cond_var.c:156 (discriminator 1)
 (inlined by) pthread_cond_timedwait at pthread.h:132 (discriminator 1)
0x4204d855: esp_idf_svc::wifi::WifiDriver::set_configuration at wifi.rs:828
0x4204e45a: <esp_idf_svc::wifi::WifiEvent as esp_idf_svc::eventloop::EspEventDeserializer>::deserialize at wifi.rs:2356
0x420077bb: my_project::lib::network::mqtt::run_mqtt::{{closure}} at mqtt.rs:192
 (inlined by) std::sys::backtrace::__rust_begin_short_backtrace at backtrace.rs:152
0x42030b59: core::sync::atomic::atomic_sub at atomic.rs:3999
 (inlined by) core::sync::atomic::AtomicUsize::fetch_sub at atomic.rs:3194
 (inlined by) <alloc::sync::Arc<T,A> as core::ops::drop::Drop>::drop at sync.rs:2643
 (inlined by) core::ptr::drop_in_place<alloc::sync::Arc<std::thread::Packet<()>>> at mod.rs:799
 (inlined by) std::thread::Builder::spawn_unchecked_ at mod.rs:602
 (inlined by) std::thread::Builder::spawn_unchecked at mod.rs:467
 (inlined by) std::thread::Builder::spawn at mod.rs:399
0x42063241: std::sys::fd::unix::FileDesc::write at unix.rs:324
0x42091a1c: s_check_and_init_if_static at pthread_cond_var.c:47
 (inlined by) s_check_and_init_if_static at pthread_cond_var.c:34
  • Would you like to work on a fix?

Sure

To Reproduce

Have to enable flash encryption and flash using esptool with --encrypt

Code works fine when remove the is_connected call and also when not using flash encryption

Expected behavior

The function should throw error or give connection result

Environment

esp-idf-svc on master

ESP-IDF 5.3.3

esp32s3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    • Status
      Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions