How to handle "Too many open files" error
During FIXEdge functioning you may encounter "Too many open files" error like:
FixEdge.log
ERROR Â [Engine] Â 139902219888384 Â The dispatcher catch error during select() sockets: ::socket() failed. Too many open files. (Error code = 24).
 The cause is that your system has reached the limit of open files on the server, thus FIXEdge couldn’t open any more due to system limitations. This encounters both file descriptors and sockets.
Consequences are that FIXEdge will be unable to accept any new connections and current ones can potentially misbehave.
The reasons here could be:
- There are another processes that took all the available resources;
- Files, that had been opened by FIXEdge (for example, logs) were removed or moved on a hot run. Process still keeps descriptors for them;
- Unreleased/unclosed sockets.
Immediate workaround:
- Check your current system limitations for the user. (`
ulimit –Sn; ulimit -Hn
`); - Increase  this limit.
Fairly, FIXEdge log doesn’t contain the list of all open file descriptors on the system.  To catch the root cause, you will need the output of `lsof
` and `netstat -nap
` commands at the same time the issue is happening.
For the initial investigation, please:
- Having FIXEdge running, do `
lsof –p <FIX Edge process id>
`:
a) check for records with "(deleted)". This indicates that these files were removed while FIXEdge was running. FIXEdge restart is required in order to reveal these descriptors;
b) check for records with "CLOSE_WAIT" or "CLOSING". This indicates issues with closure of sockets. - Contact your Unix Team for assistance;
- Collect all the information (commands output, FIXEdge log and configuration files) and send it over to Support FIX Products <SupportFIXAntenna@epam.com> for further investigation.