Skip to content

Commit

Permalink
DONOTMERGE SRPs for thread debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Jan 27, 2025
1 parent 83aa2de commit 984b92f
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 7 deletions.
61 changes: 61 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,64 @@ allow-newer:
-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.
source-repository-package
type: git
location: https://github.com/jasagredo/async
tag: 57b9ef37662b4c978eef7bc6bd255c9a89d7d731

source-repository-package
type: git
location: https://github.com/jasagredo/katip
tag: 186a10c0f92d84375ff69db1d9e0a33adda9d2b8
subdir:
katip

source-repository-package
type: git
location: https://github.com/jasagredo/wai
tag: eebc207b826f923c50e9d21fe39d8793b5248a58
subdir:
warp

source-repository-package
type: git
location: https://github.com/jasagredo/ekg-wai
tag: 7373a7826abfd5093be931c36542e52421012154

source-repository-package
type: git
location: https://github.com/IntersectMBO/ouroboros-network
tag: a00bcfef4a8599a60adb5f908ec56249bcd6ac9d
subdir:
ouroboros-network
ouroboros-network-framework

source-repository-package
type: git
location: https://github.com/IntersectMBO/ouroboros-consensus
tag: b38ca254f73aae13eb50b2ea9eae786e14ae7a01
subdir:
ouroboros-consensus
ouroboros-consensus-diffusion

source-repository-package
type: git
location: https://github.com/input-output-hk/iohk-monitoring-framework
tag: 45fef502fd0380425fd7ff83cd0bf6764f063853
subdir:
iohk-monitoring
plugins/backend-ekg
plugins/backend-aggregation
plugins/backend-monitoring

source-repository-package
type: git
location: https://github.com/IntersectMBO/Win32-network
tag: e09fd544175b35779204fbeadcd0a37fc4f92220

source-repository-package
type: git
location: https://github.com/input-output-hk/io-sim
tag: d037df6436c270cbb40d58d72cad19dac8b79bab
subdir:
io-classes
16 changes: 10 additions & 6 deletions cardano-node/app/cardano-node.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ import System.IO (hPutStrLn, stderr)

import Paths_cardano_node (version)

import GHC.Conc

main :: IO ()
main = do
Crypto.cryptoInit

myThreadId >>= flip labelThread "main"

toplevelExceptionHandler $ do
cmd <- Opt.customExecParser p opts

Expand All @@ -45,15 +49,15 @@ main = do
p = Opt.prefs Opt.showHelpOnEmpty

warnIfSet :: PartialNodeConfiguration -> (PartialNodeConfiguration -> Last a) -> String -> String -> IO ()
warnIfSet args f name key =
maybe
(pure ())
(\_ -> hPutStrLn stderr $ "WARNING: Option --" ++ name ++ " was set via CLI flags.\
warnIfSet args f name key =
maybe
(pure ())
(\_ -> hPutStrLn stderr $ "WARNING: Option --" ++ name ++ " was set via CLI flags.\
\ This CLI flag will be removed in upcoming node releases.\
\ Please, set this configuration option in the configuration file instead with key " ++ key ++ ".")
\ Please, set this configuration option in the configuration file instead with key " ++ key ++ ".")
$ getLast
$ f args

opts :: Opt.ParserInfo Command
opts =
Opt.info (fmap RunCmd nodeCLIParser
Expand Down
1 change: 1 addition & 0 deletions cardano-node/cardano-node.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ executable cardano-node
main-is: cardano-node.hs
ghc-options: -threaded
-rtsopts
-debug

if arch(arm)
ghc-options: "-with-rtsopts=-T -I0 -A16m -N1 --disable-delayed-os-memory-return"
Expand Down
5 changes: 4 additions & 1 deletion cardano-node/src/Cardano/Node/Configuration/Logging.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ import Cardano.Slotting.Slot (EpochSize (..))
import Cardano.Tracing.Config (TraceOptions (..))
import Cardano.Tracing.OrphanInstances.Common ()
import Paths_cardano_node (version)
import GHC.Conc (labelThread, myThreadId)

--------------------------------
-- Layer
Expand Down Expand Up @@ -285,7 +286,9 @@ createLoggingLayer ver nodeConfig' p = do
pure ()

startCapturingMetrics _ tr = do
void . Async.async . forever $ do
void . Async.async $ do
myThreadId >>= flip labelThread "Metrics capturing (cardano-node)"
forever $ do
readResourceStats
>>= maybe (pure ())
(traceResourceStats
Expand Down

0 comments on commit 984b92f

Please sign in to comment.