Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
3321-erts-Flush-all-signals-on-monitor_nodes-do...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3321-erts-Flush-all-signals-on-monitor_nodes-down-signal.patch of Package erlang
From a7cc396f27f8c21363aad712f1758cf7775e1adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org> Date: Wed, 30 Mar 2022 19:58:43 +0200 Subject: [PATCH] erts: Flush all signals on monitor_nodes down signal All signals sent prior to the node going down must be delivered before this one for 'nodedown' to work properly, and conversely all signals sent afterward must be delivered after for 'nodeup' to work. --- erts/emulator/beam/dist.c | 8 ++----- erts/emulator/beam/erl_proc_sig_queue.c | 32 +++++++++++++++++++++---- erts/emulator/beam/erl_proc_sig_queue.h | 27 ++++++++++++++------- erts/emulator/beam/erl_time_sup.c | 10 ++++---- 4 files changed, 51 insertions(+), 26 deletions(-) diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c index 298ae6ebe2..e321ff99f4 100644 --- a/erts/emulator/beam/dist.c +++ b/erts/emulator/beam/dist.c @@ -6460,12 +6460,8 @@ send_nodes_mon_msgs(Process *c_p, Eterm what, Eterm node, Eterm type, Eterm reas hsz += hp - &tmp_heap[0]; - erts_proc_sig_send_persistent_monitor_msg(ERTS_MON_TYPE_NODES, - nmdp[i].options, - am_system, - nmdp[i].pid, - msg, - hsz); + erts_proc_sig_send_monitor_nodes_msg(nmdp[i].options, nmdp[i].pid, + msg, hsz); } if (nmdp != &def_buf[0]) diff --git a/erts/emulator/beam/erl_proc_sig_queue.c b/erts/emulator/beam/erl_proc_sig_queue.c index 78f12d1e8a..f79f6abf16 100644 --- a/erts/emulator/beam/erl_proc_sig_queue.c +++ b/erts/emulator/beam/erl_proc_sig_queue.c @@ -1759,12 +1759,17 @@ erts_proc_sig_send_dist_to_alias(Eterm from, Eterm alias, } } - -void +/** + * @brief Send a persistent monitor triggered signal to a process. + * + * Used by monitors that are not auto disabled such as for + * example 'time_offset' monitors. + */ +static void erts_proc_sig_send_persistent_monitor_msg(Uint16 type, Eterm key, Eterm from, Eterm to, - Eterm msg, Uint msg_sz) -{ + Eterm msg, Uint msg_sz, + int force_flush) { ErtsPersistMonMsg *prst_mon; ErtsMessage *mp; ErlHeapFragment *hfrag; @@ -1816,13 +1821,30 @@ erts_proc_sig_send_persistent_monitor_msg(Uint16 type, Eterm key, ERL_MESSAGE_FROM(mp) = from; ERL_MESSAGE_TOKEN(mp) = am_undefined; - if (!proc_queue_signal(NULL, from, to, (ErtsSignal *) mp, 0, + if (!proc_queue_signal(NULL, from, to, (ErtsSignal *) mp, force_flush, ERTS_SIG_Q_OP_PERSISTENT_MON_MSG)) { mp->next = NULL; erts_cleanup_messages(mp); } } +void +erts_proc_sig_send_monitor_nodes_msg(Eterm key, Eterm to, + Eterm msg, Uint msg_sz) { + erts_proc_sig_send_persistent_monitor_msg(ERTS_MON_TYPE_NODES, + key, am_system, to, + msg, msg_sz, 1); +} + +void +erts_proc_sig_send_monitor_time_offset_msg(Eterm key, Eterm to, + Eterm msg, Uint msg_sz) { + erts_proc_sig_send_persistent_monitor_msg(ERTS_MON_TYPE_TIME_OFFSET, + key, am_clock_service, to, + msg, msg_sz, 0); + +} + static ERTS_INLINE Eterm get_persist_mon_msg(ErtsMessage *sig, Eterm *msg) { diff --git a/erts/emulator/beam/erl_proc_sig_queue.h b/erts/emulator/beam/erl_proc_sig_queue.h index c930f3ce80..bd11c2712e 100644 --- a/erts/emulator/beam/erl_proc_sig_queue.h +++ b/erts/emulator/beam/erl_proc_sig_queue.h @@ -755,16 +755,26 @@ erts_proc_sig_send_dist_demonitor(Eterm from, Eterm to, Eterm ref); /** * - * @brief Send a persistent monitor triggered signal to a process. + * @brief Send a persistent "node down" monitor signal to a process * - * Used by monitors that are not auto disabled such as for - * example 'time_offset' monitors. + * @param[in] key Monitor key. * - * @param[in] type Monitor type. + * @param[in] to Identifier of receiver. * - * @param[in] key Monitor key. + * @param[in] msg Message template. * - * @param[in] from Identifier of sender. + * @param[in] msg_sz Heap size of message template. + * + */ +void +erts_proc_sig_send_monitor_nodes_msg(Eterm key, Eterm to, + Eterm msg, Uint msg_sz); + +/** + * + * @brief Send a persistent "time offset changed" monitor signal to a process + * + * @param[in] key Monitor key. * * @param[in] to Identifier of receiver. * @@ -774,9 +784,8 @@ erts_proc_sig_send_dist_demonitor(Eterm from, Eterm to, Eterm ref); * */ void -erts_proc_sig_send_persistent_monitor_msg(Uint16 type, Eterm key, - Eterm from, Eterm to, - Eterm msg, Uint msg_sz); +erts_proc_sig_send_monitor_time_offset_msg(Eterm key, Eterm to, + Eterm msg, Uint msg_sz); /** * diff --git a/erts/emulator/beam/erl_time_sup.c b/erts/emulator/beam/erl_time_sup.c index 929df53647..963d40b8b0 100644 --- a/erts/emulator/beam/erl_time_sup.c +++ b/erts/emulator/beam/erl_time_sup.c @@ -2018,12 +2018,10 @@ send_time_offset_changed_notifications(void *new_offsetp) for (mix = 0; mix < no_monitors; mix++) { *patch_refp = to_mon_info[mix].ref; - erts_proc_sig_send_persistent_monitor_msg(ERTS_MON_TYPE_TIME_OFFSET, - *patch_refp, - am_clock_service, - to_mon_info[mix].pid, - message_template, - hsz); + erts_proc_sig_send_monitor_time_offset_msg(*patch_refp, + to_mon_info[mix].pid, + message_template, + hsz); } erts_free(ERTS_ALC_T_TMP, tmp); -- 2.34.1
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