sockets: ordering of send() vs. poll() when using socket API + DTLS causes a crash #13380
Labels
area: Networking
area: Sockets
Networking sockets
bug
The issue is a bug, or the PR is fixing a bug
priority: medium
Medium impact/importance bug
Milestone
Describe the bug
Using current in-tree LwM2M client sample (samples/net/lwm2m_client) with overlay-dtls.conf, results in a crash due to how TLS handshake is implemented in the socket APIs.
For UDP, the TLS handshake is initiated during the first send(), for TCP it's started at connect(). In the LwM2M engine the socket is added to a poll() loop after connect() and this seems to be what is causing the crash. If I re-order the addition of the socket to the poll() loop to after the first send(), the crash goes away (such as https://github.com/foundriesio/zephyr/commit/9004322201131cf873e00611a9ddd2e3f38088e9)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expect to be able to add the socket to the poll() loop prior to send() and not have a crash in the LwM2M engine.
Impact
This behavior seems incorrect atm. It's a complexity, if the developer needs to know not to poll() on a socket until the first send() (for UDP).
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: