Skip to content

Commit

Permalink
feature: increase the default size of the core file (#1105)
Browse files Browse the repository at this point in the history
Close #1101.
  • Loading branch information
spacewander authored Feb 4, 2020
1 parent fda20d9 commit abcd197
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion bin/apisix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit abcd197

Please sign in to comment.