Skip to content

Commit

Permalink
Better test diag output on OOM (elastic#42989)
Browse files Browse the repository at this point in the history
If linearizability checking fails with OOM (or other exception), we did
not get the serialized history written into the log, making it difficult
to debug in cases where the problem is hard to reproduce. Fixed to
always attempt dumping the serialized history.

Related to elastic#42244
  • Loading branch information
henningandersen committed Jun 11, 2019
1 parent 7905205 commit 6a77dde
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,17 @@ public boolean isLinearizable() {
logger.info("--> Linearizability checking history of size: {} for key: {} and initialVersion: {}: {}", history.size(),
id, initialVersion, history);
LinearizabilityChecker.SequentialSpec spec = new CASSequentialSpec(initialVersion);
boolean linearizable = new LinearizabilityChecker().isLinearizable(spec, history, missingResponseGenerator());
// implicitly test that we can serialize all histories.
String serializedHistory = base64Serialize(history);
if (linearizable == false) {
// we dump base64 encoded data, since the nature of this test is that it does not reproduce even with same seed.
logger.error("Linearizability check failed. Spec: {}, initial version: {}, serialized history: {}", spec, initialVersion,
serializedHistory);
boolean linearizable = false;
try {
linearizable = new LinearizabilityChecker().isLinearizable(spec, history, missingResponseGenerator());
} finally {
// implicitly test that we can serialize all histories.
String serializedHistory = base64Serialize(history);
if (linearizable == false) {
// we dump base64 encoded data, since the nature of this test is that it does not reproduce even with same seed.
logger.error("Linearizability check failed. Spec: {}, initial version: {}, serialized history: {}",
spec, initialVersion, serializedHistory);
}
}
return linearizable;
}
Expand Down

0 comments on commit 6a77dde

Please sign in to comment.