From 825ddd31df595686a2ad584e3346e45115dfe0d0 Mon Sep 17 00:00:00 2001 From: Daniel Gorin Date: Wed, 27 Nov 2024 12:47:12 +0000 Subject: [PATCH 1/2] [pause_proc_timer][1/n] Introduce ErtsPausedProcTimer type and operations We want a way to "pause" a proc timer when suspending a process, and "resume" it later. We will do this as follows. * Pausing a proc timer means: 1. Cancelling the current timer in `common.timer`, if any. 2. Storing in `common.timer` instead how much time was left in the timer. To compute the time left, we need to inspect the current timer. 3. Flagging in the `Process` struct that the timer is paused. This is so that we know later that we need to resume the timer when resuming the process. * Resuming a proc timer then amounts to: 1. Creating a new proc timer based on the time left that was stored in `common.timer`. 2. Clear all the flags in the `Process` struct * When cancelling a proc timer, we now need to check if it is paused (in which case, it can just be ignored) So here we introduce a `ErtsPausedProcTimer` type, that will contain the time remaining on a paused timer, and a header that is shared with all other timer types (so that we can safely insert it in `common.timer`). We also introduce the functions to pause a proc timer and resume it. At this point nothing calls these functions, this happens in the next commits. --- erts/emulator/beam/erl_alloc.types | 1 + erts/emulator/beam/erl_hl_timer.c | 113 +++++++++++++++++++++++++++++ erts/emulator/beam/erl_hl_timer.h | 2 + 3 files changed, 116 insertions(+) diff --git a/erts/emulator/beam/erl_alloc.types b/erts/emulator/beam/erl_alloc.types index 675a8957d5af..d05447e51b3c 100644 --- a/erts/emulator/beam/erl_alloc.types +++ b/erts/emulator/beam/erl_alloc.types @@ -135,6 +135,7 @@ type TIMER_SERVICE LONG_LIVED SYSTEM timer_service type LL_PTIMER FIXED_SIZE PROCESSES ll_ptimer type HL_PTIMER FIXED_SIZE PROCESSES hl_ptimer type BIF_TIMER FIXED_SIZE PROCESSES bif_timer +type PAUSED_TIMER STANDARD PROCESSES paused_timer type TIMER_REQUEST SHORT_LIVED PROCESSES timer_request type BTM_YIELD_STATE SHORT_LIVED PROCESSES btm_yield_state type REG_TABLE STANDARD SYSTEM reg_tab diff --git a/erts/emulator/beam/erl_hl_timer.c b/erts/emulator/beam/erl_hl_timer.c index f77b6fd60408..c4a574055cca 100644 --- a/erts/emulator/beam/erl_hl_timer.c +++ b/erts/emulator/beam/erl_hl_timer.c @@ -100,6 +100,7 @@ typedef enum { #define ERTS_TMR_ROFLG_PROC (((Uint32) 1) << 15) #define ERTS_TMR_ROFLG_PORT (((Uint32) 1) << 16) #define ERTS_TMR_ROFLG_CALLBACK (((Uint32) 1) << 17) +#define ERTS_TMR_ROFLG_PAUSED (((Uint32) 1) << 18) #define ERTS_TMR_ROFLG_SID_MASK \ (ERTS_TMR_ROFLG_HLT - (Uint32) 1) @@ -205,6 +206,12 @@ typedef union { ErtsBifTimer btm; } ErtsTimer; +typedef struct { + ErtsTmrHead head; /* NEED to be first! */ + Sint64 time_left_in_msec; + int count; +} ErtsPausedProcTimer; + typedef ErtsTimer *(*ErtsCreateTimerFunc)(ErtsSchedulerData *esdp, ErtsMonotonicTime timeout_pos, int short_time, ErtsTmrType type, @@ -950,6 +957,54 @@ create_tw_timer(ErtsSchedulerData *esdp, return (ErtsTimer *) tmr; } +/* + * Paused proc timers + */ +static ERTS_INLINE ErtsPausedProcTimer * +create_paused_proc_timer(Process *c_p) +{ + ErtsPausedProcTimer *result = NULL; + erts_aint_t itmr = erts_atomic_read_nob(&c_p->common.timer); + + if (itmr != ERTS_PTMR_NONE && itmr != ERTS_PTMR_TIMEDOUT) { + ErtsSchedulerData *esdp = erts_proc_sched_data(c_p); + ErtsTimer *tmr = (ErtsTimer *)itmr; + + if (tmr->head.roflgs & ERTS_TMR_ROFLG_PAUSED) { + // The process timer was already paused, reuse the paused timer + ErtsPausedProcTimer *pptmr = (ErtsPausedProcTimer*) tmr; + pptmr->count++; + } else { + int is_hlt = !!(tmr->head.roflgs & ERTS_TMR_ROFLG_HLT); + ErtsMonotonicTime timeout_pos; + + ASSERT(tmr->head.roflgs & ERTS_TMR_ROFLG_PROC); + + result = erts_alloc(ERTS_ALC_T_PAUSED_TIMER, + sizeof(ErtsPausedProcTimer)); + result->head.roflgs = tmr->head.roflgs | ERTS_TMR_ROFLG_PAUSED; + erts_atomic32_init_nob(&result->head.refc, 1); + result->head.receiver.proc = tmr->head.receiver.proc; + + timeout_pos = (is_hlt + ? tmr->hlt.timeout + : erts_tweel_read_timeout(&tmr->twt.u.tw_tmr)); + result->time_left_in_msec = get_time_left(esdp, timeout_pos); + result->count = 1; + } + } + + return result; +} + +static ERTS_INLINE void +paused_proc_timer_dec_refc(ErtsPausedProcTimer *pptmr) +{ + if (erts_atomic32_dec_read_relb(&pptmr->head.refc) == 0) { + erts_free(ERTS_ALC_T_PAUSED_TIMER, (void *) pptmr); + } +} + /* * Basic high level timer stuff */ @@ -1665,6 +1720,11 @@ continue_cancel_ptimer(ErtsSchedulerData *esdp, ErtsTimer *tmr) { Uint32 sid = (tmr->head.roflgs & ERTS_TMR_ROFLG_SID_MASK); + if (tmr->head.roflgs & ERTS_TMR_ROFLG_PAUSED) { + paused_proc_timer_dec_refc((ErtsPausedProcTimer*) tmr); + return; + } + if (esdp->no != sid) queue_canceled_timer(esdp, sid, tmr); else @@ -2714,6 +2774,59 @@ erts_cancel_proc_timer(Process *c_p) (ErtsTimer *) tval); } +void +erts_pause_proc_timer(Process *c_p) +{ + ErtsPausedProcTimer *pptmr; + + ERTS_LC_ASSERT((ERTS_PROC_LOCK_MAIN | ERTS_PROC_LOCK_STATUS) + & erts_proc_lc_my_proc_locks(c_p)); + + pptmr = create_paused_proc_timer(c_p); + if (!pptmr) { + return; + } + + CANCEL_TIMER(c_p); + + erts_atomic_set_nob(&c_p->common.timer, (erts_aint_t) pptmr); +} + +int +erts_resume_paused_proc_timer(Process *c_p) +{ + erts_aint_t timer; + int resumed_timer = 0; + + ERTS_LC_ASSERT((ERTS_PROC_LOCK_MAIN | ERTS_PROC_LOCK_STATUS) + & erts_proc_lc_my_proc_locks(c_p)); + + timer = erts_atomic_xchg_nob(&c_p->common.timer, ERTS_PTMR_NONE); + + ASSERT(timer != ERTS_PTMR_TIMEDOUT); + + if (timer != ERTS_PTMR_NONE) { + UWord tmo = 0; + ErtsPausedProcTimer *pptmr = (ErtsPausedProcTimer *)timer; + + ASSERT(pptmr->head.roflgs & ERTS_TMR_ROFLG_PAUSED); + + pptmr->count -= 1; + if (pptmr->count == 0) { + if (pptmr->time_left_in_msec > 0) { + ASSERT((pptmr->time_left_in_msec >> 32) == 0); + tmo = (UWord) pptmr->time_left_in_msec; + } + + erts_set_proc_timer_uword(c_p, tmo); + paused_proc_timer_dec_refc(pptmr); + resumed_timer = 1; + } + } + + return resumed_timer; +} + void erts_set_port_timer(Port *c_prt, Sint64 tmo) { diff --git a/erts/emulator/beam/erl_hl_timer.h b/erts/emulator/beam/erl_hl_timer.h index 3a864a733092..78fcb2ac8713 100644 --- a/erts/emulator/beam/erl_hl_timer.h +++ b/erts/emulator/beam/erl_hl_timer.h @@ -53,6 +53,8 @@ size_t erts_timer_type_size(ErtsAlcType_t type); int erts_set_proc_timer_term(Process *, Eterm); void erts_set_proc_timer_uword(Process *, UWord); void erts_cancel_proc_timer(Process *); +void erts_pause_proc_timer(Process *); +int erts_resume_paused_proc_timer(Process *); void erts_set_port_timer(Port *, Sint64); void erts_cancel_port_timer(Port *); Sint64 erts_read_port_timer(Port *); From 188faf19b9589112ca53fd0f5a1c0b3819dcdf43 Mon Sep 17 00:00:00 2001 From: Daniel Gorin Date: Wed, 27 Nov 2024 15:01:01 +0000 Subject: [PATCH 2/2] [pause_proc_timer][2/n] Add pause_proc_timer option to suspend_process/2 We add a new `pause_proc_timer` option to the `erlang:suspend_process/2` BIF. When given, the process is not only suspended, but its proc timer, if set, will be paused. This means that if the paused process is waiting on a `receive`, it will not timeout even if suspended for long. Each time pause_proc_timer is given, a counter is bumped in the suspend-process monitor. In order to decrease it, the (new) BIF `erlang:resume_process/2` needs to be called with the option `resume_proc_timer`. When the count reaches zero, the timer is resumed (even though the process may still be suspended). We add testcases for this functionality --- erts/emulator/beam/atom.names | 2 + erts/emulator/beam/bif.tab | 2 +- erts/emulator/beam/erl_monitor_link.c | 1 + erts/emulator/beam/erl_monitor_link.h | 1 + erts/emulator/beam/erl_proc_sig_queue.c | 30 ++--- erts/emulator/beam/erl_process.c | 108 +++++++++++++++-- erts/emulator/test/process_SUITE.erl | 151 +++++++++++++++++++++++- erts/preloaded/ebin/erlang.beam | Bin 40020 -> 40060 bytes erts/preloaded/ebin/erts_internal.beam | Bin 10000 -> 10000 bytes erts/preloaded/src/erlang.erl | 47 +++++++- erts/preloaded/src/erts_internal.erl | 3 +- 11 files changed, 313 insertions(+), 32 deletions(-) diff --git a/erts/emulator/beam/atom.names b/erts/emulator/beam/atom.names index c264082e7561..d122cac4ba4e 100644 --- a/erts/emulator/beam/atom.names +++ b/erts/emulator/beam/atom.names @@ -553,6 +553,7 @@ atom parent atom Plus='+' atom PlusPlus='++' atom pause +atom pause_proc_timer atom pending atom pending_driver atom pending_process @@ -615,6 +616,7 @@ atom reset atom reset_seq_trace atom restart atom resume +atom resume_proc_timer atom return_from atom return_to atom return_to_trace diff --git a/erts/emulator/beam/bif.tab b/erts/emulator/beam/bif.tab index c7aa2bff1c78..1b2823351a98 100644 --- a/erts/emulator/beam/bif.tab +++ b/erts/emulator/beam/bif.tab @@ -220,7 +220,7 @@ bif erlang:seq_trace_info/1 bif erlang:seq_trace_print/1 bif erlang:seq_trace_print/2 bif erts_internal:suspend_process/2 -bif erlang:resume_process/1 +bif erlang:resume_process/2 bif erts_internal:process_display/2 bif erlang:bump_reductions/1 diff --git a/erts/emulator/beam/erl_monitor_link.c b/erts/emulator/beam/erl_monitor_link.c index 59506b10510c..2d53dead491e 100644 --- a/erts/emulator/beam/erl_monitor_link.c +++ b/erts/emulator/beam/erl_monitor_link.c @@ -1048,6 +1048,7 @@ erts_monitor_create(Uint16 type, Eterm ref, Eterm orgn, Eterm trgt, Eterm name, msp->next = NULL; erts_atomic_init_relb(&msp->state, 0); + msp->ptimer_count = 0; erts_atomic32_init_nob(&mdp->refc, 2); break; } diff --git a/erts/emulator/beam/erl_monitor_link.h b/erts/emulator/beam/erl_monitor_link.h index d099800c9780..574da11e2b17 100644 --- a/erts/emulator/beam/erl_monitor_link.h +++ b/erts/emulator/beam/erl_monitor_link.h @@ -733,6 +733,7 @@ struct ErtsMonitorSuspend__ { ErtsMonitorData md; /* origin = suspender; target = suspendee */ ErtsMonitorSuspend *next; erts_atomic_t state; + int ptimer_count; }; #define ERTS_MSUSPEND_STATE_FLG_ACTIVE ((erts_aint_t) (((Uint) 1) << (sizeof(Uint)*8 - 1))) #define ERTS_MSUSPEND_STATE_COUNTER_MASK (~ERTS_MSUSPEND_STATE_FLG_ACTIVE) diff --git a/erts/emulator/beam/erl_proc_sig_queue.c b/erts/emulator/beam/erl_proc_sig_queue.c index ea0fa38848bd..3f19a1558e71 100644 --- a/erts/emulator/beam/erl_proc_sig_queue.c +++ b/erts/emulator/beam/erl_proc_sig_queue.c @@ -4992,6 +4992,19 @@ handle_process_info(Process *c_p, ErtsSigRecvTracing *tracing, return ((int) reds)*4 + 8; } +static void +activate_suspend_monitor(Process *c_p, ErtsMonitorSuspend *msp) +{ + erts_aint_t mstate; + + ASSERT(msp->ptimer_count == 0); + + mstate = erts_atomic_read_bor_acqb(&msp->state, + ERTS_MSUSPEND_STATE_FLG_ACTIVE); + ASSERT(!(mstate & ERTS_MSUSPEND_STATE_FLG_ACTIVE)); (void) mstate; + erts_suspend(c_p, ERTS_PROC_LOCK_MAIN, NULL); +} + static void handle_suspend(Process *c_p, ErtsMonitor *mon, int *yieldp) { @@ -5000,14 +5013,8 @@ handle_suspend(Process *c_p, ErtsMonitor *mon, int *yieldp) ASSERT(mon->type == ERTS_MON_TYPE_SUSPEND); if (!(state & ERTS_PSFLG_DIRTY_RUNNING)) { - ErtsMonitorSuspend *msp; - erts_aint_t mstate; - - msp = (ErtsMonitorSuspend *) erts_monitor_to_data(mon); - mstate = erts_atomic_read_bor_acqb(&msp->state, - ERTS_MSUSPEND_STATE_FLG_ACTIVE); - ASSERT(!(mstate & ERTS_MSUSPEND_STATE_FLG_ACTIVE)); (void) mstate; - erts_suspend(c_p, ERTS_PROC_LOCK_MAIN, NULL); + ErtsMonitorSuspend *msp = (ErtsMonitorSuspend *) erts_monitor_to_data(mon); + activate_suspend_monitor(c_p, msp); *yieldp = !0; } else { @@ -5213,12 +5220,7 @@ erts_proc_sig_handle_pending_suspend(Process *c_p) msp->next = NULL; if (!(state & ERTS_PSFLG_EXITING) && erts_monitor_is_in_table(&msp->md.u.target)) { - erts_aint_t mstate; - - mstate = erts_atomic_read_bor_acqb(&msp->state, - ERTS_MSUSPEND_STATE_FLG_ACTIVE); - ASSERT(!(mstate & ERTS_MSUSPEND_STATE_FLG_ACTIVE)); (void) mstate; - erts_suspend(c_p, ERTS_PROC_LOCK_MAIN, NULL); + activate_suspend_monitor(c_p, msp); } erts_monitor_release(&msp->md.u.target); diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index 0798b8ea650b..754630fd9de4 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -8896,6 +8896,11 @@ erts_start_schedulers(void) } } +static Eterm +sched_pause_proc_timer(Process *c_p, void *vst, int *redsp, ErlHeapFragment **bp); +static Eterm +sched_resume_paused_proc_timer(Process *c_p, void *vst, int *redsp, ErlHeapFragment **bp); + BIF_RETTYPE erts_internal_suspend_process_2(BIF_ALIST_2) { @@ -8906,6 +8911,7 @@ erts_internal_suspend_process_2(BIF_ALIST_2) int sync = 0; int async = 0; int unless_suspending = 0; + int pause_proc_timer = 0; erts_aint_t mstate; ErtsMonitorSuspend *msp; ErtsMonitorData *mdp; @@ -8930,6 +8936,9 @@ erts_internal_suspend_process_2(BIF_ALIST_2) case am_asynchronous: async = 1; break; + case am_pause_proc_timer: + pause_proc_timer = 1; + break; default: { if (is_tuple_arity(arg, 2)) { Eterm *tp = tuple_val(arg); @@ -9029,15 +9038,35 @@ erts_internal_suspend_process_2(BIF_ALIST_2) sync = !async; } else { - noproc: - erts_monitor_tree_delete(&ERTS_P_MONITORS(BIF_P), &mdp->origin); - erts_monitor_release_both(mdp); - if (!async) - res = am_badarg; + goto noproc; + } + } + } + + if (pause_proc_timer) { + int proc_timer_already_paused = msp->ptimer_count++; + + if (!proc_timer_already_paused) { + Eterm res; + res = erts_proc_sig_send_rpc_request(BIF_P, + BIF_ARG_1, + 0, /* no reply */ + sched_pause_proc_timer, + NULL); + if (is_non_value(res)) { + goto noproc; } } } + while(0) { + noproc: + erts_monitor_tree_delete(&ERTS_P_MONITORS(BIF_P), &mdp->origin); + erts_monitor_release_both(mdp); + if (!async) + res = am_badarg; + } + if (sync) { ASSERT(is_non_value(reply_tag)); reply_res = res; @@ -9052,22 +9081,43 @@ erts_internal_suspend_process_2(BIF_ALIST_2) } /* - * The erlang:resume_process/1 BIF + * The erlang:resume_process/2 BIF */ BIF_RETTYPE -resume_process_1(BIF_ALIST_1) +resume_process_2(BIF_ALIST_2) { ErtsMonitor *mon; ErtsMonitorSuspend *msp; erts_aint_t mstate; - + int prev_suspend_count; + int resume_proc_timer = 0; + if (BIF_P->common.id == BIF_ARG_1) BIF_ERROR(BIF_P, BADARG); if (!is_internal_pid(BIF_ARG_1)) BIF_ERROR(BIF_P, BADARG); + if (is_not_nil(BIF_ARG_2)) { + /* Parse option list */ + Eterm arg = BIF_ARG_2; + while (is_list(arg)) { + Eterm *lp = list_val(arg); + arg = CAR(lp); + switch (arg) { + case am_resume_proc_timer: + resume_proc_timer = 1; + break; + default: + BIF_ERROR(BIF_P, BADARG); + } + arg = CDR(lp); + } + if (is_not_nil(arg)) + BIF_ERROR(BIF_P, BADARG); + } + mon = erts_monitor_tree_lookup(ERTS_P_MONITORS(BIF_P), BIF_ARG_1); if (!mon) { @@ -9078,18 +9128,56 @@ resume_process_1(BIF_ALIST_1) ASSERT(mon->type == ERTS_MON_TYPE_SUSPEND); msp = (ErtsMonitorSuspend *) erts_monitor_to_data(mon); + if (resume_proc_timer && msp->ptimer_count == 0) { + BIF_ERROR(BIF_P, BADARG); + } + mstate = erts_atomic_dec_read_relb(&msp->state); + prev_suspend_count = mstate & ERTS_MSUSPEND_STATE_COUNTER_MASK; + + ASSERT(prev_suspend_count >= 0); - ASSERT((mstate & ERTS_MSUSPEND_STATE_COUNTER_MASK) >= 0); + if (msp->ptimer_count == prev_suspend_count + 1 && !resume_proc_timer) { + erts_atomic_inc_nob(&msp->state); + BIF_ERROR(BIF_P, BADARG); + } - if ((mstate & ERTS_MSUSPEND_STATE_COUNTER_MASK) == 0) { + if (prev_suspend_count == 0) { erts_monitor_tree_delete(&ERTS_P_MONITORS(BIF_P), mon); erts_proc_sig_send_demonitor(&BIF_P->common, BIF_P->common.id, 0, mon); } + if (resume_proc_timer) { + int needs_to_resume_timer = --msp->ptimer_count == 0; + if (needs_to_resume_timer) { + erts_proc_sig_send_rpc_request(BIF_P, + BIF_ARG_1, + 0, /* no reply */ + sched_resume_paused_proc_timer, + NULL); + } + } + BIF_RET(am_true); } +static Eterm +sched_pause_proc_timer(Process *c_p, void *vst, int *redsp, ErlHeapFragment **bp) +{ + erts_pause_proc_timer(c_p); + *redsp = 1; + return THE_NON_VALUE; +} + +static Eterm +sched_resume_paused_proc_timer(Process *c_p, void *vst, int *redsp, ErlHeapFragment **bp) +{ + erts_resume_paused_proc_timer(c_p); + *redsp = 1; + return THE_NON_VALUE; +} + + BIF_RETTYPE erts_internal_is_process_executing_dirty_1(BIF_ALIST_1) { diff --git a/erts/emulator/test/process_SUITE.erl b/erts/emulator/test/process_SUITE.erl index 9680eb5836fd..4d884ec49a76 100644 --- a/erts/emulator/test/process_SUITE.erl +++ b/erts/emulator/test/process_SUITE.erl @@ -24,6 +24,7 @@ %% exit/1 %% exit/2 %% process_info/1,2 +%% suspend_process/2 (partially) %% register/2 (partially) -include_lib("stdlib/include/assert.hrl"). @@ -56,6 +57,10 @@ process_info_msgq_len_no_very_long_delay/1, process_info_dict_lookup/1, process_info_label/1, + suspend_process_pausing_proc_timer/1, + suspend_process_pausing_proc_timer_after_suspended/1, + resume_process_resuming_proc_timer_can_resume_timer_early/1, + suspend_process_pausing_proc_needs_balanced_resume_procs/1, bump_reductions/1, low_prio/1, binary_owner/1, yield/1, yield2/1, otp_4725/1, dist_unlink_ack_exit_leak/1, bad_register/1, garbage_collect/1, otp_6237/1, @@ -131,6 +136,7 @@ all() -> otp_6237, {group, spawn_request}, {group, process_info_bif}, + {group, suspend_process_bif}, {group, processes_bif}, {group, otp_7738}, garb_other_running, {group, system_task}, @@ -185,6 +191,11 @@ groups() -> process_info_msgq_len_no_very_long_delay, process_info_dict_lookup, process_info_label]}, + {suspend_process_bif, [], + [suspend_process_pausing_proc_timer, + suspend_process_pausing_proc_timer_after_suspended, + resume_process_resuming_proc_timer_can_resume_timer_early, + suspend_process_pausing_proc_needs_balanced_resume_procs]}, {otp_7738, [], [otp_7738_waiting, otp_7738_suspended, otp_7738_resume]}, @@ -1775,6 +1786,144 @@ proc_dict_helper() -> end, proc_dict_helper(). +suspend_process_pausing_proc_timer(_Config) -> + BeforeSuspend = fun(_Pid) -> ok end, + AfterResume = fun(_Pid) -> ok end, + suspend_process_pausing_proc_timer_aux(BeforeSuspend, AfterResume), + ok. + +suspend_process_pausing_proc_timer_after_suspended(_Config) -> + % We suspend the process once before using pause_proc_timer + BeforeSuspend = fun(Pid) -> true = erlang:suspend_process(Pid) end, + AfterResume = fun(Pid) -> true = erlang:resume_process(Pid) end, + suspend_process_pausing_proc_timer_aux(BeforeSuspend, AfterResume), + ok. + +suspend_process_pausing_proc_timer_aux(BeforeSuspend, AfterResume) -> + TcProc = self(), + Pid = erlang:spawn_link( + fun() -> + TcProc ! {sync, self()}, + receive go -> ok + after 2_000 -> exit(timer_not_paused) + end, + TcProc ! {sync, self()}, + receive _ -> error(unexpected) + after 2_000 -> ok + end, + TcProc ! {sync, self()} + end + ), + + WaitForSync = fun () -> + receive {sync, Pid} -> ok + after 10_000 -> error(timeout) + end + end, + EnsureWaiting = fun() -> + wait_until(fun () -> process_info(Pid, status) == {status, waiting} end) + end, + + WaitForSync(), + EnsureWaiting(), + + BeforeSuspend(Pid), + true = erlang:suspend_process(Pid, [pause_proc_timer]), + timer:sleep(5_000), + true = erlang:resume_process(Pid, [resume_proc_timer]), + AfterResume(Pid), + timer:sleep(1_000), + Pid ! go, + + WaitForSync(), + EnsureWaiting(), + + BeforeSuspend(Pid), + true = erlang:suspend_process(Pid, [pause_proc_timer]), + true = erlang:resume_process(Pid, [resume_proc_timer]), + AfterResume(Pid), + WaitForSync(), + ok. + +resume_process_resuming_proc_timer_can_resume_timer_early(_Config) -> + TcProc = self(), + Pid = erlang:spawn_link( + fun() -> + TcProc ! {sync, self()}, + receive go -> error(received_go) + after 2_000 -> TcProc ! {sync, self()} + end + end + ), + + WaitForSync = fun () -> + receive {sync, Pid} -> ok + after 10_000 -> error(timeout) + end + end, + EnsureWaiting = fun() -> + wait_until(fun () -> process_info(Pid, status) == {status, waiting} end) + end, + + + WaitForSync(), + EnsureWaiting(), + + % Suspend twice, but pause the proc timer only once + true = erlang:suspend_process(Pid), + true = erlang:suspend_process(Pid, [pause_proc_timer]), + + % Pid is suspended so will not process it just yet + Pid ! go, + + % At this point the process is still suspended but the timer is running again + true = erlang:resume_process(Pid, [resume_proc_timer]), + ?assertEqual({status, suspended}, process_info(Pid, status)), + + % The timer must have expired by now + timer:sleep(5_000), + + true = erlang:resume_process(Pid), + WaitForSync(), + + ok. + +suspend_process_pausing_proc_needs_balanced_resume_procs(_Config) -> + Pid = erlang:spawn_link(timer, sleep, [infinity]), + + true = erlang:suspend_process(Pid), + ?assertEqual({status, suspended}, process_info(Pid, status)), + + % No pause_proc_timer so far, so fail + ?assertMatch({'EXIT', {badarg, _}}, + catch erlang:resume_process(Pid, [resume_proc_timer])), + ?assertEqual({status, suspended}, process_info(Pid, status)), + + + true = erlang:suspend_process(Pid), + true = erlang:suspend_process(Pid, [pause_proc_timer]), + true = erlang:suspend_process(Pid, [pause_proc_timer]), + + % It is ok to do out-of-order resumes; here one that doesn't resume the timer + true = erlang:resume_process(Pid), + ?assertEqual({status, suspended}, process_info(Pid, status)), + + % Do more resumes, in any order + true = erlang:resume_process(Pid, [resume_proc_timer]), + true = erlang:resume_process(Pid), + ?assertEqual({status, suspended}, process_info(Pid, status)), + + % Only one suspend remains, and it used pause_proc_timer, so fail if not resuming timer + ?assertMatch({'EXIT', {badarg, _}}, + catch erlang:resume_process(Pid)), + ?assertEqual({status, suspended}, process_info(Pid, status)), + + % Final resume, now running + true = erlang:resume_process(Pid, [resume_proc_timer]), + ?assertEqual({status, running}, process_info(Pid, status)), + + ok. + %% Tests erlang:bump_reductions/1. bump_reductions(Config) when is_list(Config) -> erlang:garbage_collect(), @@ -3139,7 +3288,7 @@ spawn_huge_arglist_test(Local, Node, ArgList) -> {'DOWN', R2, process, Pid2, Reason2} -> ArgList = Reason2 end, - + {Pid3, R3} = case Local of true -> spawn_opt(?MODULE, huge_arglist_child, ArgList, [monitor]); diff --git a/erts/preloaded/ebin/erlang.beam b/erts/preloaded/ebin/erlang.beam index aed9bed6838349c5fb5c2d61bf304db0043e8170..7f3e5241be2fe1bd147e95cdbe1815030d3de495 100644 GIT binary patch delta 18578 zcmbWf3wRU77dD>lrcg?ew3{|LEzm%E2}zr7NR<`@mR?{%1H}SWL_k1UDy!9^q5=U? ziQsA>sEnZC9aI!WyelYzR}^okKQD;)JKpcY|DDMe3i$t?=llAwnUi;C&N*}D%sDf& z8{T{*?Vm@|h722hQpDj{J-eoUXzaw9XP@D4WcGC&{BwF84*634b;RNki4ki@+&to` z5nD#=9`W{wJtOu~x&mr?Ewl)H^`pQYS4DfcbP{fKh+ zQtmI5`zz)CL%IJ_o=ka8%IivbS(K+xo}2P|P+m{U^HW|e<<(K%WXhXDc_!tZO?gWw zZz<(nM|sy%-Y&{}jXV+Z^dpZ>o)P3}AkXRKnM$7X$#YShJQtAXDe`P3&+FuQgS_eF z?L^)R@~Y&mBX2!<4f4(;Z!<;SqR876d6&Ga$$KMtH<9;2^1e^r56JsHdG`^?L{6ei zqOL?WM72bx5ltdGm*_m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@sN>%|`>85aolOlDjN_$IK6KT0wd3OI`yivZsYIJ@=G zpZ^`o2E1w%)N-)m7vt#%4h-Bgi>o(u4ci}s-9H#q${n&qImpxvNb9C|0{YaIF$&{sS3 zN1!c-{t)z44*fpb?hgGf@GBkqZP3XCzHnvR(JXQ3`#~>u=nbHUIrK>mjjwJU^iUAo zxH{0d1YHAqpu>+pikB)=v<$bq&PwsfaJy@+LnpY~EARzI$iF)@zRJIX#u*M5D#O)+ z<~%=wM$8EOd(aWijQ@K;he2~5?ztWg&u-8mhlhL4@vh802Lq9Y(1E+IyVHTYuGpdB zIw=U6^KjR7b8zmuB8Ps(p*hd9paa0UL612!AHV~k3myC}&|N`u{#(C?BBeDQ(_ z|Ku}4D(7Z3aAawxF>5ga< zuQ^{b(Z1@?P$)V>K^l(M4jO|HeK(`QXoW$K zI5d~}5NMhEpLcjre8C6kjc9-g{65gY1bwf#o#MG0*dbh8@p`leaq+%)pykVptSBJg` z?Ezfepe1PcJ2cNJzu@A=A$SFy;DRo|m!EO*4hzu!}t&pBv+aA-uk zYp+8i+FghXVbE-c<}#Z=e}{|H2zJ-E4vk<>xV~||Oh@~*L!XWoK_xm&LHngcPeMBb z7dQGev>}H+7405}J{c_!LauB)+Rq(&EZWZ;dJNj#f=;;7>Ot%hUtDP;(ekLpzqAqf z_!JixbRt@0EJ5pNKgPw47>brhHs=|F_B~wOy#vr9Vex-y{qQjb7w4%)`wlMNw-2ZJ z{NrC*Z+yJP3H*;aH17~`Xnv~)K6c>Zc%egc{yflc;BtfJxr5W(h#a)9sd(}sT%kE`c7f&V;~o^!c2WnObm_WuDbF0cv! diff --git a/erts/preloaded/ebin/erts_internal.beam b/erts/preloaded/ebin/erts_internal.beam index 928de46229dfe8b2929154d4f9eb60142827861f..26e3dffa64b6bbbc308c3ccf56326a52b2c44863 100644 GIT binary patch delta 193 zcmV~$%`1Ze0KnnAj>>(9-L@M^cHS;lgja3Nh3vNZ6=iEgBOjyoi^J>2g$pMRnvW7? z2Zxnf4y4>U@-KLvD2&4E>7K0#CdrX!mN^!HMV45mLX8#HSZ9Mxw%K8ieGWL}m=jJp z;GjberyMbD#!<75 gIqsC91!tVMXvwk_tJYk#?ye1+YUI&P5cDVi0S0zijsO4v delta 193 zcmV~$K`Vm+0D$549d~ecaMMmC$(760WNcY>vFtXyQKk`@nwjF|;Ja~|3nwl#t2H$T z2c_gdYIlzOhCNT13RCy#NM(j3^JG{g#|o>gvCalXN^G&iE@k$qa6pYCPC4U(OX^&4 z%?-EQ@j!z|nzU&1M28oidF73FKKSH|Z@T>O%OC$n42(MHfc*|R?1-b|jyd6^ai>f; g?W}Vyn03j#1(z+lX~}K(ta|9NC!QNNf}k(f1LVP3Gynhq diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl index 3c950c0a2f53..c6d850833b02 100644 --- a/erts/preloaded/src/erlang.erl +++ b/erts/preloaded/src/erlang.erl @@ -467,7 +467,7 @@ A list of binaries. This datatype is useful to use together with -export([process_flag/3, process_info/1, processes/0, purge_module/1]). -export([put/2, raise/3, read_timer/1, read_timer/2, ref_to_list/1, register/2]). -export([send_after/3, send_after/4, start_timer/3, start_timer/4]). --export([registered/0, resume_process/1, round/1, self/0]). +-export([registered/0, resume_process/1, resume_process/2, round/1, self/0]). -export([seq_trace/2, seq_trace_print/1, seq_trace_print/2, setnode/2]). -export([setnode/3, size/1, spawn/3, spawn_link/3, split_binary/2]). -export([suspend_process/2, system_monitor/0]). @@ -5471,6 +5471,21 @@ registered() -> %% resume_process/1 -doc """ Decreases the suspend count on the process identified by `Suspendee`. +Equivalent to calling [`erlang:resume_process(Suspendee, [])`](`resume_process/2`). + +> #### Warning {: .warning } +> +> This BIF is intended for debugging only. +""". +-doc #{ group => processes }. +-spec resume_process(Suspendee) -> true when + Suspendee :: pid(). +resume_process(Suspendee) -> + resume_process(Suspendee, []). + +%% resume_process/2 +-doc """ +Decreases the suspend count on the process identified by `Suspendee`. `Suspendee` is previously to have been suspended through [`erlang:suspend_process/2`](`suspend_process/2`) or @@ -5479,6 +5494,11 @@ Decreases the suspend count on the process identified by `Suspendee`. reaches zero, `Suspendee` is resumed, that is, its state is changed from suspended into the state it had before it was suspended. +Options (`Opt`s): + +- **`resume_proc_timer`** - Decrease the paused time count. If it reaches + zero, the timer will be resumed. + > #### Warning {: .warning } > > This BIF is intended for debugging only. @@ -5491,14 +5511,25 @@ Failures: previously increased the suspend count on the process identified by `Suspendee`. +- **`badarg`** - If the `resume_proc_timer` `Opt` is given, but the paused + timer count is already 0; or if it was not given and the paused timer + counte equals the suspended count. Intuitively, the usages of the + `pause_proc_timer` option of [`suspend_process/2`] and `resume_proc_timer` + need to balance out. + - **`badarg`** - If the process identified by `Suspendee` is not alive. + +- **`badarg`** - If `OptList` is not a proper list of valid `Opt`s. """. -doc #{ group => processes }. --spec resume_process(Suspendee) -> true when - Suspendee :: pid(). -resume_process(_Suspendee) -> +-spec resume_process(Suspendee, OptList) -> true when + Suspendee :: pid(), + OptList :: [Opt], + Opt :: resume_proc_timer. +resume_process(_Suspendee, _OptList) -> erlang:nif_error(undefined). + %% round/1 %% Shadowed by erl_bif_types: erlang:round/1 -doc """ @@ -5850,6 +5881,11 @@ Options (`Opt`s): Apart from the reply message, the `{asynchronous, ReplyTag}` option behaves exactly the same as the `asynchronous` option without reply tag. +- **`pause_proc_timer`** - If `Suspendee` is waiting on a message, pause the timer + associated with the `after` clause. The paused timer count is increased, so + a corresponding call to [`resume_process/2`] will need to use the `resume_proc_timer` + option to decrease it. + - **`unless_suspending`** - The process identified by `Suspendee` is suspended unless the calling process already is suspending `Suspendee`. If `unless_suspending` is combined with option `asynchronous`, a suspend request @@ -5896,7 +5932,8 @@ Failures: -spec suspend_process(Suspendee, OptList) -> boolean() when Suspendee :: pid(), OptList :: [Opt], - Opt :: unless_suspending | asynchronous | {asynchronous, term()}. + Opt :: unless_suspending | pause_proc_timer + | asynchronous | {asynchronous, term()}. suspend_process(Suspendee, OptList) -> case case erts_internal:suspend_process(Suspendee, OptList) of Ref when erlang:is_reference(Ref) -> diff --git a/erts/preloaded/src/erts_internal.erl b/erts/preloaded/src/erts_internal.erl index e0aaf5ee6af8..10e6204a041c 100644 --- a/erts/preloaded/src/erts_internal.erl +++ b/erts/preloaded/src/erts_internal.erl @@ -837,7 +837,8 @@ gather_carrier_info(_) -> Result :: boolean() | 'badarg' | reference(), Suspendee :: pid(), OptList :: [Opt], - Opt :: unless_suspending | asynchronous | {asynchronous, term()}. + Opt :: unless_suspending | pause_proc_timer + | asynchronous | {asynchronous, term()}. suspend_process(_Suspendee, _OptList) -> erlang:nif_error(undefined).