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-31009 Ensure Thor startup errors are properly reported. #18143

Conversation

jakesmith
Copy link
Member

@jakesmith jakesmith commented Dec 13, 2023

This also closes a few paths in k8s where an early error,
e.g. an error during worker registration, would not be
correctly reported back to the workunit, and cause the
agent to be unaware of the failure and deadlock.

Signed-off-by: Jake Smith [email protected]

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Cloud-compatibility
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

Copy link

@jakesmith jakesmith force-pushed the HPCC-31009-registration-timeout branch from 8ec1c7c to b3ec998 Compare December 13, 2023 19:47
@jakesmith jakesmith changed the title HPCC-31009 Ensure error reported if worker registration timeout HPCC-31009 Ensure error reported if worker registration times out Dec 13, 2023
@jakesmith jakesmith requested a review from shamser December 13, 2023 19:48
Copy link
Contributor

@shamser shamser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other similar failures possible in connect() which also returns false rather than throwing an exception (e.g. lines 390, 397, 432 etc). It is not clear why an exception is appropriate in line 290 and not in the case of the other failures in that function.

@jakesmith jakesmith changed the title HPCC-31009 Ensure error reported if worker registration times out HPCC-31009 Ensure Thor startup errors are properly reported. Dec 19, 2023
This also closes a few paths in k8s where an early error,
e.g. an error during worker registration, would not be
correctly reported back to the workunit, and cause the
agent to be unaware of the failure and deadlock.

Signed-off-by: Jake Smith <[email protected]>
@jakesmith jakesmith force-pushed the HPCC-31009-registration-timeout branch from b3ec998 to a4f279c Compare December 19, 2023 17:52
@jakesmith jakesmith changed the base branch from candidate-9.2.x to candidate-9.4.x December 19, 2023 17:52
@jakesmith jakesmith closed this Dec 19, 2023
@jakesmith jakesmith reopened this Dec 19, 2023
@jakesmith jakesmith requested a review from shamser December 19, 2023 17:53
@jakesmith
Copy link
Member Author

jakesmith commented Dec 19, 2023

There are other similar failures possible in connect() which also returns false rather than throwing an exception (e.g. lines 390, 397, 432 etc). It is not clear why an exception is appropriate in line 290 and not in the case of the other failures in that function.

Agreed.
connect() should cleanly succeed or throw a suitable exception.
Please see refactored commit.

NB: quite a few of the changes are due to indentation changes only.

@@ -14269,16 +14269,16 @@ void executeThorGraph(const char * graphName, IConstWorkUnit &workunit, const IP
unsigned runningTimeLimit = workunit.getDebugValueInt("maxRunTime", 0);
runningTimeLimit = runningTimeLimit ? runningTimeLimit : INFINITE;

std::list<WUState> expectedStates = { WUStateRunning, WUStateWait };
std::list<WUState> expectedStates = { WUStateRunning, WUStateWait, WUStateFailed };
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: not absolutely required in this commit, but related. This code should have handled the workunit having put in the failed state before. The only downside before was the production of an extra spurious "Query failed, state: ..." exception

@@ -429,11 +423,7 @@ class CRegistryServer : public CSimpleInterface
{
Owned<IException> e = deserializeException(msg);
EXCLOG(e, "Registration error");
if (TE_FailedToRegisterSlave == e->errorCode())
{
setExitCode(0); // to avoid thor auto-recycling
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: this was not needed before, the deliberate suppression of Thor restarts in bare-metal at this point, happens [deliberatly] because it hasn't got as far as creating the sentinel file (see init_thor script for non-restart when sentinel missing)

Copy link

https://track.hpccsystems.com/browse/HPCC-31009
This pull request is already registered

Copy link
Member

@ghalliday ghalliday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jakesmith a couple of questions. I will merge as is.

{
// bare-metal - check health of dafilesrv's on the Thor cluster.
if (globals->getPropBool("@replicateOutputs")&&globals->getPropBool("@validateDAFS",true)&&!checkClusterRelicateDAFS(queryNodeGroup()))
{
FLLOG(MCoperatorError, thorJob, "ERROR: Validate failure(s) detected, exiting Thor");
return globals->getPropBool("@validateDAFSretCode"); // default is no recycle!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be clearer if this explicitly returned an integer error code. E.g.

return globals->getPropBool("@validateDAFSretCode") ? TEC_DAFSdown : 0);

registry.clear();
// NB: workunit/graphName only set in one-shot mode (if isCloud())
thorMain(logHandler, workunit, graphName);
LOG(MCauditInfo, ",Progress,Thor,Terminate,%s,%s,%s",thorname,nodeGroup.str(),queueName.str());
LOG(MCdebugProgress, thorJob, "ThorMaster terminated OK");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make any difference that this is now before the destruction of registry?

@ghalliday ghalliday merged commit c9afd94 into hpcc-systems:candidate-9.4.x Jan 3, 2024
89 of 91 checks passed
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 this pull request may close these issues.

3 participants