Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
No build reason found for SLE-Module-HPC:x86_64
home:Ledest:erlang:26
erlang
1401-Add-stacktrace-in-max-heap-size-log.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1401-Add-stacktrace-in-max-heap-size-log.patch of Package erlang
From 05c52ba036137d6fdeb2205d069ec4261cb23cbb Mon Sep 17 00:00:00 2001 From: Zeyu Zhang <zeyu@fb.com> Date: Fri, 25 Aug 2023 14:21:17 -0700 Subject: [PATCH 1/3] Add stacktrace in max heap size log This commit externs the current_stacktrace function and use it in erl_gc when doing max heap event log. This is especially useful when debugging a process that has been killed by the heap limit. --- erts/emulator/beam/erl_bif_info.c | 9 +++------ erts/emulator/beam/erl_gc.c | 7 ++++++- erts/emulator/beam/erl_process.h | 4 ++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c index 7deec8f329..2265578f37 100644 --- a/erts/emulator/beam/erl_bif_info.c +++ b/erts/emulator/beam/erl_bif_info.c @@ -163,9 +163,6 @@ static char erts_system_version[] = ("Erlang/OTP " ERLANG_OTP_RELEASE static Eterm current_function(Process* p, ErtsHeapFactory *hfact, Process* rp, int full_info, Uint reserve_size, int flags); -static Eterm -current_stacktrace(Process* p, ErtsHeapFactory *hfact, Process* rp, - Uint reserve_size, int flags); Eterm erts_bld_bin_list(Uint **hpp, Uint *szp, ErlOffHeap* oh, Eterm tail) @@ -1506,7 +1503,7 @@ process_info_aux(Process *c_p, break; case ERTS_PI_IX_CURRENT_STACKTRACE: - res = current_stacktrace(c_p, hfact, rp, reserve_size, flags); + res = erts_current_stacktrace(c_p, hfact, rp, reserve_size, flags); break; case ERTS_PI_IX_INITIAL_CALL: @@ -2214,8 +2211,8 @@ current_function(Process *c_p, ErtsHeapFactory *hfact, Process* rp, return res; } -static Eterm -current_stacktrace(Process *p, ErtsHeapFactory *hfact, Process* rp, +Eterm +erts_current_stacktrace(Process *p, ErtsHeapFactory *hfact, Process* rp, Uint reserve_size, int flags) { Uint sz; diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c index 4b41d87ad5..578143e685 100644 --- a/erts/emulator/beam/erl_gc.c +++ b/erts/emulator/beam/erl_gc.c @@ -3725,6 +3725,7 @@ reached_max_heap_size(Process *p, Uint total_heap_size, int alive = erts_is_alive; erts_dsprintf_buf_t *dsbufp = erts_create_logger_dsbuf(); Eterm *o_hp, *hp, args = NIL; + ErtsHeapFactory hfact; /* Build the format message */ erts_dsprintf(dsbufp, " Process: ~p "); @@ -3737,9 +3738,13 @@ reached_max_heap_size(Process *p, Uint total_heap_size, erts_dsprintf(dsbufp, " Error Logger: ~p~n"); erts_dsprintf(dsbufp, " Message Queue Len: ~p~n"); erts_dsprintf(dsbufp, " GC Info: ~p~n"); + erts_dsprintf(dsbufp, " Stacktrace: ~p~n"); /* Build the args in reverse order */ - o_hp = hp = erts_alloc(ERTS_ALC_T_TMP, 2*(alive ? 8 : 7) * sizeof(Eterm)); + o_hp = hp = erts_alloc(ERTS_ALC_T_TMP, 2*(alive ? 9 : 8) * sizeof(Eterm)); + erts_factory_proc_init(&hfact, p); + args = CONS(hp, erts_current_stacktrace(p, &hfact, p, 0 ,0), args); hp += 2; + erts_factory_close(&hfact); args = CONS(hp, msg, args); hp += 2; args = CONS(hp, make_small((p)->sig_inq.len), args); hp += 2; args = CONS(hp, am_true, args); hp += 2; diff --git a/erts/emulator/beam/erl_process.h b/erts/emulator/beam/erl_process.h index cbd6634c4a..f2bc7ad94f 100644 --- a/erts/emulator/beam/erl_process.h +++ b/erts/emulator/beam/erl_process.h @@ -2940,3 +2940,7 @@ float erts_sched_local_random_float(Uint additional_seed) void erts_halt(int code); extern erts_atomic32_t erts_halt_progress; extern int erts_halt_code; + +extern Eterm +erts_current_stacktrace(Process* p, ErtsHeapFactory *hfact, Process* rp, + Uint reserve_size, int flags); -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor