Title says it all. What can cause it?
Here's my proposed plan. Based on @lontivero's investigation the issue may not be our fault, but it has something to do with swagger instead, which I believe he will share it here shortly.
It could worth to review the point regarding nginx problem described here too: https://medium.com/@mshanak/soved-dotnet-core-too-many-open-files-in-system-when-using-postgress-with-entity-framework-c6e30eeff6d1
I'm sharing here @lontivero's investigation that he shared us on Slack.


Turns out the issue isn't in our code, but rather in the interaction of .NET and the Linux filesystem, maybe swagger.
To mitigate this issue we both increased the open file limits of Linux and updated swagger to the latest stable.
This most likely solved the issue, so closing this. Further investigation into the issue as @lontivero suggested is possible: https://medium.com/@mshanak/soved-dotnet-core-too-many-open-files-in-system-when-using-postgress-with-entity-framework-c6e30eeff6d1
Most helpful comment
I'm sharing here @lontivero's investigation that he shared us on Slack.


Turns out the issue isn't in our code, but rather in the interaction of .NET and the Linux filesystem, maybe swagger.
To mitigate this issue we both increased the open file limits of Linux and updated swagger to the latest stable.
This most likely solved the issue, so closing this. Further investigation into the issue as @lontivero suggested is possible: https://medium.com/@mshanak/soved-dotnet-core-too-many-open-files-in-system-when-using-postgress-with-entity-framework-c6e30eeff6d1