-
Notifications
You must be signed in to change notification settings - Fork 1
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
Review fixes and refactor: #6
Conversation
1) refactor filtering of validations to specifically avoid concurrent checkAccept() calls for the same validation hash. 2) Log when duplicate concurrent inbound ledger and validation requests are filtered. 3) RAII for containers that track concurrent inbound ledger and validation requests. 4) Comment on when to asynchronously acquire inbound ledgers, which is possible to be always OK, but should have further review.
f15ac51
to
7503b41
Compare
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.
LGTM as a hotfix
#include <vector> | ||
|
||
namespace ripple { | ||
|
||
class Application; | ||
|
||
enum class BypassAccept { FALSE, TRUE }; |
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.
The FALSE
and TRUE
keywords are #define
d on Windows, which messes up building this.
enum class BypassAccept { FALSE, TRUE }; | |
enum class BypassAccept : bool { no = false, yes }; |
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 pushed this change to the branch so I can go ahead and merge this pull request. and let testing proceed.
std::unique_lock lock(acquiresMutex_); | ||
if (pendingAcquires_.contains(hash)) | ||
return; | ||
pendingAcquires_.insert(hash); | ||
lock.unlock(); | ||
acquire(hash, seq, reason); | ||
try | ||
{ | ||
if (pendingAcquires_.contains(hash)) | ||
return; | ||
pendingAcquires_.insert(hash); | ||
lock.unlock(); | ||
acquire(hash, seq, reason); | ||
} | ||
catch (std::exception const& e) | ||
{ | ||
JLOG(j_.warn()) | ||
<< "Exception thrown for acquiring new inbound ledger " << hash | ||
<< ": " << e.what(); | ||
} | ||
catch (...) | ||
{ | ||
JLOG(j_.warn()) | ||
<< "Unknown exception thrown for acquiring new inbound ledger " | ||
<< hash; | ||
} | ||
lock.lock(); | ||
pendingAcquires_.erase(hash); |
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.
The manual calls to unlock
and lock
still being here are rubbing me the wrong way. What about:
std::unique_lock lock(acquiresMutex_); | |
if (pendingAcquires_.contains(hash)) | |
return; | |
pendingAcquires_.insert(hash); | |
lock.unlock(); | |
acquire(hash, seq, reason); | |
try | |
{ | |
if (pendingAcquires_.contains(hash)) | |
return; | |
pendingAcquires_.insert(hash); | |
lock.unlock(); | |
acquire(hash, seq, reason); | |
} | |
catch (std::exception const& e) | |
{ | |
JLOG(j_.warn()) | |
<< "Exception thrown for acquiring new inbound ledger " << hash | |
<< ": " << e.what(); | |
} | |
catch (...) | |
{ | |
JLOG(j_.warn()) | |
<< "Unknown exception thrown for acquiring new inbound ledger " | |
<< hash; | |
} | |
lock.lock(); | |
pendingAcquires_.erase(hash); | |
try | |
{ | |
{ | |
std::unique_lock lock(acquiresMutex_); | |
if (pendingAcquires_.contains(hash)) | |
return; | |
pendingAcquires_.insert(hash); | |
} | |
acquire(hash, seq, reason); | |
} | |
catch (std::exception const& e) | |
{ | |
JLOG(j_.warn()) | |
<< "Exception thrown for acquiring new inbound ledger " << hash | |
<< ": " << e.what(); | |
} | |
catch (...) | |
{ | |
JLOG(j_.warn()) | |
<< "Unknown exception thrown for acquiring new inbound ledger " | |
<< hash; | |
} | |
std::unique_lock lock(acquiresMutex_); | |
pendingAcquires_.erase(hash); |
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.
Sure, go ahead. Can also be lock_guard in that case if you want.
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'm fine with leaving this as-is for now, but check out 7a24764
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.
Pending CI completion
* origin/pr/2.2.2-rc1: Review fixes and refactor: (#6)
1) refactor filtering of validations to specifically avoid concurrent checkAccept() calls for the same validation hash. 2) Log when duplicate concurrent inbound ledger and validation requests are filtered. 3) RAII for containers that track concurrent inbound ledger and validation requests. 4) Comment on when to asynchronously acquire inbound ledgers, which is possible to be always OK, but should have further review.
concurrent checkAccept() calls for the same validation hash.
are filtered.
validation requests.
is possible to be always OK, but should have further review.
High Level Overview of Change
Context of Change
Type of Change
.gitignore
, formatting, dropping support for older tooling)API Impact
libxrpl
change (any change that may affectlibxrpl
or dependents oflibxrpl
)This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)