esp-matter icon indicating copy to clipboard operation
esp-matter copied to clipboard

Running out of space in nvs partition corrupts flash. (CON-1255)

Open jonsmirl opened this issue 1 year ago • 3 comments

I had a bug in my code which caused me to write too many keys into the NVS partition. That should have just failed with an out-of-space error, but it didn't. It corrupted my partition instead.

I accidentally made an infinite loop making bridged endpoints. Each time I made an endpoint it made the corresponding keys in NVS. When it ran out of space in NVS it didn't fail gracefully, instead it corrupted the partition.

jonsmirl avatar Jul 13 '24 18:07 jonsmirl

@jonsmirl , an infinite lopp writing keys to the nvs_partition did not cause any corruption of the partition on my end. I tested the light app as well as the ble_mesh_bridge app with bridged endpoint with infinite loop writing too many keys to nvs with esp32c3. My idf version for this test is v5.2.1. It gave the following error 4157 which stands for ESP_ERR_NVS_NOT_ENOUGH_SPACE which stands for no enough space in the underlying storage to save the value.

shripad621git avatar Nov 13 '24 09:11 shripad621git

Did you try to keep adding after it was full? I was not properly checking the error so I just kept adding until I rebooted.

jonsmirl avatar Nov 13 '24 14:11 jonsmirl

Yes, I added the keys in a loop even after it was full and I kept getting the same error i.e 4157.

shripad621git avatar Nov 13 '24 16:11 shripad621git