You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2020/02/04 03:02:14 UTC

[incubator-apisix] branch master updated: feature: increase the default size of the core file (#1105)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new abcd197  feature: increase the default size of the core file (#1105)
abcd197 is described below

commit abcd1973120fc67bbe7f0c43c08e349d2cf9dcad
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Tue Feb 4 11:02:07 2020 +0800

    feature: increase the default size of the core file (#1105)
    
    Close #1101.
---
 bin/apisix | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/bin/apisix b/bin/apisix
index 0102c38..69b7453 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -95,7 +95,7 @@ events {
     worker_connections {* event.worker_connections *};
 }
 
-worker_rlimit_core  500M;
+worker_rlimit_core  {* worker_rlimit_core *};
 working_directory   /tmp/apisix_cores/;
 
 worker_shutdown_timeout 3;
@@ -437,6 +437,17 @@ local function get_openresty_version()
     return nil
 end
 
+local function is_32bit_arch()
+    local ok, ffi = pcall(require, "ffi")
+    if ok then
+        -- LuaJIT
+        return ffi.abi("32bit")
+    end
+    local ret = excute_cmd("getconf LONG_BIT")
+    local bits = tonumber(ret)
+    return bits <= 32
+end
+
 local function split(self, sep)
     local sep, fields = sep or ":", {}
     local pattern = string.format("([^%s]+)", sep)
@@ -517,6 +528,12 @@ local function init()
         error("failed to read `nginx_config` field from yaml file")
     end
 
+    if is_32bit_arch() then
+        sys_conf["worker_rlimit_core"] = "4G"
+    else
+        sys_conf["worker_rlimit_core"] = "16G"
+    end
+
     for k,v in pairs(yaml_conf.apisix) do
         sys_conf[k] = v
     end