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

[R66] Commander might be blocked in some cases #65

Closed
bcarlin opened this issue Aug 4, 2020 · 1 comment · Fixed by #72
Closed

[R66] Commander might be blocked in some cases #65

bcarlin opened this issue Aug 4, 2020 · 1 comment · Fixed by #72
Milestone

Comments

@bcarlin
Copy link
Member

bcarlin commented Aug 4, 2020

The commander lists the tansfers to start, and loops on them.
In the loop, there are two branches with continue statements, but the loop index is not incremented before the continue. This results in infinite loops when a transfer enters one of these branches.

while (i < tasks.length) {
if (WaarpShutdownHook.isShutdownStarting()) {
logger.info("Will not start transfers, server is in shutdown.");
return;
}
final DbTaskRunner taskRunner = tasks[i];
logger.debug("get a task: {}", taskRunner);
// Launch if possible this task
final String key =
taskRunner.getRequested() + ' ' + taskRunner.getRequester() +
' ' + taskRunner.getSpecialId();
if (Configuration.configuration.getLocalTransaction()
.getFromRequest(key) != null) {
// already running
continue;
}
if (taskRunner.isSelfRequested()) {
// cannot schedule a request where the host is the requested host
taskRunner.changeUpdatedInfo(UpdatedInfo.INTERRUPTED);
try {
taskRunner.update();
} catch (final WaarpDatabaseNoDataException e) {
logger.warn("Update failed, no transfer found");
}
continue;
}
internalRunner.submitTaskRunner(taskRunner);
i++;
totalRuns++;
}

Moving the i++ from line 465 to line 443 should fix this)

fredericBregier added a commit to fredericBregier/Waarp-All that referenced this issue Aug 11, 2020
Fix issue waarp#65 where an infinite loop could occurs since increment in loop is misplaced.
@fredericBregier fredericBregier added this to the 3.4.1 milestone Aug 11, 2020
@fredericBregier fredericBregier linked a pull request Aug 11, 2020 that will close this issue
@fredericBregier
Copy link
Collaborator

fredericBregier commented Aug 11, 2020

Fix in #72

fredericBregier added a commit to fredericBregier/Waarp-All that referenced this issue Aug 13, 2020
Fix issue waarp#65 where an infinite loop could occurs since increment in loop is misplaced.
fredericBregier added a commit to fredericBregier/Waarp-All that referenced this issue Aug 28, 2020
Fix issue waarp#65 where an infinite loop could occurs since increment in loop is misplaced.
fredericBregier added a commit that referenced this issue Aug 28, 2020
Fix issue #65 where an infinite loop could occurs since increment in loop is misplaced.
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

Successfully merging a pull request may close this issue.

2 participants