aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/dist.c11
-rw-r--r--erts/emulator/beam/erl_node_tables.c6
2 files changed, 12 insertions, 5 deletions
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c
index f5491fd92a..cd799e04b8 100644
--- a/erts/emulator/beam/dist.c
+++ b/erts/emulator/beam/dist.c
@@ -3630,6 +3630,17 @@ static Sint abort_connection(DistEntry* dep, Uint32 conn_id)
delete_cache(cache);
free_de_out_queues(dep, obuf);
+
+ /*
+ * We wait to make DistEntry idle and accept new connection attempts
+ * until all is cleared and deallocated. This to get some back pressure
+ * against repeated failing connection attempts saturating all CPUs
+ * with cleanup jobs.
+ */
+ erts_de_rwlock(dep);
+ ASSERT(dep->state == ERTS_DE_STATE_EXITING);
+ dep->state = ERTS_DE_STATE_IDLE;
+ erts_de_rwunlock(dep);
return reds;
}
erts_de_rwunlock(dep);
diff --git a/erts/emulator/beam/erl_node_tables.c b/erts/emulator/beam/erl_node_tables.c
index 9871965ba6..e8901a652f 100644
--- a/erts/emulator/beam/erl_node_tables.c
+++ b/erts/emulator/beam/erl_node_tables.c
@@ -561,10 +561,6 @@ erts_set_dist_entry_not_connected(DistEntry *dep)
ASSERT(erts_no_of_pending_dist_entries > 0);
erts_no_of_pending_dist_entries--;
head = &erts_pending_dist_entries;
-
- // Todo: Is this really ok? Must be not wait for links and monitors
- // to be fired before we can allow another connection.
- dep->state = ERTS_DE_STATE_IDLE;
}
else {
ASSERT(dep->state != ERTS_DE_STATE_IDLE);
@@ -579,7 +575,6 @@ erts_set_dist_entry_not_connected(DistEntry *dep)
erts_no_of_hidden_dist_entries--;
head = &erts_hidden_dist_entries;
}
- dep->state = ERTS_DE_STATE_EXITING;
}
if(dep->prev) {
@@ -593,6 +588,7 @@ erts_set_dist_entry_not_connected(DistEntry *dep)
if(dep->next)
dep->next->prev = dep->prev;
+ dep->state = ERTS_DE_STATE_EXITING;
dep->flags = 0;
dep->prev = NULL;
dep->cid = NIL;