googleapis / googleapis/google-cloud-java

[sdk-platform-java] RetryingFuture is not terminating the client correctly

Open
#12,519 3 comments 0 reactions 0 assignees View on GitHub
priority: p4 type: bug
Dominant language
Java
Stars
2.1k
Forks
1.2k
Avg merge
1d 23h
Merged PRs (30d)
154

Description

When `tracer` throw an error (https://github.com/googleapis/gax-java/blob/v2.20.1/gax/src/main/java/com/google/api/gax/retrying/BasicRetryingFuture.java#L202) because of version mismatch, the client will hang forever. The problem seems to be somewhere in `BasicRetryingFuture` and `CallbackChainRetryingFuture`.

In the following reproduce, `tracer.attemptSucceeded` will throw `NoSuchMethodError` because of the version mismatch. This exception will get caught in CallbackChainRetryingFuture#AttemptCompletionListener#run() https://github.com/googleapis/gax-java/blob/v2.20.1/gax/src/main/java/com/google/api/gax/retrying/CallbackChainRetryingFuture.java#L119. handle() is a noop because this attempt is already executed. Then the client goes into hang. The error is also not bubbled up which made it very difficult to debug.

#### Steps to reproduce

Dependency:

```



com.google.cloud
libraries-bom
26.1.1
pom
import


com.google.api
gax
2.19.6-SNAPSHOT




com.google.cloud
google-cloud-bigtable
2.15.0


```

Main:

Note: we need to create a bigtable instance and bigtable table with column family "cf1".

```
public static void main(String[] args) throws IOException, InterruptedException, ExecutionException {

BigtableDataSettings.Builder settings = BigtableDataSettings.newBuilder()
.setProjectId()
.setInstanceId();

try (BigtableDataClient client = BigtableDataClient.create(settings.build())) {
BulkMutation mutation = BulkMutation.create().add(RowMutationEntry.create("row-key-1").setCell("cf1", "q", "v2"));
client.mutateRowAsync(RowMutation.create("test", "row-key-1").deleteRow()).addListener(
new Runnable() {
@Override
public void run() {
System.out.println("Listener is called");
}
}, MoreExecutors.directExecutor()
);

Thread.sleep(60000);
}
}
```

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.