NET_TC_THREAD_PREEMPTIVE=y results in race conditions in LwM2M engine #78989
Labels
area: LWM2M
area: Networking
bug
The issue is a bug, or the PR is fixing a bug
priority: low
Low impact/importance bug
Describe the bug
Enabling the preemptive TX/RX threads introduces race conditions in the LwM2M engine.
Looking at the socket_loop implementation there is almost no synchronisation. For example, scheduling a message with
lwm2m_send_cb
results in a crash due to a race condition, e.g:In this case it's a NULL-pointer dereference here
To Reproduce
Sorry, no minimal reproducible code example.
I think setting the
NET_TC_THREAD_PREEMPTIVE
toy
and sending a lot of messages should suffice.Expected behavior
Sorry if this is the wrong place to post this, I just wanted to warn others of a potential problem.
The configuration flag is of course marked as experimental, so there should be no expectation that everything will work as expected, but I think since it is clear that LwM2M will not work with this flag, turning it on should result in a build error until the LwM2M engine is made thread-safe.
The text was updated successfully, but these errors were encountered: