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

Correct exception logging #1882

Merged
merged 3 commits into from
Mar 10, 2021
Merged

Correct exception logging #1882

merged 3 commits into from
Mar 10, 2021

Conversation

wcekan
Copy link
Contributor

@wcekan wcekan commented Mar 9, 2021

Description

Always re-throw or re-interrupt when catching the InterruptedException.

When the final argument in a slf4j log message is a throwable, it generates a stack trace and is not one of the formatting arguments.
It appears the code had intended to display only the .toString based on the unused {}

05:46:51.561 [qtp135639164-244] ERROR c.y.e.a.service.AsyncExecutorService.executeQuery(AsyncExecutorService.java:96) - TimeoutException: {}
java.util.concurrent.TimeoutException: null
at java.util.concurrent.FutureTask.get(FutureTask.java:205)
at com.yahoo.elide.async.service.AsyncExecutorService.executeQuery(AsyncExecutorService.java:85)
at com.yahoo.elide.async.hooks.AsyncAPIHook.executeAsync(AsyncAPIHook.java:100)
at com.yahoo.elide.async.hooks.AsyncAPIHook.executeHook(AsyncAPIHook.java:67)
at com.yahoo.elide.async.hooks.AsyncQueryHook.execute(AsyncQueryHook.java:38)
at com.yahoo.elide.async.hooks.AsyncQueryHook.execute(AsyncQueryHook.java:28)

Motivation and Context

Incorrect logging

How Has This Been Tested?

Unit testing

License

I confirm that this contribution is made under an Apache 2.0 license and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@wcekan wcekan requested review from ayeswarya and aklish March 9, 2021 11:08
@@ -40,10 +40,10 @@ public void run() {
asyncAPIDao.updateAsyncAPIResult(queryResultObj, queryObj.getId(), queryObj.getClass());

} catch (InterruptedException e) {
log.error("InterruptedException: {}", e);
log.error("InterruptedException: {}", e.toString());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the stack trace is intended, we need to instead remove the {} from the formatting

log.error("InterruptedException", e);

Copy link
Collaborator

Choose a reason for hiding this comment

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

stacktrace was not intended.

Copy link
Member

Choose a reason for hiding this comment

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

What is the purpose of:
Thread.currentThread().interrupt();
?

@aklish aklish merged commit 36fb163 into master Mar 10, 2021
@aklish aklish deleted the Carbon-167-Async-Exceptions branch March 10, 2021 20:14
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.

None yet

3 participants