「too many open files」通常是程序開啟檔案數超過系統限制。可用 ulimit -a 查看目前上限。
ulimit -n 2048
此方式只在目前 shell 生效,重新登入後會恢復。
編輯 /etc/security/limits.conf:
* - nofile 65535
* - nproc 65535
soft 是目前生效值,hard 是使用者可設定的上限。一般使用者只能降低 hard,不能提高;只有 root 可提高 hard。
若登入後仍未生效,可於 /etc/profile 或 rc.local 加入:
ulimit -SHn 51200
調整後重新登入,再用 ulimit -a 確認。