summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRickard Green <rickard@erlang.org>2020-06-12 22:00:23 +0200
committerRickard Green <rickard@erlang.org>2020-06-12 22:36:48 +0200
commitd67fa13604349376948d9fa642e036e67ad8af78 (patch)
tree49fcdd021966bef19a8f9d7aeafff926e1355159
parentd687a6f130d6554728cc250b932bad50bb729502 (diff)
downloaderlang-d67fa13604349376948d9fa642e036e67ad8af78.tar.gz
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.
-rw-r--r--erts/emulator/beam/erl_port_task.c3
1 files changed, 2 insertions, 1 deletions
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
@@ -1873,7 +1873,8 @@ erts_port_task_execute(ErtsRunQueue *runq, Port **curr_port_pp)
if (active) {
ErtsRunQueue *xrunq;
- ASSERT(!(erts_atomic32_read_nob(&pp->state) & ERTS_PORT_SFLGS_DEAD));
+ ASSERT(!(erts_atomic32_read_nob(&pp->state)
+ & ERTS_PORT_SFLG_INITIALIZING));
xrunq = erts_check_emigration_need(runq, ERTS_PORT_PRIO_LEVEL);
ERTS_LC_ASSERT(runq != xrunq);