Skip to content

lwm2m engine hangs on native_posix #15204

@pieterjanc

Description

@pieterjanc

Describe the bug
When running the LwM2M engine, the application gets into an infinite loop and does not respond anymore on native_posix. This happens on my machine after 188 seconds.
When setting CONFIG_NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME=n, the hang also occurs after 188 seconds simulated time.

To Reproduce
Steps to reproduce the behavior:

  1. cd samples/net/lwm2m_client
  2. mkdir build; cd build
  3. cmake -GNinja -DBOARD=native_posix ..
  4. ninja run
  5. after 3 min the application does not respond anymore and consumes 100% cpu

Expected behavior
The application should continue to run normally.

Impact
LwM2M cannot be used on native_posix.

Environment (please complete the following information):

  • OS: Ubuntu 18.04
  • Toolchain: Zephyr SDK
  • Version: v1.14.0-rc3

Possible fix

diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c
index c38fd787ee..28397e732b 100644
--- a/subsys/net/lib/lwm2m/lwm2m_engine.c
+++ b/subsys/net/lib/lwm2m/lwm2m_engine.c
@@ -3808,7 +3808,7 @@ static void lwm2m_engine_service(struct k_work *work)
                service_due_timestamp = srv->last_timestamp +
                                        K_MSEC(srv->min_call_period);
                /* service is due */
-               if (timestamp > service_due_timestamp) {
+               if (timestamp >= service_due_timestamp) {
                        srv->last_timestamp = k_uptime_get();
                        k_work_submit(&srv->service_work);
                }

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions