firebase / firebase/firebase-admin-java

ApacheHttp2Transport connection did not return to the pool when it is failed

Đang mở
#1,134 1 bình luận 0 reaction 1 người được giao Được @jonathanedey nhận Xem trên GitHub
Ngôn ngữ chính
Java
Star
620
Fork
305
Merge trung bình
3 giờ 23 phút
Pull request đã merge (30 ngày)
1

Mô tả

Firebase Admin Java SDK v9.6.0

```
FirebaseOptions.Builder builder = FirebaseOptions.builder()
...
.setHttpTransport(new ApacheHttp2Transport(httpClient));
```

```
ApiFuture futures = firebaseMessaging.sendEachAsync(messages, dryRun);
BatchResponse response;
try {
response = futures.get(TIME_OUT_MS, TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
...
}
```

```
final PoolStats total = poolingAsyncClientConnectionManager.getTotalStats();
return String.format("Available=%d, leased=%d, pending=%d, max=%d",
total.getAvailable(),
total.getLeased(),
total.getPending(),
total.getMax());
```

Observation:
Under very busy network, FCM backend may return `Unknown error while making a remote service call: Write Timeout` or other errors.

Log writing (successful or failed response) become slow and slower. Afterward, all pending requests were timed out at ` response = futures.get(TIME_OUT_MS, TimeUnit.MILLISECONDS);`

```
When the program just started:
Available=95, leased=5, pending=0, max=200
```
```
After some times:
Available=0, leased=0, pending=0, max=200
```

-----------------------------------------------------------------------------------------------------------------------
Update:

When using `Google APIs Transports`:
There is `disconnect` implementation in [google-http-java-client](https://github.com/googleapis/google-http-java-client/blob/main/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java#L118)

However, when using `ApacheHttp2Transport`:
There is no such implementation in [ApacheHttp2Response ](https://github.com/firebase/firebase-admin-java/blob/master/src/main/java/com/google/firebase/internal/ApacheHttp2Response.java)
when it is [disconnected](https://github.com/firebase/firebase-admin-java/blob/master/src/main/java/com/google/firebase/internal/ErrorHandlingHttpClient.java#L113), no matter the response is successfully or failed.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.