Skip to content

Commit d700f76

Browse files
authored
Label consensus threads (#1366)
2 parents 97554bd + 4024ce6 commit d700f76

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Patch
2+
3+
- Label the DbLock acquisition thread.

ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Node/DbLock.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module Ouroboros.Consensus.Node.DbLock (
1212
, withLockDB_
1313
) where
1414

15+
import Control.Monad.Class.MonadFork
1516
import Control.Monad.Class.MonadTimer.SI
1617
import qualified Data.Time.Clock as Time
1718
import Ouroboros.Consensus.Util.FileLock
@@ -70,7 +71,9 @@ withLockDB_ fileLock mountPoint lockFsPath lockTimeout action =
7071
-- lock, the whole process will soon die.
7172
acquireLock :: m (m ())
7273
acquireLock = do
73-
lockFileAsync <- async (lockFile fileLock lockFilePath)
74+
lockFileAsync <- async (do
75+
labelThisThread "ChainDB lock"
76+
lockFile fileLock lockFilePath)
7477
timeout lockTimeout (wait lockFileAsync) >>= \case
7578
-- We timed out while waiting on the lock. The db is still locked.
7679
Nothing -> throwIO $ DbLocked lockFilePath
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Patch
2+
3+
- Label the leaky bucket thread.

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Util/LeakyBucket.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ runAgainstBucket config action = do
222222
leakingPeriodVersionTMVar <- atomically newEmptyTMVar -- see note [Leaky bucket design].
223223
tid <- myThreadId
224224
bucket <- init config
225-
withAsync (leak (readTMVar leakingPeriodVersionTMVar) tid bucket) $ \_ -> do
225+
withAsync (do
226+
labelThisThread "Leaky bucket (ouroboros-consensus)"
227+
leak (readTMVar leakingPeriodVersionTMVar) tid bucket) $ \_ -> do
226228
atomicallyWithMonotonicTime $ maybeStartThread Nothing leakingPeriodVersionTMVar bucket
227229
result <-
228230
action $

0 commit comments

Comments
 (0)