Skip to content

NVS/Preferences-lib getString() locks up intermittently #740

Closed
@Curclamas

Description

@Curclamas

Hardware:

Board: Custom Board
Core Installation/update date: 12.10.2017
IDE name: IDF component
Flash Frequency: 80Mhz
Upload Speed: 115200

Description:

I use Preferences lib to store some information once and read it periodically. Some reads occur every two minutes. After a few hours up to a few days the application will lock itself upon calling preferences.getString().

Sketch:

#include <Arduino.h>
#include <Preferences.h>

void someTask() { // 0 priority
        while(1){
           Preferences * preferences = new Preferences;
           preferences->begin("Logger", true);
           String facilityId = preferences->getString("facilityId", "unknown");
           preferences->end();
           delete preferences;

           // use facilityId...

           delay(1000 * 60 * 2);
        }
}

Debug Messages:

D (4673172) nvs: nvs_open_from_partition Logger 0
D (4673172) nvs: nvs_get_str_or_blob facilityId
D (4673178) nvs: nvs_get_str_or_blob facilityId
D (4673186) nvs: nvs_close 82

In case of the lockup, the last line is missing, implying that .getString() locks somehow internally. The task WDT does not always fire upon this lockup, causing the device to freeze until manual reset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions