Skip to content

Commit e65cc30

Browse files
committed
Make debug_sync regex more robust
On windows the symbol names appear to sometimes be truncated, which causes the symbol name to not include the `::new` at the end. This causes the regex to mis-match and track the wrong location for the mutex construction, leading to bogus lockorder violations. For example, in testing the following symbol name appeared on Windows, without the function name itself: `lightning::debug_sync::RwLock<std::collections::hash::map::HashMap<lightning::chain::transaction::OutPoint,lightning::chain::chainmonitor::MonitorHolder<lightning::util::enforcing_trait_impls::EnforcingSigner>,std::collections::hash::map::RandomState> >::`
1 parent b62160e commit e65cc30

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lightning/src/sync/debug_sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn get_construction_location(backtrace: &Backtrace) -> String {
7777
// Find the first frame that is after `debug_sync` (or that is in our tests) and use
7878
// that as the mutex construction site. Note that the first few frames may be in
7979
// the `backtrace` crate, so we have to ignore those.
80-
let sync_mutex_constr_regex = regex::Regex::new(r"lightning.*debug_sync.*new").unwrap();
80+
let sync_mutex_constr_regex = regex::Regex::new(r"lightning.*::debug_sync::").unwrap();
8181
let mut found_debug_sync = false;
8282
for frame in backtrace.frames() {
8383
for symbol in frame.symbols() {

0 commit comments

Comments
 (0)