Too Many open files. Solve it once and for all.

Dmitry Redkin5 years ago

Many users of traccar are faced with "too many open files" problem. The docs even have a page which addresses this issue.
But the solution actually is very easy and logical.
The problem of too many open files goes from the fact that by default ALL supported protocols are enabled. While usually people have not too many device types simultaneously,
Github even has an issue, but it is still open.
Somewhere on the forum I've met an opinion that leaving all protocols enabled consumes a negligible amount of resources.
Well, let's check it!

Here is the legend:

  1. Traccar is installed. The amount of open handles hits the sky;
  2. The source of the problem (traccar) is isolated and disabled temporary;
  3. After googling the solution wasn't found and traccar is enabled again;
  4. All significant drops in open handles represents a system reboot
  5. Finally solution found: all protocols except needed disabled, the number of handles goes back to acceptable (not normal, but what can I do?).
Anton Tananaev5 years ago

Thanks for sharing, but unfortunately this doesn't address the most common root cause for hitting the limit - number of device connections.

Dmitry Redkin5 years ago

Well, I'm not a kernel expert, and I don't know, how kernel counts the limit of open connections, but look: the number of open epoll handles (black) dropped about 15K after disabling.
Wouldn't it add to the umber of available connections? If yes, then 15K should be enough for guite a number of connected devices...

Anton Tananaev5 years ago

By default Linux usually gives 1000 open files limit for standard processes and Traccar works just fine there with default configuration, with reasonably small number of devices. So, whatever counts against the limit is clearly below 1000. But overall I agree that it's a good idea to disable unused ports.

Track-trace3 years ago

@Dmitry Redkin

How many real devices where connected when you did that measurement ?