Skip to content

Unknown error while making a remote service call: Cannot assign requested address #849

Open

Description

@emindeniz99

problem

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
  • Firebase SDK version: 9.2.0
  • framework version: spring boot 3
  • Firebase Product: fcm, messaging_ (auth, database, storage, etc)

Activity

  1. google-oss-bot commented on Aug 6, 2023

    @google-oss-bot

    I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

  2. emindeniz99 commented on Nov 29, 2023

    @emindeniz99
    Author

    @Doris-Ge Hello, Is there any update?

  3. self-assigned this
    on May 7, 2024
  4. bivrantoshakil commented on May 11, 2024

    @bivrantoshakil

    @jonathanedey any update on this so far?

  5. S-MW commented on Dec 24, 2025

    @S-MW

    any update so far ? @emindeniz99

  6. Doris-Ge commented on Dec 27, 2025

    @Doris-Ge
    Contributor

    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.

  7. hq112415 commented on Jul 15, 2026

    @hq112415
    1. 升级到 9.5.0(HTTP/2)并不能真正解决这个问题

    2. 原因是 ApacheHttp2Transport 里的连接池没有设置validateAfterInactivity,连接建立后永不过期、也不做探活。在 K8s等有状态中间层的环境下,中间层会静默丢弃 idle 的 TCP 连接,连接池却仍然认为连接是好的,下次复用时写入就会命中 RST

    3. 我的解决方案是:
      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();
      }

    目前没有发现问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions