Skip to content

SNTP fails to close the used socket #34165

@johann2

Description

@johann2

Describe the bug
Seems that the close function used in sntp_close will resolve to some close function not related to sockets instead of the one that calls zsock_close. As a result the socket remains open.

To Reproduce
I haven't been able to put together a minimal example to reproduce this.
The issue seems to happen only when CONFIG_NET_SOCKETS_POSIX_NAMES=n

Expected behaviour
sntp_close should close the socket

Impact
This is a blocking issue for us, because once enough sockets have been left open, no new sockets can be opened and the system loses connectivity.

Logs and console output
N/A

Environment (please complete the following information):

  • OS: Linux
  • Toolchain Zephyr SDK 0.11.3
  • Commit SHA 0a7ea88

Additional context
It seems to me that using the zsock_* functions as proposed in #24129 would be the easiest fix and would bypass the problem completely. I'd be happy to bring this PR up to date if needed.

However, this bug may be a symptom of something else wrong in the POSIX api. I hope someone who's more familiar with this part of the codebase could take a look. #31323 seems to be somehow related to this bug as well.

Metadata

Metadata

Assignees

Labels

area: NetworkingbugThe 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