-
Notifications
You must be signed in to change notification settings - Fork 402
Make debug_sync
regex more robust
#1944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make debug_sync
regex more robust
#1944
Conversation
This will allow us to change the module regex match in debug_sync to make it 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> >::`
e65cc30
to
ab46f6b
Compare
Codecov ReportBase: 90.75% // Head: 90.72% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1944 +/- ##
==========================================
- Coverage 90.75% 90.72% -0.03%
==========================================
Files 96 97 +1
Lines 50135 50135
Branches 50135 50135
==========================================
- Hits 45498 45484 -14
- Misses 4637 4651 +14
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks happy to me. We shouldn't get any false-positive construction sites from what I can see.
@@ -77,7 +77,7 @@ fn get_construction_location(backtrace: &Backtrace) -> String { | |||
// Find the first frame that is after `debug_sync` (or that is in our tests) and use | |||
// that as the mutex construction site. Note that the first few frames may be in | |||
// the `backtrace` crate, so we have to ignore those. | |||
let sync_mutex_constr_regex = regex::Regex::new(r"lightning.*debug_sync.*new").unwrap(); | |||
let sync_mutex_constr_regex = regex::Regex::new(r"lightning.*debug_sync").unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a trailing .*
to match the locks type (and new
when it is not truncated)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, is_match
"Returns true if and only if there is a match for the regex in the string given." ie not if the match is the string but if there is a match in the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks for this.
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> >::