Skip to content

lwm2m: unexpected ENOMEM when adding observer #91383

@etiennedm

Description

@etiennedm

Describe the bug

I'm getting a hard to reproduce situation where the LwM2M engine cannot add new observers even though none are actually considered to be registered by the engine.

Context: network of low power sensors communicating through a Thread network to a LwM2M server running on a RPi.

The issue arises when there is a loss of connectivity with the LwM2M server, which can happen quite frequently. When the sensor eventually reconnects, the server sends observe requests for 7 resources. I suspect a problem when cleaning up old observers, resulting in a state where they are considered in use but are actually not being used. Using the lwm2m obs shell command, I get an empty output. However no new observer can be added, and the ENOMEM error points to a failure in engine_allocate_observer.

I have CONFIG_LWM2M_ENGINE_MAX_OBSERVER=20 to alleviate the issue, but eventually all nodes suffer from the ENOMEM error.

Regression

  • This is a regression.

Steps to reproduce

I don't have a simple minimal sample to reproduce this issue, and I cannot reliably reproduce it myself. Lowering CONFIG_LWM2M_ENGINE_MAX_OBSERVER does make it happen more quickly though.

Relevant log output

Impact

Functional Limitation – Some features not working as expected, but system usable.

Environment

  • OS: Linux
  • Zephyr SDK 0.16.3
  • SHA b7970cc

Additional Context

No response

Metadata

Metadata

Assignees

Labels

area: LWM2MbugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions