Skip to content

Commit

Permalink
Fix for deletion of messages that are being used. (#1342)
Browse files Browse the repository at this point in the history
In case we recover from descriptorOfLastExitFromView we pass
the messages inside it to ViewsManager. Those messages currently
are raw pointers and we cannot delete them in the end of loadViewInfo()
We only delete them if we have not used them - the case in which we
use descriptorOfLastNewView.
  • Loading branch information
HristoStaykov authored and andrewjstone committed Apr 2, 2021
1 parent 1ce42ee commit ff54a58
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bftengine/src/bftengine/ReplicaLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ ReplicaLoader::ErrorCode loadViewInfo(shared_ptr<PersistentStorage> &p, LoadedRe
descriptorOfLastNewView.viewChangeMsgs);

ld.maxSeqNumTransferredFromPrevViews = descriptorOfLastNewView.maxSeqNumTransferredFromPrevViews;
// we have not used descriptorOfLastExitFromView, therefore
// we need to clean up the messages we have allocated inside it.
descriptorOfLastExitFromView.clean();
} else {
LOG_ERROR(GL,
"Failed to load view (inconsistent state): " << KVLOG(
Expand All @@ -183,7 +186,6 @@ ReplicaLoader::ErrorCode loadViewInfo(shared_ptr<PersistentStorage> &p, LoadedRe
}

ld.viewsManager = viewsManager;
descriptorOfLastExitFromView.clean();
return Succ;
}

Expand Down

0 comments on commit ff54a58

Please sign in to comment.