-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Cancel in-flight search tasks due to search backpressure with 429 sta… #6634
Cancel in-flight search tasks due to search backpressure with 429 sta… #6634
Conversation
…tus code Signed-off-by: PritLadani <pritkladani@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
if (cause.getCause() instanceof TaskCancelledException | ||
&& ((TaskCancelledException) cause.getCause()).status() == RestStatus.TOO_MANY_REQUESTS) { | ||
return ((TaskCancelledException) cause.getCause()).status(); |
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.
can we avoid TaskCancelledException
in OpenSearchException
? This looks like an anti pattern.
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.
One alternate here is to make it generic and throw the underlying cause's status in all cases till level 2 . We need to think about whether it is the right behavior and also make sure it doesn't cause any regression in existing code (ITs would make sure of that). Something on the below lines.
public RestStatus status() {
Throwable cause = unwrapCause();
if (cause == this) {
return RestStatus.INTERNAL_SERVER_ERROR;
} else {
if (cause.getCause() != cause) {
return ExceptionsHelper.status(cause.getCause());
}
return ExceptionsHelper.status(cause);
}
}
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.
trying this
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.
The other better option is to override this in TaskCancelledException
.
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.
@PritLadani Can you explore the second suggestion to do the override in TaskCancelledException? The code snippet above doesn't look quite right because it calls an "unwrapCause()" method but then proceeds to do another level of cause unwrapping. I'm really concerned about unintended side effects of that approach, and I also don't have a ton of confidence that ITs would catch every possible regression.
} | ||
|
||
private static boolean isRejection(String reason) { | ||
return (reason.contains("usage exceeded") || REASON_PARENT_CANCELLED_HIGH_RESOURCE_CONSUMPTION.equals(reason)); |
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 make usage exceeded
a constant and use that instead.
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.
ack
Signed-off-by: PritLadani <pritkladani@gmail.com>
Signed-off-by: PritLadani <pritkladani@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
onPhaseFailure( | ||
currentPhase, | ||
"SearchTask was cancelled", | ||
new TaskCancelledException(new OpenSearchRejectedExecutionException("cancelled task with reason: " + reason)) |
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.
This layered exceptions wrapping does not look right, I think we should introduce dedicated exception (fe TaskBackpressureException
or alike) to differentiate between cancellation modes.
This PR is stalled because it has been open for 30 days with no activity. Remove stalled label or comment or this will be closed in 7 days. |
Will get back to this. Open for other's contribution though. |
This PR is stalled because it has been open for 30 days with no activity. Remove stalled label or comment or this will be closed in 7 days. |
This PR was closed because it has been stalled for 7 days with no activity. |
Apologies. This PR was auto closed without reaching a resolution from the maintainers. |
Compatibility status:Checks if related components are compatible with change 47dff7e Incompatible componentsSkipped componentsCompatible components |
Gradle Check (Jenkins) Run Completed with:
|
@PritLadani is this being worked upon? Do tag the maintainers for closure on this if required. |
@kkhatua can someone take a look at this, if not already addressed? |
|
||
public static void throwTaskCancelledException(String reason) { | ||
if (isRejection(reason)) { | ||
throw new TaskCancelledException(new OpenSearchRejectedExecutionException("cancelled task with reason: " + reason)); |
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.
Can't we just throw OpenSearchRejectedExecutionService
if task is rejected ?
Hi @PritLadani, it seems like progress on this PR has stopped for a couple months. I recommend we close this for the time being to make sure we can keep track on everything going on. @peternied could you help by closing this PR for now? Prit please feel free to re-open should you take up further work here. |
This PR is stalled because it has been open for 30 days with no activity. |
Description
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.