googleapis / googleapis/google-cloud-java
[sdk-platform-java] RetryingFuture is not terminating the client correctly
- 主要语言
- Java
- 星标
- 2.1k
- 派生
- 1.2k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 157
描述
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!
贡献指南
调研方向
从 tracer.attemptSucceeded 调用附近的 BasicRetryingFuture.java,以及 AttemptCompletionListener#run() 附近的 CallbackChainRetryingFuture.java 开始。使用 dependency 和 Bigtable client 示例复现版本不匹配的情况,然后追踪为什么 NoSuchMethodError 既没有暴露出来,也没有终止 client。完成的标准是错误能够传播出去,并且 client 在此场景下不再挂起。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- api, backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100