-
Notifications
You must be signed in to change notification settings - Fork 308
HPCC-34917 Elastic sink does not handle exception during password decryption #20405
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
base: candidate-9.14.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes error handling in the Elastic metrics sink by adding exception handling during the configuration initialization phase, specifically to catch and log exceptions that may occur during password decryption operations.
Key Changes
- Added try/catch block around the entire configuration initialization logic in
getHostConfig()
- Added logging for both known IException instances and unknown exceptions during configuration
StringBuffer errorMsg; | ||
e->errorMessage(errorMsg); | ||
WARNLOG("ElasticMetricSink: Exception during configuration, error=%d, message=%s", e->errorCode(), errorMsg.str()); | ||
e->Release(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using RAII pattern with Owned<IException>
instead of manual Release()
call to ensure automatic cleanup even if an exception occurs between catching and releasing.
StringBuffer errorMsg; | |
e->errorMessage(errorMsg); | |
WARNLOG("ElasticMetricSink: Exception during configuration, error=%d, message=%s", e->errorCode(), errorMsg.str()); | |
e->Release(); | |
Owned<IException> ownedE = e; | |
StringBuffer errorMsg; | |
ownedE->errorMessage(errorMsg); | |
WARNLOG("ElasticMetricSink: Exception during configuration, error=%d, message=%s", ownedE->errorCode(), errorMsg.str()); |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please respond to this suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converted input pointer to an Owned and let normal destructor handle release
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-34917 Jirabot Action Result: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenrowland this change was difficult to review because the entire block within the new try showed up as new. Were there any changes in that logic?
Also, left a couple of minor comments.
Consider the change Copilot suggested.
{ | ||
StringBuffer errorMsg; | ||
e->errorMessage(errorMsg); | ||
WARNLOG("ElasticMetricSink: Exception during configuration, error=%d, message=%s", e->errorCode(), errorMsg.str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor, but this exception is encountered during load time, not during configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this and generic catch log messages to "initialization"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenrowland a couple of outstanding comments
StringBuffer errorMsg; | ||
e->errorMessage(errorMsg); | ||
WARNLOG("ElasticMetricSink: Exception during configuration, error=%d, message=%s", e->errorCode(), errorMsg.str()); | ||
e->Release(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please respond to this suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenrowland seems ready to move forward, go ahead and squash
ffbea88
to
719ee43
Compare
@ghalliday Please merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenrowland one minor comment. Please squash the change in.
Owned<IException> ex = e; | ||
StringBuffer errorMsg; | ||
ex->errorMessage(errorMsg); | ||
WARNLOG("ElasticMetricSink: Exception during initialization, error=%d, message=%s", e->errorCode(), errorMsg.str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: Should be OWARNLOG - i.e. operator as the audience rather than the user. Same below.
…ryption Added try/catch around initialization to capture and log exceptions Signed-Off-By: Kenneth Rowland kenneth.rowland@lexisnexisrisk.com
@ghalliday Changed as requested. Also changed other warning log messages to OWARNLOG since they too are not for the user. |
Added try/catch around initialization to capture and log exceptions
Signed-Off-By: Kenneth Rowland kenneth.rowland@lexisnexisrisk.com
Type of change:
Checklist:
Smoketest:
Testing: