opensearch-java icon indicating copy to clipboard operation
opensearch-java copied to clipboard

[BUG] ClassCastException in AWS transport error handling

Open andrewparmet opened this issue 1 year ago • 1 comments

What is the bug?

The cast from Throwable to Exception in AwsSdk2Transport misses the case when a Throwable does not extend Error or Exception.

Unfortunately I don't have any other information other than that the class of the casted Throwable is simply Throwable (as opposed to some other inheritor of Throwable that is not Error or Exception).

My guess is that the HC5 transport is also vulnerable to this bug.

How can one reproduce the bug?

So far it's been a one-off.

What is the expected behavior?

Exception handling should not fail!

What is your host/environment?

Linux. OpenSearch 2.12.0.

Do you have any screenshots?

Nope.

Do you have any additional context?

This is part of the error handling code to wrap exceptions whose stack traces are unrelated to the caller due to the fact that the AWS transport is asynchronous.

andrewparmet avatar Sep 09 '24 23:09 andrewparmet

[Catch All Triage - 1, 2, 3, 4]

dblock avatar Sep 30 '24 16:09 dblock

Looks like this was fixed by https://github.com/opensearch-project/opensearch-java/commit/a1163049056c5d009c9a96142c9a3b8d32ee3c0f

andrewparmet avatar Apr 29 '25 15:04 andrewparmet