File 1029-Change-faulty-assert-checking-that-port-is-not-dead-.patch of Package erlang
From d67fa13604349376948d9fa642e036e67ad8af78 Mon Sep 17 00:00:00 2001 From: Rickard Green <rickard@erlang.org> Date: Fri, 12 Jun 2020 22:00:23 +0200 Subject: [PATCH] Change faulty assert checking that port is not dead at reschedule After scheduled execution of port tasks, a port is rescheduled if there still remain scheduled port tasks on it. The assert checked that the port was not in state ERTS_PORT_SFLGS_DEAD (which is either ERTS_PORT_SFLG_FREE or ERTS_PORT_SFLG_INITIALIZING) when being rescheduled. The port can however be set in state ERTS_PORT_SFLG_FREE between the point where it is determined that it needs to be rescheduled (finalize_exec()) and the actual rescheduling where the assert is. This situation is however not an issue. When this happens the port will be rescheduled and later selected for execution. The first thing that happens when it begins executing is that it will complete termination since it is in state ERTS_PORT_SFLG_FREE. The modified assert now only checks that the port is not in state ERTS_PORT_SFLG_INITIALIZING. --- erts/emulator/beam/erl_port_task.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erts/emulator/beam/erl_port_task.c b/erts/emulator/beam/erl_port_task.c index 0c55e9bae2..3b56e5b574 100644 --- a/erts/emulator/beam/erl_port_task.c +++ b/erts/emulator/beam/erl_port_task.c @@ -1915,7 +1915,8 @@ erts_port_task_execute(ErtsRunQueue *runq, Port **curr_port_pp) ErtsRunQueue *xrunq; #endif - ASSERT(!(erts_atomic32_read_nob(&pp->state) & ERTS_PORT_SFLGS_DEAD)); + ASSERT(!(erts_atomic32_read_nob(&pp->state) + & ERTS_PORT_SFLG_INITIALIZING)); #ifdef ERTS_SMP xrunq = erts_check_emigration_need(runq, ERTS_PORT_PRIO_LEVEL); -- 2.26.2




