-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: modem: SARA modem driver leaks sockets #26819
Comments
@aport did you work around this or find a fix? if so a Pull Request would be appreciated since there's been no activity on this issue. |
@carlescufi I have not looked at this. @aport a PR would be greatly appreciated. |
Hi, sorry I have not set up a pull request. My tree is a bit out of date and I've been sidetracked by other projects. My change was minimal, simply the removal of the conditional at https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/modem/ublox-sara-r4.c#L1219 so that the USOCL is always sent, letting the modem figure out if it's valid or not. When I get some time I'll try to do a PR for this |
z_free_fd() is called twice then you close(). For example in ublox sara r4 driver offload_close() calls modem_socket_put() where z_free_fd() is called first time. Then this same function is called another time in socket.c in z_impl_zsock_close() after this function has called offload_close() in ublox sara r4 driver. This causes socket descriptor leak. Fixes zephyrproject-rtos#26819 Signed-off-by: Akseli Peltola <[email protected]>
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
z_free_fd() is called twice then you close(). For example in ublox sara r4 driver offload_close() calls modem_socket_put() where z_free_fd() is called first time. Then this same function is called another time in socket.c in z_impl_zsock_close() after this function has called offload_close() in ublox sara r4 driver. This causes socket descriptor leak. Fixes #26819 Signed-off-by: Akseli Peltola <[email protected]>
Describe the bug
When calling
close
on a socket, the ublox sara driver only issues the+USOCL
command if the socket is UDP, or if it's TCP and connected.I am porting existing POSIX software to Zephyr. This code calls
close()
on a socket descriptor ifconnect()
fails. The result on Zephyr is that the sockets allocated internally by the module are never released. On Linux the file descriptor will be released.To Reproduce
Steps to reproduce the behavior:
socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
close
on the socket+USOCL
is issued to the moduleExpected behavior
Calling
close
on a socket should release its resources, independent on whether it is connected or not.Impact
Eventually the module runs out of internal sockets and new
socket
calls fail. The R4 only supports 7 sockets.Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: