Skip to content

Commit b3544e0

Browse files
Trace error for timeout of async demotion Cooling->Cold transition
o-network issue #5111
1 parent da8b523 commit b3544e0

File tree

2 files changed

+41
-9
lines changed

2 files changed

+41
-9
lines changed

cabal.project

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,11 @@ if impl (ghc >= 9.12)
9090
-- https://github.com/haskell-servant/servant/pull/1810
9191
, servant:base
9292
, servant-server:base
93+
94+
source-repository-package
95+
type: git
96+
location: https://github.com/IntersectMBO/ouroboros-network.git
97+
--sha256: sha256-F1foQA5U8vWpDpHN4EYNeoNlNn2j6bJQojeuD5V0x4Y=
98+
tag: 1eafe7bc742da1709fc98c62c48c519bbce503c0
99+
subdir:
100+
ouroboros-network

cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import qualified Ouroboros.Network.InboundGovernor as InboundGovernor
3939
import Ouroboros.Network.InboundGovernor.State as InboundGovernor (Counters (..))
4040
import qualified Ouroboros.Network.NodeToNode as NtN
4141
import Ouroboros.Network.PeerSelection.Churn (ChurnCounters (..))
42-
import Ouroboros.Network.PeerSelection.Governor (DebugPeerSelection (..),
42+
import Ouroboros.Network.PeerSelection.Governor (DemotionTimeoutException (..), DebugPeerSelection (..),
4343
DebugPeerSelectionState (..), PeerSelectionCounters, PeerSelectionState (..),
4444
PeerSelectionTargets (..), PeerSelectionView (..), TracePeerSelection (..),
4545
peerSelectionStateToCounters)
@@ -634,28 +634,36 @@ instance MetaTrace (TracePeerSelection extraDebugState extraFlags extraPeers Soc
634634
Namespace [] ["PromoteWarmBigLedgerPeerAborted"]
635635
namespaceFor TraceDemoteWarmPeers {} =
636636
Namespace [] ["DemoteWarmPeers"]
637-
namespaceFor TraceDemoteWarmFailed {} =
638-
Namespace [] ["DemoteWarmFailed"]
637+
namespaceFor TraceDemoteWarmFailed _ _ _ e =
638+
case fromException e :: Maybe DemotionTimeoutException of
639+
Just _ -> Namespace [] ["DemoteWarmFailed", "CoolingToColdTimeout"]
640+
Nothing -> Namespace [] ["DemoteWarmFailed"]
639641
namespaceFor TraceDemoteWarmDone {} =
640642
Namespace [] ["DemoteWarmDone"]
641643
namespaceFor TraceDemoteWarmBigLedgerPeers {} =
642644
Namespace [] ["DemoteWarmBigLedgerPeers"]
643-
namespaceFor TraceDemoteWarmBigLedgerPeerFailed {} =
644-
Namespace [] ["DemoteWarmBigLedgerPeerFailed"]
645+
namespaceFor TraceDemoteWarmBigLedgerPeerFailed _ _ _ e =
646+
case fromException e :: Maybe DemotionTimeoutException of
647+
Just _ -> Namespace [] ["DemoteWarmBigLedgerPeerFailed", "CoolingToColdTimeout"]
648+
Nothing -> Namespace [] ["DemoteWarmBigLedgerPeerFailed"]
645649
namespaceFor TraceDemoteWarmBigLedgerPeerDone {} =
646650
Namespace [] ["DemoteWarmBigLedgerPeerDone"]
647651
namespaceFor TraceDemoteHotPeers {} =
648652
Namespace [] ["DemoteHotPeers"]
649653
namespaceFor TraceDemoteLocalHotPeers {} =
650654
Namespace [] ["DemoteLocalHotPeers"]
651-
namespaceFor TraceDemoteHotFailed {} =
652-
Namespace [] ["DemoteHotFailed"]
655+
namespaceFor TraceDemoteHotFailed _ _ _ e =
656+
case fromException e :: Maybe DemotionTimeoutException of
657+
Just _ -> Namespace [] ["DemoteHotFailed", "CoolingToColdTimeout"]
658+
Nothing -> Namespace [] ["DemoteHotFailed"]
653659
namespaceFor TraceDemoteHotDone {} =
654660
Namespace [] ["DemoteHotDone"]
655661
namespaceFor TraceDemoteHotBigLedgerPeers {} =
656662
Namespace [] ["DemoteHotBigLedgerPeers"]
657-
namespaceFor TraceDemoteHotBigLedgerPeerFailed {} =
658-
Namespace [] ["DemoteHotBigLedgerPeerFailed"]
663+
namespaceFor TraceDemoteHotBigLedgerPeerFailed _ _ _ e =
664+
case fromException e :: Maybe DemotionTimeoutException of
665+
Just _ -> Namespace [] ["DemoteHotBigLedgerPeerFailed", "CoolingToColdTimeout"]
666+
Nothing -> Namespace [] ["DemoteHotBigLedgerPeerFailed"]
659667
namespaceFor TraceDemoteHotBigLedgerPeerDone {} =
660668
Namespace [] ["DemoteHotBigLedgerPeerDone"]
661669
namespaceFor TraceDemoteAsynchronous {} =
@@ -722,15 +730,19 @@ instance MetaTrace (TracePeerSelection extraDebugState extraFlags extraPeers Soc
722730
severityFor (Namespace [] ["PromoteWarmBigLedgerPeerAborted"]) _ = Just Info
723731
severityFor (Namespace [] ["DemoteWarmPeers"]) _ = Just Info
724732
severityFor (Namespace [] ["DemoteWarmFailed"]) _ = Just Info
733+
severityFor (Namespace [] ["DemoteWarmFailed", "CoolingToColdTimeout"]) = Just Error
725734
severityFor (Namespace [] ["DemoteWarmDone"]) _ = Just Info
726735
severityFor (Namespace [] ["DemoteWarmBigLedgerPeers"]) _ = Just Info
727736
severityFor (Namespace [] ["DemoteWarmBigLedgerPeerFailed"]) _ = Just Info
737+
severityFor (Namespace [] ["DemoteWarmBigLedgerPeerFailed", "CoolingToColdTimeout"]) = Just Error
728738
severityFor (Namespace [] ["DemoteHotPeers"]) _ = Just Info
729739
severityFor (Namespace [] ["DemoteLocalHotPeers"]) _ = Just Info
730740
severityFor (Namespace [] ["DemoteHotFailed"]) _ = Just Info
741+
severityFor (Namespace [] ["DemoteHotFailed", "CoolingToColdTimeout"]) = Just Error
731742
severityFor (Namespace [] ["DemoteHotDone"]) _ = Just Info
732743
severityFor (Namespace [] ["DemoteHotBigLedgerPeers"]) _ = Just Info
733744
severityFor (Namespace [] ["DemoteHotBigLedgerPeerFailed"]) _ = Just Info
745+
severityFor (Namespace [] ["DemoteHotBigLedgerPeerFailed", "CoolingToColdTimeout"]) = Just Error
734746
severityFor (Namespace [] ["DemoteHotBigLedgerPeerDone"]) _ = Just Info
735747
severityFor (Namespace [] ["DemoteAsynchronous"]) _ = Just Info
736748
severityFor (Namespace [] ["DemoteLocalAsynchronous"]) _ = Just Warning
@@ -785,6 +797,10 @@ instance MetaTrace (TracePeerSelection extraDebugState extraFlags extraPeers Soc
785797
"target established, actual established, selected peers"
786798
documentFor (Namespace [] ["DemoteWarmFailed"]) = Just
787799
"target established, actual established, peer, reason"
800+
documentFor (Namespace [] ["DemoteWarmFailed", "CoolingToColdTimeout"]) =
801+
"Impossible asynchronous demotion timeout"
802+
documentFor (Namespace [] ["DemoteWarmBigLedgerPeerFailed", "CoolingToColdTimeout"]) =
803+
"Impossible asynchronous demotion timeout"
788804
documentFor (Namespace [] ["DemoteWarmDone"]) = Just
789805
"target established, actual established, peer"
790806
documentFor (Namespace [] ["DemoteHotPeers"]) = Just
@@ -793,6 +809,10 @@ instance MetaTrace (TracePeerSelection extraDebugState extraFlags extraPeers Soc
793809
"local per-group (target active, actual active), selected peers"
794810
documentFor (Namespace [] ["DemoteHotFailed"]) = Just
795811
"target active, actual active, peer, reason"
812+
documentFor (Namespace [] ["DemoteHotFailed", "CoolingToColdTimeout"]) =
813+
"Impossible asynchronous demotion timeout"
814+
documentFor (Namespace [] ["DemoteHotBigLedgerPeerFailed", "CoolingToColdTimeout"]) =
815+
"Impossible asynchronous demotion timeout"
796816
documentFor (Namespace [] ["DemoteHotDone"]) = Just
797817
"target active, actual active, peer"
798818
documentFor (Namespace [] ["DemoteAsynchronous"]) = Just ""
@@ -852,16 +872,20 @@ instance MetaTrace (TracePeerSelection extraDebugState extraFlags extraPeers Soc
852872
, Namespace [] ["PromoteWarmBigLedgerPeerAborted"]
853873
, Namespace [] ["DemoteWarmPeers"]
854874
, Namespace [] ["DemoteWarmFailed"]
875+
, Namespace [] ["DemoteWarmFailed", "CoolingToColdTimeout"]
855876
, Namespace [] ["DemoteWarmDone"]
856877
, Namespace [] ["DemoteWarmBigLedgerPeers"]
857878
, Namespace [] ["DemoteWarmBigLedgerPeerFailed"]
879+
, Namespace [] ["DemoteWarmBigLedgerPeerFailed", "CoolingToColdTimeout"]
858880
, Namespace [] ["DemoteWarmBigLedgerPeerDone"]
859881
, Namespace [] ["DemoteHotPeers"]
860882
, Namespace [] ["DemoteLocalHotPeers"]
861883
, Namespace [] ["DemoteHotFailed"]
884+
, Namespace [] ["DemoteHotFailed", "CoolingToColdTimeout"]
862885
, Namespace [] ["DemoteHotDone"]
863886
, Namespace [] ["DemoteHotBigLedgerPeers"]
864887
, Namespace [] ["DemoteHotBigLedgerPeerFailed"]
888+
, Namespace [] ["DemoteHotBigLedgerPeerFailed", "CoolingToColdTimeout"]
865889
, Namespace [] ["DemoteHotBigLedgerPeerDone"]
866890
, Namespace [] ["DemoteAsynchronous"]
867891
, Namespace [] ["DemoteLocalAsynchronous"]

0 commit comments

Comments
 (0)