Let's assume there is a client that makes a lot of short-living connections to a server.
If the client closes the connection, there will be many ports in TIME_WAIT state on the client side. Since the client runs out of local ports, it becomes impossible to make a new connection attempt quickly.
If the server closes the connection, I will see many TIME_WAITs on the server side. However, does this do any harm? The client (or other clients) can keep making connection attempts since it never runs out of local ports, and the number of TIME_WAIT state will increase on the server side. What happens eventually? Does something bad happen? (slowdown, crash, dropped connections, ..)
Please note that my question is not 'what is the purpose of TIME_WAIT?' but 'what happens if there are so many TIME_WAIT states on the server?' I already know what happens when a connection is closed in TCP/IP and why TIME_WAIT state is required. :) I'm not trying to trouble-shoot it but just want to know what is the potential issue with it.
To put simply, let's say 'netstat -nat | grep :8080 | grep TIME_WAIT | wc -l' prints '100000'. What would happen? Does the O/S network stack slow down? Too many open files error? Or, just nothing to worry about?