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 sockets left after closed connection from marinetraffic.com #63

Open
tjswe opened this issue Jan 1, 2025 · 0 comments
Open

TCP sockets left after closed connection from marinetraffic.com #63

tjswe opened this issue Jan 1, 2025 · 0 comments

Comments

@tjswe
Copy link

tjswe commented Jan 1, 2025

This is a pretty rare incident but i have spent a few hours finding the root cause so i want to create an issue for it.

I have two Raspberry Pi:s with USB-connected AIS-receivers in a remote location with low to no AIS-traffic that services a SAR function in the area.

Both Kplex:es on both Rpi:s are experiencing "Too many open files" from time to time. If kplex is restarted, problem is solved.

From what i can find (with my limited network knowledge) the issue comes from marinetraffic.com (from now on MT) expects NMEA-packets every 10 seconds or less. If no data is received they send a TCP FIN to the client and asks to end the connection. This probably for performance reasons.

If traffic then IS being sent by the client after these 10 seconds, MT responds with a RST which probably is a more harsh way to tell kplex that the listening socket in the other end is closed. (The AIS-traffic in the example below is a keepalive script that injects an NMEA-sentence to kplex every minute)

image

What i think this gives, is a lot of open sockets(?) which over time reaches a limit where kplex is not allowed to create any more (1024 max)

image

Not sure if this is due to how MT handles the connection or if this is an issue with kplex or my installation specifically.

As for the issue for me, its looks to be handled by adjusting the rate of keepalivepackets below 10 seconds. I have also read about the keepalive function that has been added to kplex. Still the number of unclosed sockets is an issue that perhaps could happen to others.

Details:

Running version 1.4-55-ga7d726b (develop branch Aug 4, 2022)

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"

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

No branches or pull requests

1 participant