From 28a8a7f9a6c7f3f3db381894b53eb72be8510ccb Mon Sep 17 00:00:00 2001 From: greg7mdp Date: Tue, 8 Oct 2024 08:45:43 -0400 Subject: [PATCH 1/3] Update check to verify only one 'Starting block' per block number unless block is restarted --- tests/TestHarness/Node.py | 41 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/tests/TestHarness/Node.py b/tests/TestHarness/Node.py index 8cfab82bac..84fc3e5020 100644 --- a/tests/TestHarness/Node.py +++ b/tests/TestHarness/Node.py @@ -708,37 +708,36 @@ def countInLog(self, searchStr) -> int: count += contents.count(searchStr) return count - # verify only one or two 'Starting block' per block number unless block is restarted + # verify only one 'Starting block' per block number unless block is restarted def verifyStartingBlockMessages(self): dataDir=Utils.getNodeDataDir(self.nodeId) files=Node.findStderrFiles(dataDir) + restarting_exhausted_regexp = re.compile(r"Restarting exhausted speculative block #(\d+)") + starting_block_regexp = re.compile(r"Starting block #(\d+) .*(\d\d:\d\d\.\d\d\d) producer") + for f in files: - blockNumbers = set() - duplicateBlockNumbers = set() - threeStartsFound = False - lastRestartBlockNum = 0 - blockNumber = 0 + notRestartedBlockNumbersAndTimes = {} + duplicateStartFound = False with open(f, 'r') as file: for line in file: - match = re.match(r".*Restarting exhausted speculative block #(\d+)", line) + match = restarting_exhausted_regexp.match(line) if match: - lastRestartBlockNum = match.group(1) - continue - if re.match(r".*unlinkable_block_exception", line): - lastRestartBlockNum = blockNumber + # remove restarted block + notRestartedBlockNumbersAndTimes.pop(match.group(1), None) continue - match = re.match(r".*Starting block #(\d+)", line) + match = starting_block_regexp.match(line) if match: - blockNumber = match.group(1) - if blockNumber != lastRestartBlockNum and blockNumber in duplicateBlockNumbers: - print(f"Duplicate Staring block found: {blockNumber} in {f}") - threeStartsFound = True - if blockNumber != lastRestartBlockNum and blockNumber in blockNumbers: - duplicateBlockNumbers.add(blockNumber) - blockNumbers.add(blockNumber) - - return not threeStartsFound + blockNumber, time = match.group(1), match.group(2) + if blockNumber in notRestartedBlockNumbersAndTimes and notRestartedBlockNumbersAndTimes[blockNumber] != time: + print(f"Duplicate Starting block found: {blockNumber} in {f}") + duplicateStartFound = True + break + notRestartedBlockNumbersAndTimes[blockNumber] = time + if duplicateStartFound: + break + + return not duplicateStartFound def analyzeProduction(self, specificBlockNum=None, thresholdMs=500): dataDir=Utils.getNodeDataDir(self.nodeId) From ab01c38f4e002daf406c32166be32b42823fd396 Mon Sep 17 00:00:00 2001 From: greg7mdp Date: Tue, 8 Oct 2024 10:34:25 -0400 Subject: [PATCH 2/3] The error is when we have repeated "Starting block" with the same block time. --- tests/TestHarness/Node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TestHarness/Node.py b/tests/TestHarness/Node.py index 84fc3e5020..743d4a2458 100644 --- a/tests/TestHarness/Node.py +++ b/tests/TestHarness/Node.py @@ -729,7 +729,7 @@ def verifyStartingBlockMessages(self): match = starting_block_regexp.match(line) if match: blockNumber, time = match.group(1), match.group(2) - if blockNumber in notRestartedBlockNumbersAndTimes and notRestartedBlockNumbersAndTimes[blockNumber] != time: + if blockNumber in notRestartedBlockNumbersAndTimes and notRestartedBlockNumbersAndTimes[blockNumber] == time: print(f"Duplicate Starting block found: {blockNumber} in {f}") duplicateStartFound = True break From ee12561ebf74403758c5d04159f52b929c5349e1 Mon Sep 17 00:00:00 2001 From: greg7mdp Date: Tue, 8 Oct 2024 12:59:01 -0400 Subject: [PATCH 3/3] Update comment. --- tests/TestHarness/Node.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/TestHarness/Node.py b/tests/TestHarness/Node.py index 743d4a2458..5061673219 100644 --- a/tests/TestHarness/Node.py +++ b/tests/TestHarness/Node.py @@ -708,7 +708,10 @@ def countInLog(self, searchStr) -> int: count += contents.count(searchStr) return count - # verify only one 'Starting block' per block number unless block is restarted + # Verify that we have only one "Starting block" in the log for any block number unless: + # - the block was restarted because it was exhausted, + # - or the second "Starting block" is for a different block time than the first. + # ------------------------------------------------------------------------------------- def verifyStartingBlockMessages(self): dataDir=Utils.getNodeDataDir(self.nodeId) files=Node.findStderrFiles(dataDir)