From 775b73d1f9d87f43d023bcef46c4bdc423868158 Mon Sep 17 00:00:00 2001 From: Vishnu Narayanan Date: Wed, 25 Mar 2026 06:07:07 +0530 Subject: [PATCH] fix: raise open file descriptor limit to prevent EMFILE errors (#13895) ## Summary - Adds `LimitNOFILE=65536` to both web and worker systemd service units - Fixes recurring `Errno::EMFILE` (Too many open files) errors during peak traffic after deploys ## Context Puma workers idle at 720-770 open FDs against the default soft limit of 1024, leaving ~250 FDs of headroom. During deploy-triggered instance refreshes at peak traffic, concurrent requests exhaust the remaining FDs, causing EMFILE across all web instances. 3 incidents in March 2026 with escalating event counts. The hard limit is already 524288, so this just raises the soft limit to a standard production value. Self-hosted instances pick this up automatically via `cwctl --upgrade`. Fixes https://linear.app/chatwoot/issue/CW-6685/errnoemfile-too-many-open-files-rb-sysopen --- deployment/chatwoot-web.1.service | 1 + deployment/chatwoot-worker.1.service | 1 + 2 files changed, 2 insertions(+) diff --git a/deployment/chatwoot-web.1.service b/deployment/chatwoot-web.1.service index 0d1d33804..79a531d55 100644 --- a/deployment/chatwoot-web.1.service +++ b/deployment/chatwoot-web.1.service @@ -15,6 +15,7 @@ TimeoutStopSec=30 KillMode=mixed StandardInput=null SyslogIdentifier=%p +LimitNOFILE=65536 Environment="PATH=/home/chatwoot/.rvm/gems/ruby-3.4.4/bin:/home/chatwoot/.rvm/gems/ruby-3.4.4@global/bin:/home/chatwoot/.rvm/rubies/ruby-3.4.4/bin:/home/chatwoot/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/chatwoot/.rvm/bin:/home/chatwoot/.rvm/bin" Environment="PORT=3000" diff --git a/deployment/chatwoot-worker.1.service b/deployment/chatwoot-worker.1.service index da009a944..66fcbbb53 100644 --- a/deployment/chatwoot-worker.1.service +++ b/deployment/chatwoot-worker.1.service @@ -15,6 +15,7 @@ TimeoutStopSec=30 KillMode=mixed StandardInput=null SyslogIdentifier=%p +LimitNOFILE=65536 MemoryMax=1.2G MemoryHigh=infinity