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

HPCC-32839 Fix Thor aborting race #19220

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions common/workunit/workunit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3687,7 +3687,8 @@ EnumMapping priorityClasses[] = {

const char * getWorkunitStateStr(WUState state)
{
dbgassertex(state < WUStateSize);
if (state >= WUStateSize)
return "unknown workunit state";
return states[state].str; // MORE - should be using getEnumText, or need to take steps to ensure values remain contiguous and in order.
}

Expand Down Expand Up @@ -14496,11 +14497,22 @@ void executeThorGraph(const char * graphName, IConstWorkUnit &workunit, const IP
}
}

// NB: check for expected success state (WUStateWait). If any other state, abort.
{
Owned<IWorkUnit> w = &workunit.lock();
WUState state = w->getState();
if (WUStateFailed == state)
throw makeStringException(0, "Workunit failed");
if (WUStateWait != state) // expected state from successful Thor run from above
{
switch (state)
{
case WUStateAborting:
throw new WorkflowException(0, "Workunit abort requested", 0, WorkflowException::ABORT, MSGAUD_user);
case WUStateFailed:
throw makeStringException(0, "Workunit failed");
default:
throw makeStringExceptionV(0, "Workunit failed. Unexpected state: %s", getWorkunitStateStr(state));
}
}
w->setState(WUStateRunning);
}
#else
Expand Down
Loading