Skip to content

[BUG] Deadlock issue in system/settings when CONFIG_SYSTEM_SETTINGS_CACHED_SAVES is not set #3105

Open
@jeanthom

Description

@jeanthom

Description / Steps to reproduce the issue

A deadlock occurs when one of the following functions is called if CONFIG_SYSTEM_SETTINGS_CACHED_SAVES is not set:

  • settings_setstorage()
  • settings_sync()
  • settings_clear()
  • settings_create()

To further explain what's going on, dump_cache() is the function is charge of writing pending changes to the persistent storage. This function can be either invoked through save() (which is itself called by settings_setstorage(), settings_sync(), etc.) when CONFIG_SYSTEM_SETTINGS_CACHED_SAVES is disabled, or invoked via a signal when CONFIG_SYSTEM_SETTINGS_CACHED_SAVES is set.

In the first configuration settings_setstorage() (and all the other mentioned functions) lock a mutex but also call indirectly dump_cache() which also tries lock on the very same mutex, causing a deadlock.

The issue was identified on nuttx-apps 12.9.0, but the code hasn't been touched since.

On which OS does this issue occur?

[OS: Mac]

What is the version of your OS?

macOS 15.5

NuttX Version

12.9.0

Issue Architecture

[Arch: arm]

Issue Area

[Area: System]

Host information

No response

Verification

  • I have verified before submitting the report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions