You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unknown error while making a remote service call: Cannot assign requested address #849
SendEachForMulticast throws exception and cannot proceed the notification messages.
"Unknown error while making a remote service call: Cannot assign requested address"
Our kubernetes pod handles 6 kafka partition, each partition keeps messages that consist of 500 registration ids. Begore the multicast deprecation, older method works but very slow. We changed the method and started to getting many 'Cannot assign requested address' error.
I do not understand if the library that uses http/2 or not.
does the http client of google library benefits from useinf same connection and does is use reactive event pool like webclient of spring boot?
environment
Operating System version: temurin java 17 docker image
The error likely occurs because the system has run out of temporary ports used for outbound connections because Admin SDK 9.2.0 does not support HTTP/2 and establishes a new HTTP connection for each message sent.
We've added the HTTP/2 support in 9.5.0. Please upgrade to see if this resolves the issue.
我的解决方案是:
public static HttpAsyncClientBuilder defaultHttpAsyncClientBuilder() {
PoolingAsyncClientConnectionManager connectionManager =
PoolingAsyncClientConnectionManagerBuilder.create()
// Set Max total connections to match google api client limits
// https://github.com/googleapis/google-http-java-client/blob/f9d4e15bd3c784b1fd3b0f3468000a91c6f79715/google-http-client-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5HttpTransport.java#L151
.setMaxConnTotal(200)
// Set max connections per route to match the concurrent stream limit of the FCM backend.
.setMaxConnPerRoute(100)
.setValidateAfterInactivity(TimeValue.ofSeconds(5)) // 1.
.setDefaultConnectionConfig(
ConnectionConfig.custom().setTimeToLive(5, TimeUnit.MINUTES).build()) //2.
.setDefaultTlsConfig(
TlsConfig.custom().setVersionPolicy(HttpVersionPolicy.NEGOTIATE).build())
.setTlsStrategy(ClientTlsStrategyBuilder.create()
.setSslContext(SSLContexts.createSystemDefault())
.build())
.build();
return HttpAsyncClientBuilder.create()
// Set maxConcurrentStreams to 100 to match the concurrent stream limit of the FCM backend.
.setH2Config(H2Config.custom().setMaxConcurrentStreams(100).build())
.setHttp1Config(Http1Config.DEFAULT)
.setConnectionManager(connectionManager)
.setRoutePlanner(new SystemDefaultRoutePlanner(ProxySelector.getDefault()))
.disableRedirectHandling()
.disableAutomaticRetries();
}
Activity
google-oss-bot commentedon Aug 6, 2023
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
emindeniz99 commentedon Nov 29, 2023
@Doris-Ge Hello, Is there any update?
bivrantoshakil commentedon May 11, 2024
@jonathanedey any update on this so far?
S-MW commentedon Dec 24, 2025
any update so far ? @emindeniz99
Doris-Ge commentedon Dec 27, 2025
Sorry for the delayed response!
The error likely occurs because the system has run out of temporary ports used for outbound connections because Admin SDK 9.2.0 does not support HTTP/2 and establishes a new HTTP connection for each message sent.
We've added the HTTP/2 support in 9.5.0. Please upgrade to see if this resolves the issue.
hq112415 commentedon Jul 15, 2026
升级到 9.5.0(HTTP/2)并不能真正解决这个问题
原因是
ApacheHttp2Transport里的连接池没有设置validateAfterInactivity,连接建立后永不过期、也不做探活。在 K8s等有状态中间层的环境下,中间层会静默丢弃 idle 的 TCP 连接,连接池却仍然认为连接是好的,下次复用时写入就会命中 RST我的解决方案是:
public static HttpAsyncClientBuilder defaultHttpAsyncClientBuilder() {
PoolingAsyncClientConnectionManager connectionManager =
PoolingAsyncClientConnectionManagerBuilder.create()
// Set Max total connections to match google api client limits
// https://github.com/googleapis/google-http-java-client/blob/f9d4e15bd3c784b1fd3b0f3468000a91c6f79715/google-http-client-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5HttpTransport.java#L151
.setMaxConnTotal(200)
// Set max connections per route to match the concurrent stream limit of the FCM backend.
.setMaxConnPerRoute(100)
.setValidateAfterInactivity(TimeValue.ofSeconds(5)) // 1.
.setDefaultConnectionConfig(
ConnectionConfig.custom().setTimeToLive(5, TimeUnit.MINUTES).build()) //2.
.setDefaultTlsConfig(
TlsConfig.custom().setVersionPolicy(HttpVersionPolicy.NEGOTIATE).build())
.setTlsStrategy(ClientTlsStrategyBuilder.create()
.setSslContext(SSLContexts.createSystemDefault())
.build())
.build();
return HttpAsyncClientBuilder.create()
// Set maxConcurrentStreams to 100 to match the concurrent stream limit of the FCM backend.
.setH2Config(H2Config.custom().setMaxConcurrentStreams(100).build())
.setHttp1Config(Http1Config.DEFAULT)
.setConnectionManager(connectionManager)
.setRoutePlanner(new SystemDefaultRoutePlanner(ProxySelector.getDefault()))
.disableRedirectHandling()
.disableAutomaticRetries();
}
目前没有发现问题