8000 WLAN init/deinit leaking memory -- esp_wifi_deinit() not getting called · Issue #218 · pycom/pycom-micropython-sigfox · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

WLAN init/deinit leaking memory -- esp_wifi_deinit() not getting called #218

Closed
martijnthe opened this issue Oct 17, 2018 · 4 comments
Closed
Assignees

Comments

@martijnthe
Copy link
Contributor
  • board: LoPy 4
  • firmware version: (sysname='LoPy', nodename='LoPy', release='1.18.1.r1', version='f5d0c68 on 2018-09-06', machine='LoPy with ESP32', lorawan='1.0.2') -- it's a custom build, but very close to 1.18.1.r1.

I'm using WLAN().deinit() to (attempt) to shut down the wifi stack.
All is well, but after a bunch of on/off toggling, I'm seeing error messages these (I've turned on error logging in the firmware):

W (11106275) wifi: alloc eb len=204 type=2 fail

W (11106275) wifi: m f probe rsp l=177

W (11106277) wifi: alloc eb len=204 type=2 fail

W (11106277) wifi: m f probe rsp l=177

W (11179758) wifi: alloc eb len=204 type=2 fail

W (11179758) wifi: m f probe rsp l=177

W (11179779) wifi: alloc eb len=204 type=2 fail

W (11179779) wifi: m f probe rsp l=177

It looks like the allocator that the wifi stack uses can no longer allocate blocks.
I tried searching for where these messages are coming from, but I'm afraid it's coming from within one of the ESP32 binaries/static libraries.

Inspecting the modwlan.c, I noticed `esp_wifi_deinit() is not getting called. According to the header:

/**
  * @brief  Deinit WiFi
  *         Free all resource allocated in esp_wifi_init and stop WiFi task
  *
  * @attention 1. This API should be called if you want to remove WiFi driver from the system
  *
  * @return ESP_OK: succeed
  */
esp_err_t esp_wifi_deinit(void);

I'm guessing that's the bug...?

@martijnthe
Copy link
Contributor Author
martijnthe commented Oct 17, 2018

I'm guessing that's the bug...?

I did a bit more experimentation, calling WLAN().init/deinit many times in a loop. I did not hit the issue this way, so perhaps there's something else at play.

When I had hit the issue, I checked machine.info() and there was plenty of heap space (2000KB or so).

@martijnthe
Copy link
Contributor Author
martijnthe commented Oct 17, 2018

I narrow the issue down to _thread locks leaking memory:
#219

I still think it may be good to call esp_wifi_deinit() like the documentation suggests.

@iwahdan88
Copy link
Contributor

This Bug is already solved in Development release , esp_wifi_deinit() is now called when you do WLAN.deinit()

I'll close the issue as it is already fixed in Dev

Thanks

@martijnthe
Copy link
Contributor Author

@iwahdan88 thanks for the response.
Re. Development release: when is the v1.19.x release going out of beta?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0