Search code examples
socketsubuntutcpopensslc++17

Too many files open - TCP/IP socket and OpenSSL


I am using TCP/IP socket over TLS1.2 (OpenSSL 1.1.1). The client opens a connection and keeps it open. When my client tries to open 800 connections, the server get error "Too many files open".

I know that the Ubuntu OS has by default limit 1024 open files. However, even if I would not close file descriptors correctly, there shouldn't be more than 800 open files (no other app is running on the server). The error indicates, I have reached the 1024. What am I missing?

Does OpenSSL increases descriptor count on top of count of open TCP sockets?

Thanks for help.


Solution

  • The problem was that the file handler for a certificate was not closed, after the certificate validation (a security check).