Skip to content
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

Improper cleanup between runs causes erroneous timeouts to be triggered #49

Open
ivoadf opened this issue Jul 31, 2023 · 1 comment
Open

Comments

@ivoadf
Copy link

ivoadf commented Jul 31, 2023

These two variables are not properly reset when a run completes

    private void checkSampleTimeout() {
        long previousSampleCount = 0;
        long previousSampleTime = 0;

while noResultsReturned = 0; is reset in the endOfRun method.

This means that once the first run completes and noResultsReturned is reset to 0 this if condition is never true

if (previousSampleCount < noResultsReturned) {
                previousSampleCount = noResultsReturned;
                previousSampleTime = System.currentTimeMillis();
            } else {
                if (previousSampleTime < (System.currentTimeMillis() - jlbhOptions.timeout)) {
                    printStream.println("Sample timed out. Aborting test...");
                    abort();
                    break;
                }
            }

Meaning the previousSampleCount and previousSampleTime are never updated and unless the jlbhOptions.timeout value is larger than the total runtime of all remaining runs in the test it will eventually trigger a timeout when it should not.

To fix this previousSampleCount and previousSampleTime should be reset alongside the reset that already happens to noResultsReturned in the endOfRun method.

@JerryShea
Copy link
Contributor

@ivoadf can you provide a failing unit test pls?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants