-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add log-slow-write-lock crate feature
This feature is nightly only. To enable: cargo +nightly build --features log-slow-write-lock It logs a warning and caller location if the global-state write-lock is held more than 100 millis. Useful for finding slow writers that can harm concurrency. It requires nightly in order to log the caller location for async methods such as lock_guard_mut().
- Loading branch information
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env php | ||
|
||
<?php | ||
|
||
$path = @$argv[1]; | ||
|
||
if(!$path) die("please specify a neptune log file."); | ||
|
||
$lines = file($path); | ||
|
||
$found = []; | ||
|
||
// sample line: | ||
// 2024-11-02T20:53:45.472275Z WARN reorganization_does_not_crash_mempool: neptune_core::locks::tokio::atomic_rw: write-lock held for 4.1489367 seconds. (exceeds max: 100 milli) location: src/models/state/mod.rs:216:14 | ||
|
||
foreach($lines as $line) { | ||
if(strpos($line, "write-lock held for") === false) { | ||
continue; | ||
} | ||
|
||
if (preg_match("/for (.*) seconds/i", $line, $matches)) { | ||
$secs = $matches[1]; | ||
$found[$secs] = $line; | ||
} | ||
} | ||
|
||
krsort($found); | ||
|
||
foreach($found as $line) { | ||
echo $line . "\n"; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters