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

OperationFuture .get can throw a TimeoutException wrapped in an ExecutionException that doesn't get propagated out as an OperationTimeoutException #48

Open
jattisha opened this issue Mar 12, 2025 · 0 comments

Comments

@jattisha
Copy link

When calling .get(duration, unit) for an OperationTimeout, there's a possibility that the underlying operation can timeout, resulting in a CheckedOperationTimeoutException wrapped in an ExecutionException. However, when the MemecachedClient implementation receives this exception for most of the methods that operate on these behaviors, it ends up simply propagating this up as a RuntimeException, rather than actually representing that the request timed out. For these, the proposal is to add an additional check to this code for:

...
    } catch (ExecutionException e) {
      if (e.getCause() instanceof CancellationException) {
        throw (CancellationException) e.getCause();
      } else if (e.getCause() instanceof TimeoutException) {
          throw new OperationTimeoutException("Timeout waiting for value", e);
      } else {
        throw new RuntimeException("Exception waiting for value", e);
      }
....

I've also created a PR for this, and will attach it to this issue.

jattisha pushed a commit to jattisha/aws-elasticache-cluster-client-memcached-for-java that referenced this issue Mar 12, 2025
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

No branches or pull requests

1 participant