Fix a bug where fulfilling a promise could cause it to get deleted
Make a local copy of the promise before calling `send` in case the promise gets destroyed as a result of fulfilling it. This issue was previously fixed for sending errors to the `result` promise, but it was never fixed when fulfilling the promise. The issue manifested as an invalid generation returned when running a `set` against the configuration database immediately followed by a `get` with a new transaction object.
This commit is contained in:
parent
34f95b4741
commit
c3d518409c
|
@ -42,7 +42,9 @@ class CommitQuorum {
|
|||
|
||||
void updateResult() {
|
||||
if (successful >= ctis.size() / 2 + 1 && result.canBeSet()) {
|
||||
result.send(Void());
|
||||
// Calling send could delete this
|
||||
auto local = this->result;
|
||||
local.send(Void());
|
||||
} else if (failed >= ctis.size() / 2 + 1 && result.canBeSet()) {
|
||||
// Rollforwards could cause a version that didn't have quorum to
|
||||
// commit, so send commit_unknown_result instead of commit_failed.
|
||||
|
|
Loading…
Reference in New Issue