java.util.concurrent.TimeoutException:创建akka actorSystem时,Futures在[3000毫秒]后超时

java.util.concurrent.TimeoutException:创建akka actorSystem时,Futures在[3000毫秒]后超时,akka,akka-cluster,Akka,Akka Cluster,我正在使用akka集群输入输出项目 以下是akka配置- akka { loggers = ["akka.event.slf4j.Slf4jLogger"] loglevel = "DEBUG" logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" actor { provider = "akka.cluster.ClusterActorRefProvider"

我正在使用akka集群输入输出项目

以下是akka配置-

    akka {
      loggers = ["akka.event.slf4j.Slf4jLogger"]
      loglevel = "DEBUG"
      logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"

      actor {
        provider = "akka.cluster.ClusterActorRefProvider"
        creation-timeout = 20s
        warn-about-java-serializer-usage = on
        enable-additional-serialization-bindings = on
      }

      remote {
        log-remote-lifecycle-events = off
        log-frame-size-exceeding = 15 MiB
        artery {
          enabled = on
          canonical {
            port = 2551
          }
          advanced {
            maximum-frame-size = 15 MiB
            buffer-pool-size = 1024
            maximum-large-frame-size = 15 MiB
            large-buffer-pool-size = 4096
            outbound-message-queue-size = 4096
            outbound-control-queue-size = 20000
            outbound-large-message-queue-size = 4096
          }
        }
      }

      cluster {
        seed-node-timeout = 15s
        retry-unsuccessful-join-after = 15s
        shutdown-after-unsuccessful-join-seed-nodes = off
        auto-down-unreachable-after = off
        seed-nodes = ["akka://ClusterSystem@SERVER1:2551", "akka://ClusterSystem@SERVER2:2551"]
      }
    }
Actor系统是使用-

package com.mycompany.akka;

import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import akka.actor.ActorSystem;

public class ActorSystemFactory {
    public static ActorSystem getActorSystem() {

        try {

            String hostName = String hostName = InetAddress.getLocalHost().getHostName();

            Config cfg = ConfigFactory.parseString(
                    "akka.remote.artery.canonical.hostname=" + hostName).withFallback(
                    ConfigFactory.load());

            String prop = System.getProperty("cluster_name");
            if (prop == null)
                throw new Exception("property cluster_name is not set");

            ActorSystem as = ActorSystem.create(prop, cfg);
            return as;
        } catch ( Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
}
我始终能够看到actor系统因以下错误而关闭-

java.lang.RuntimeException: java.util.concurrent.TimeoutException: Futures timed out after [3000 milliseconds]
    at com.mycompany.akka.ActorSystemFactory.getActorSystem(ActorSystemFactory.java:22)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 25 more
Caused by: java.util.concurrent.TimeoutException: Futures timed out after [3000 milliseconds]
    at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:223)
    at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:227)
    at scala.concurrent.Await$$anonfun$result$1.apply(package.scala:190)
    at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53)
    at scala.concurrent.Await$.result(package.scala:190)
    at akka.remote.artery.aeron.ArteryAeronUdpTransport.retry$1(ArteryAeronUdpTransport.scala:235)
    at akka.remote.artery.aeron.ArteryAeronUdpTransport.blockUntilChannelActive(ArteryAeronUdpTransport.scala:232)
    at akka.remote.artery.aeron.ArteryAeronUdpTransport.runInboundStreams(ArteryAeronUdpTransport.scala:347)
    at akka.remote.artery.ArteryTransport.start(ArteryTransport.scala:467)
    at akka.remote.RemoteActorRefProvider.init(RemoteActorRefProvider.scala:234)
    at akka.cluster.ClusterActorRefProvider.init(ClusterActorRefProvider.scala:40)
    at akka.actor.ActorSystemImpl.liftedTree2$1(ActorSystem.scala:912)
    at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:908)
    at akka.actor.ActorSystemImpl._start(ActorSystem.scala:908)
    at akka.actor.ActorSystemImpl.start(ActorSystem.scala:930)
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:258)
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:302)
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:276)
    at akka.actor.ActorSystem$.create(ActorSystem.scala:199)
    at akka.actor.ActorSystem.create(ActorSystem.scala)
    at com.mycompany.akka.ActorSystemFactory.getActorSystem(ActorSystemFactory.java:22)
    ... 30 more
akka版本-2.5.25 scala版本-2.11


actor系统存在什么问题?如何解决此问题?

工作解决方案:

我也不得不努力找出确切的解决方案,这里是基于我能找到的例外情况。您必须在akka->actor->remote->artery->bind配置中添加bind.bind-timeout

  remote.artery {
    # The port clients should connect to.
    canonical.port = 2551
    bind.bind-timeout = 30s
  }