rpc/stream/manager: Randomly select TCP connections to kill in order to
not hang when the file descriptor limit of the process is reached.
Closes veyron/release-issues#1952
Higher level mechanisms (such as garbage collecting inactive VIFs,
timeouts at the server) are used (or can be implemented) to help protect
the process from reaching the limit on the number of open file
descriptors.
However, if it does reach this limit, then all new clients will be
denied service if the process does not actively try to reduce the number
of open file descriptors. This change makes the process actively reduce
the number of open file descriptors.
One can envision more sohisticated selection of the connections to kill,
and this change can be refined, however as a first step "random
selection" was deemed reasonable.
The changes to profiles/internal/rt were required to ensure that in this
"cleanup", we do not end up killing the connection to the agent that
holds the processes' credentials - that would render the process
useless.
Change-Id: Ie169829e977683a36901725a8f2c5dda3cbb7f0f
6 files changed