net: lib: sockets: Heap mem pool for SOCKETPAIR is too small #87047
Labels
area: Networking
bug
The issue is a bug, or the PR is fixing a bug
priority: low
Low impact/importance bug
Describe the bug
The default value of
HEAP_MEM_POOL_ADD_SIZE_SOCKETPAIR
(255) seems to be insufficient to create asocket_pair
.To create a socket pair using
z_impl_zsock_socketpair
fromsocketpair.c
,spair_new()
is executed twice.spair_new()
does amalloc()
ofsizeof(struct spair)
(148) bytes. This results in a total of 296 bytes of heap usage.Since the heap is only 256 bytes, this will fail.
Is this derised behaviour? Or should the default size be increased?
Also,
sizeof(struct spair)
depends onCONFIG_NET_SOCKETPAIR_BUFFER_SIZE
. Should this somehow be taken into account?To Reproduce
There is no direct way to reproduce using the zephyr tree. I stumbled apon the issue while developing a
coap_server
fornative_sim
. The issue was introduced in 671f0f6.Impact
Coap server thread stops running, so my device is not reachable over coap.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: