From f3a324db1fc0d49e2a4da29690003fcb56013606 Mon Sep 17 00:00:00 2001 From: David Hartunian Date: Wed, 31 Mar 2021 19:50:05 -0400 Subject: [PATCH] console: filter out stats referencing dead nodes Previously, nodes could reference nodes we didn't know about in their stats protos. Our frontend wouldn't know those nodeIDs because they weren't in the list of known nodes that were returned from the DB and would fail to render the network stats table. Now we filter out any nodeIDs that are unknown to us so that we don't render a broken table. This is meant to be a targeted fix for a specific problem. Future work will be done that addresses properly accounting for the various node liveness states that have been changed on the backend and have not been fully accounted for in the frontend. Resolves #59322 Release note (ui change): Fixes a bug where nodes would reference dead cluster nodes in their network stats and cause the network DB Console page to crash. --- pkg/ui/src/views/reports/containers/network/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/ui/src/views/reports/containers/network/index.tsx b/pkg/ui/src/views/reports/containers/network/index.tsx index d7157f75dc9b..b7967b09f4ba 100644 --- a/pkg/ui/src/views/reports/containers/network/index.tsx +++ b/pkg/ui/src/views/reports/containers/network/index.tsx @@ -427,6 +427,12 @@ export class Network extends React.Component { .keys() .map((nodeIDb) => Number.parseInt(nodeIDb, 10)) .difference(healthyIDs) + // It's possible for the activity list to contain nodes + // that are no longer in our list of known nodes in + // `identityByID`. We ensure via the filter below + // that we only access nodes we have data for to + // prevent unrecoverable error states. + .filter((id) => identityByID.has(id)) .map((nodeIDb) => ({ from: identityByID.get(nodeIDa), to: identityByID.get(nodeIDb),