Merge pull request #9791 from zhongwencool/crash-dump-doc

chore: more detail about crash dump config
This commit is contained in:
zhongwencool 2023-01-18 09:56:21 +08:00 committed by GitHub
commit bc9d97ea53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 14 deletions

View File

@ -24,9 +24,6 @@
## Sets the maximum number of atoms the virtual machine can handle. ## Sets the maximum number of atoms the virtual machine can handle.
#+t 1048576 #+t 1048576
## Set the location of crash dumps
#-env ERL_CRASH_DUMP {{ platform_log_dir }}/crash.dump
## Set how many times generational garbages collections can be done without ## Set how many times generational garbages collections can be done without
## forcing a fullsweep collection. ## forcing a fullsweep collection.
-env ERL_FULLSWEEP_AFTER 1000 -env ERL_FULLSWEEP_AFTER 1000
@ -40,11 +37,6 @@
## Prevent user from accidentally calling a function from the prompt that could harm a running system. ## Prevent user from accidentally calling a function from the prompt that could harm a running system.
-stdlib restricted_shell emqx_restricted_shell -stdlib restricted_shell emqx_restricted_shell
## Specifies the net_kernel tick time in seconds.
## This is the approximate time a connected node may be unresponsive until
## it is considered down and thereby disconnected.
-kernel net_ticktime 120
## Sets the distribution buffer busy limit (dist_buf_busy_limit). ## Sets the distribution buffer busy limit (dist_buf_busy_limit).
## Preferably set in `emqx.conf`, ## Preferably set in `emqx.conf`,
#+zdbbl 8192 #+zdbbl 8192

View File

@ -480,8 +480,16 @@ the old dir should be deleted first.<br/>
node_crash_dump_seconds { node_crash_dump_seconds {
desc { desc {
en: """The number of seconds that the broker is allowed to spend writing a crash dump.""" en: """This variable gives the number of seconds that the emulator is allowed to spend writing a crash dump. When the given number of seconds have elapsed, the emulator is terminated.
zh: """保存崩溃文件最大允许时间,如果文件太大,在规则时间内没有保存完成,则会直接结束。""" - If setting to 0 seconds, the runtime system does not even attempt to write the crash dump file. It only terminates.
- If setting to a positive value S, wait for S seconds to complete the crash dump file and then terminates the runtime system with a SIGALRM signal.
- A negative value causes the termination of the runtime system to wait indefinitely until the crash dump file has been completely written.
"""
zh: """该配置给出了运行时系统允许花费的写入崩溃转储的秒数。当给定的秒数已经过去,运行时系统将被终止。
- 如果设置为0秒运行时会立即终止不会尝试写入崩溃转储文件。
- 如果设置为一个正数 S节点会等待 S 秒来完成崩溃转储文件然后用SIGALRM信号终止运行时系统。
- 如果设置为一个负值导致运行时系统的终止等待无限期地直到崩溃转储文件已经完全写入。
"""
} }
label { label {
en: "Crash Dump Seconds" en: "Crash Dump Seconds"
@ -491,10 +499,14 @@ the old dir should be deleted first.<br/>
node_crash_dump_bytes { node_crash_dump_bytes {
desc { desc {
en: """The maximum size of a crash dump file in bytes.""" en: """This variable sets the maximum size of a crash dump file in bytes.
The crash dump will be truncated if this limit is exceeded.
If setting it to 0, the runtime system does not even attempt to write a crash dump file.
"""
zh: """限制崩溃文件的大小,当崩溃时节点内存太大, zh: """限制崩溃文件的大小,当崩溃时节点内存太大,
如果为了保存现场,需要全部存到崩溃文件中,此处限制最多能保存多大的文件。 如果为了保存现场,需要全部存到崩溃文件中,此处限制最多能保存多大的文件。
""" 如果超过此限制崩溃转储将被截断。如果设置为0系统不会尝试写入崩溃转储文件。
"""
} }
label { label {
en: "Crash Dump Bytes" en: "Crash Dump Bytes"

View File

@ -487,7 +487,7 @@ fields("node") ->
#{ #{
mapping => "vm_args.-env ERL_CRASH_DUMP", mapping => "vm_args.-env ERL_CRASH_DUMP",
desc => ?DESC(node_crash_dump_file), desc => ?DESC(node_crash_dump_file),
default => "log/erl_crash.dump", default => crash_dump_file_default(),
'readOnly' => true 'readOnly' => true
} }
)}, )},
@ -1296,6 +1296,15 @@ sort_log_levels(Levels) ->
Levels Levels
). ).
crash_dump_file_default() ->
case os:getenv("RUNNER_LOG_DIR") of
false ->
%% testing, or running emqx app as deps
"log/erl_crash.dump";
Dir ->
[filename:join([Dir, "erl_crash.dump"])]
end.
%% utils %% utils
-spec conf_get(string() | [string()], hocon:config()) -> term(). -spec conf_get(string() | [string()], hocon:config()) -> term().
conf_get(Key, Conf) -> conf_get(Key, Conf) ->

View File

@ -3,7 +3,7 @@
{id, "emqx_machine"}, {id, "emqx_machine"},
{description, "The EMQX Machine"}, {description, "The EMQX Machine"},
% strict semver, bump manually! % strict semver, bump manually!
{vsn, "0.1.2"}, {vsn, "0.1.3"},
{modules, []}, {modules, []},
{registered, []}, {registered, []},
{applications, [kernel, stdlib]}, {applications, [kernel, stdlib]},

View File

@ -26,6 +26,14 @@
%% API %% API
-export([lock/0, unlock/0]). -export([lock/0, unlock/0]).
-export([t/1, t2/1, t/2, t2/2, t/3, t2/3]).
lock() -> emqx_restricted_shell:lock(). lock() -> emqx_restricted_shell:lock().
unlock() -> emqx_restricted_shell:unlock(). unlock() -> emqx_restricted_shell:unlock().
t(M) -> recon_trace:calls({M, '_', return_trace}, 300).
t2(M) -> recon_trace:calls({M, '_', return_trace}, 300, [{args, arity}]).
t(M, F) -> recon_trace:calls({M, F, return_trace}, 300).
t2(M, F) -> recon_trace:calls({M, F, return_trace}, 300, [{args, arity}]).
t(M, F, A) -> recon_trace:calls({M, F, A}, 300).
t2(M, F, A) -> recon_trace:calls({M, F, A}, 300, [{args, arity}]).