Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
4611-erts-Do-not-clear-tracing-if-load-fails-wi...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4611-erts-Do-not-clear-tracing-if-load-fails-with-not_pur.patch of Package erlang
From 7307b7d2b251b354c9bcaae362e2f559a7b51ce9 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson <sverker@erlang.org> Date: Fri, 29 Dec 2023 14:33:54 +0100 Subject: [PATCH 1/2] erts: Do not clear tracing if load fails with 'not_purged' Caused failed ASSERT in erts_debug_check_code_barrier() as erts_blocking_code_barrier() was not called when load was aborted. Change order so we do not block and clear tracing until we know the load will succeed. Could potentially be a problem in old code as well. --- erts/emulator/beam/beam_bif_load.c | 67 +++++++++++++++--------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c index 55aa4253fa..202ac70f3f 100644 --- a/erts/emulator/beam/beam_bif_load.c +++ b/erts/emulator/beam/beam_bif_load.c @@ -453,6 +453,25 @@ finish_loading_1(BIF_ALIST_1) goto done; } + exceptions = 0; + for (i = 0; i < n; i++) { + p[i].exception = THE_NON_VALUE; + if (p[i].modp->curr.code_hdr && p[i].modp->old.code_hdr) { + p[i].exception = am_not_purged; + exceptions++; + } + } + + if (exceptions) { + res = exception_list(BIF_P, am_not_purged, p, exceptions); + goto done; + } + + /* + * Now we can load all code. This can't fail. + */ + do_commit = 1; + for (i = 0; i < n; i++) { if (p[i].modp->curr.num_breakpoints > 0 || p[i].modp->curr.num_traced_exports > 0 || @@ -477,42 +496,24 @@ finish_loading_1(BIF_ALIST_1) exceptions = 0; for (i = 0; i < n; i++) { - p[i].exception = THE_NON_VALUE; - if (p[i].modp->curr.code_hdr && p[i].modp->old.code_hdr) { - p[i].exception = am_not_purged; - exceptions++; - } + Eterm mod; + Eterm retval; + + erts_refc_inc(&p[i].code->intern.refc, 1); + retval = erts_finish_loading(p[i].code, BIF_P, 0, &mod); + ASSERT(retval == NIL || retval == am_on_load); + if (retval == am_on_load) { + p[i].exception = am_on_load; + exceptions++; + } } - if (exceptions) { - res = exception_list(BIF_P, am_not_purged, p, exceptions); - } else { - /* - * Now we can load all code. This can't fail. - */ - - exceptions = 0; - for (i = 0; i < n; i++) { - Eterm mod; - Eterm retval; - - erts_refc_inc(&p[i].code->intern.refc, 1); - retval = erts_finish_loading(p[i].code, BIF_P, 0, &mod); - ASSERT(retval == NIL || retval == am_on_load); - if (retval == am_on_load) { - p[i].exception = am_on_load; - exceptions++; - } - } - - /* - * Check whether any module has an on_load_handler. - */ + /* + * Check whether any module has an on_load_handler. + */ - if (exceptions) { - res = exception_list(BIF_P, am_on_load, p, exceptions); - } - do_commit = 1; + if (exceptions) { + res = exception_list(BIF_P, am_on_load, p, exceptions); } done: -- 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