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

Endless loop when opcount is less than threadcount #1268

Closed
melhindi opened this issue Dec 15, 2018 · 2 comments
Closed

Endless loop when opcount is less than threadcount #1268

melhindi opened this issue Dec 15, 2018 · 2 comments

Comments

@melhindi
Copy link

Hi,
I came this by accident (forgot to change threadcount):
When opcount is set to 1 and threadcount to e.g. 2, it causes the first thread to stop after 1 operation, but the second thread runs endlessly.
This is due to the threadopcount calculation in the following lines:

int threadopcount = opcount / threadcount;
// ensure correct number of operations, in case opcount is not a multiple of threadcount
if (threadid < opcount % threadcount) {
++threadopcount;
}

When threadopcount is 0 the loop in ClientThread will run endlessly

while (((opcount == 0) || (opsdone < opcount)) && !workload.isStopRequested()) {

I am not sure what the intended behaviour is, but I would suggest to either throw an exception (when opcount < threadcount) or alter the calculation to pass e.g. a negative opcount to those ClientThreads that will not need to issue operations.

@busbey
Copy link
Collaborator

busbey commented Dec 15, 2018

Good find! Would you mind putting together a PR?

@busbey
Copy link
Collaborator

busbey commented Sep 8, 2019

this was fixed in #1323

@busbey busbey closed this as completed Sep 8, 2019
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