You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2022/04/28 03:58:53 UTC

[apisix] branch master updated: fix: allow apisix start when open file descriptors unlimited (#6952)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new a545de5e3 fix: allow apisix start when open file descriptors unlimited (#6952)
a545de5e3 is described below

commit a545de5e337a8b86c004b8940740e42cb19b4bc5
Author: soulbird <zh...@outlook.com>
AuthorDate: Thu Apr 28 11:58:47 2022 +0800

    fix: allow apisix start when open file descriptors unlimited (#6952)
    
    Co-authored-by: soulbird <zh...@gmail.com>
---
 apisix/cli/env.lua | 3 ++-
 apisix/cli/ops.lua | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/apisix/cli/env.lua b/apisix/cli/env.lua
index cf4ffd6af..3c78ab3c1 100644
--- a/apisix/cli/env.lua
+++ b/apisix/cli/env.lua
@@ -33,7 +33,8 @@ return function (apisix_home, pkg_cpath_org, pkg_path_org)
     if not res then
         error("failed to exec ulimit cmd \'ulimit -n \', err: " .. err)
     end
-    local ulimit = tonumber(util.trim(res))
+    local trimed_res = util.trim(res)
+    local ulimit = trimed_res == "unlimited" and trimed_res or tonumber(trimed_res)
     if not ulimit then
         error("failed to fetch current maximum number of open file descriptors")
     end
diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index 6da4fa900..3acdf834f 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -155,7 +155,7 @@ local function init(env)
     end
 
     local min_ulimit = 1024
-    if env.ulimit <= min_ulimit then
+    if env.ulimit ~= "unlimited" and env.ulimit <= min_ulimit then
         print(str_format("Warning! Current maximum number of open file "
                 .. "descriptors [%d] is not greater than %d, please increase user limits by "
                 .. "execute \'ulimit -n <new user limits>\' , otherwise the performance"