Skip to content
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

TCP connection from MAVSDK breaks app after 16 minutes of idle time due to reconnection #2353

Closed
fibonacci-matrix opened this issue Jul 19, 2024 · 4 comments · Fixed by #2357
Labels

Comments

@fibonacci-matrix
Copy link
Contributor

I'm developing an app that uses MAVSDK to connect to a device via the built-in MAVSDK TCP connection. MAVSDK has an excellent TCP reconnection mechanism that fits my requirements well, namely the possibility of temporary disconnection. In this case timer is started, which checks every second whether the connection has been restored. But after 16 minutes, this mechanism breaks my app with the message "socket errorToo many open files".

I did some basic research and the problem is that the MAVSDK in a loop reopens the sockets, but does not close them with the close function in case of unsuccessful execution of the connect function.

// from tcp_connection.cpp

_socket_fd = socket(AF_INET, SOCK_STREAM, 0);

I have tested basic fix on Linux, but I don't know if it will work on other operating systems

@JonasVautherin
Copy link
Collaborator

Would you like to open a PR with your proposed fix? 😊

@julianoes
Copy link
Collaborator

Good catch. Yes a PR would be great.

@julianoes julianoes added the bug label Jul 20, 2024
@fibonacci-matrix
Copy link
Contributor Author

I can do a PR in a few days, but I don't mind if someone else does it. Besides, #2342 will conflict with my changes

@julianoes
Copy link
Collaborator

#2342 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants