We’re hosting a ServiceStack AppHostBase
in an instance of Kestrel on an AWS machine instance, and after polling the service every second for an hour or so the Linux machine fails reporting ‘Too many open files’.
So I’ve taken a look at the reported open files for the process, and this is increasing by one for every request processed.
For example:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
:
dotnet 7586 root 1771u IPv4 2496218 0t0 TCP localhost:40786->localhost:http (ESTABLISHED)
dotnet 7586 root 1772r FIFO 0,11 0t0 2496221 pipe
dotnet 7586 root 1773w FIFO 0,11 0t0 2496221 pipe
dotnet 7586 root 1774u IPv4 2496223 0t0 TCP localhost:40788->localhost:http (ESTABLISHED)
dotnet 7586 root 1775r FIFO 0,11 0t0 2496226 pipe
dotnet 7586 root 1776w FIFO 0,11 0t0 2496226 pipe
dotnet 7586 root 1777u IPv4 2496228 0t0 TCP localhost:40790->localhost:http (ESTABLISHED)
dotnet 7586 root 1778r FIFO 0,11 0t0 2496231 pipe
dotnet 7586 root 1779w FIFO 0,11 0t0 2496231 pipe
dotnet 7586 root 1780u IPv4 2496233 0t0 TCP localhost:40792->localhost:http (ESTABLISHED)
:
These files just keep getting added until the server fails. I don’t know if this is a Kestrel issue or related to the ServiceStack endpoint not closing the output stream in some way.
Has anyone experienced this and found a solution? It’s a bit of a show-stopper for us at the moment.