我们创建了一个Akka集群基础设施,用于短信、电子邮件和推送通知。系统中存在3种不同的节点,即客户端、发送方和灯塔。Web应用程序和API应用程序正在使用客户端角色(Web和API托管在IIS中)。灯塔和发件人角色被托管为Windows服务。考虑到在global.asax.cs的开始和停止事件中,由于IIS,Web和API应用程序AppPools回收,我们关闭了客户角色中的参与者系统,然后重新启动。我们可以通过日志观察到系统成功地关闭并加入集群。
但有时,当AppPool回收时,客户端ActorSystem启动但不能加入集群,并且通知停止工作(这对我们来说是个大问题)。当我们手动弹出ActorSystem并使其再次手动工作时,它将加入集群。这种情况大约每两天发生一次。
我们可以观察到客户端在出现错误之前加入了集群;
节点akka.tcp://NotificationSystem@...:41350正在加入,角色客户端 领导者正在将节点akka.tcp://NotificationSystem@...:41350向上移动
通过查看日志,我们可以看到客户端加入集群后出现了以下错误;
关闭地址: akka.tcp://NotificationSystem@...:41350Akka.Remote.ShutDownAssociation:关闭地址: akka.tcp://NotificationSystem@...:41350 --> Akka.Remote.Transport.InvalidAssociationException:远程系统终止关联,因为它正在关闭。--内部异常堆栈跟踪的结束-在Akka.Remote.EndpointWriter.PublishAndThrow(Exception原因,LogLevel级别上,在Akka.Remote.EndpointWriter.b__20_0(异常原因) at Akka.Actor.LocalOnlyDecider.Decide(异常原因) at Akka.Actor.OneForOneStrategy.Handle(IActorRef子类,异常x) at Akka.Actor.SupervisorStrategy.HandleFailure(ActorCell actorCell,异常原因,ChildRestartStats failedChildStats,akka.tcp://NotificationSystem@...:41350 ( IReadOnlyCollection1 allChildren)在Akka.Actor.ActorCell.HandleFailed(Failed f) at Akka.Actor.ActorCell.SystemInvoke(信封信封)--从抛出异常的前一个位置开始的堆栈跟踪--在Akka.Actor.ActorCell.SystemInvoke(信封)Akka.Remote.ShutDownAssociation处的Akka.Actor.ActorCell.HandleFailed(失败f):关闭地址:Akka.Actor.ActorCell.SystemInvoke--> Akka.Remote.Transport.InvalidAssociationException:远程系统终止了关联,因为它正在关闭。--内部异常堆栈跟踪的结束-在Akka.Remote.EndpointWriter.PublishAndThrow(Exception原因,LogLevel级别上,在Akka.Remote.EndpointWriter.b__20_0(异常原因) at Akka.Actor.LocalOnlyDecider.Decide(异常原因) at Akka.Actor.OneForOneStrategy.Handle(IActorRef子类,异常x) at Akka.Actor.SupervisorStrategy.HandleFailure(ActorCell actorCell,异常原因,ChildRestartStats failedChildStats,IReadOnlyCollection`1‘1 allChildren) at Akka.Actor.ActorCell.HandleFailed(Failed f) at Akka.Actor.ActorCell.SystemInvoke(信封)--从抛出异常的以前位置开始的堆栈跟踪结束--在Akka.Actor.ActorCell.SystemInvoke(信封)处的Akka.Actor.ActorCell.HandleFailed(失败f)处
在错误发生后,我们看到下面的错误信息;
具有UID 226948907的akka.tcp://NotificationSystem@...:41350关联是不可恢复的失败。UID现在被隔离,所有到这个UID的消息都将被传递到死信中。必须重新启动远程操作系统,以便从这种情况中恢复过来。
如果不重新启动客户端参与者,系统就无法自我纠正。
我们的客户角色配置是;
<akka>
<hocon>
<![CDATA[
akka{
loglevel = DEBUG
actor{
provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
deployment {
/coordinatorRouter {
router = round-robin-group
routees.paths = ["/user/NotificationCoordinator"]
cluster {
enabled = on
max-nr-of-instances-per-node = 1
allow-local-routees = off
use-role = sender
}
}
}
serializers {
wire = "Akka.Serialization.WireSerializer, Akka.Serialization.Wire"
}
serialization-bindings {
"System.Object" = wire
}
debug{
receive = on
autoreceive = on
lifecycle = on
event-stream = on
unhandled = on
}
}
remote {
helios.tcp {
transport-class = "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
applied-adapters = []
transport-protocol = tcp
hostname = "***.***.**.**"
port = 0
}
}
cluster {
seed-nodes = ["akka.tcp://NotificationSystem@***.***.**.**:5053", "akka.tcp://NotificationSystem@***.***.**.**:5073"]
roles = [client]
}
}
]]>
</hocon>
我们的发件人角色配置是;
<akka>
<hocon><![CDATA[
akka{
loglevel = INFO
loggers = ["Akka.Logger.NLog.NLogLogger, Akka.Logger.NLog"]
actor{
debug {
# receive = on
# autoreceive = on
# lifecycle = on
# event-stream = on
# unhandled = on
}
provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
serializers {
wire = "Akka.Serialization.WireSerializer, Akka.Serialization.Wire"
}
serialization-bindings {
"System.Object" = wire
}
deployment{
/NotificationCoordinator/ApplePushNotificationActor{
router = round-robin-pool
resizer{
enabled = on
lower-bound = 3
upper-bound = 5
}
}
/NotificationCoordinator/AndroidPushNotificationActor{
router = round-robin-pool
resizer{
enabled = on
lower-bound = 3
upper-bound = 5
}
}
/NotificationCoordinator/EmailActor{
router = round-robin-pool
resizer{
enabled = on
lower-bound = 3
upper-bound = 5
}
}
/NotificationCoordinator/SmsActor{
router = round-robin-pool
resizer{
enabled = on
lower-bound = 3
upper-bound = 5
}
}
/NotificationCoordinator/LoggingCoordinator/ResponseLoggerActor{
router = round-robin-pool
resizer{
enabled = on
lower-bound = 3
upper-bound = 5
}
}
}
}
remote{
log-remote-lifecycle-events = DEBUG
log-received-messages = on
helios.tcp{
transport-class = "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
applied-adapters = []
transport-protocol = tcp
#will be populated with a dynamic host-name at runtime if left uncommented
#public-hostname = "POPULATE STATIC IP HERE"
hostname = "***.***.**.**"
port = 0
}
}
cluster {
seed-nodes = ["akka.tcp://NotificationSystem@***.***.**.**:5053", "akka.tcp://NotificationSystem@***.***.**.**:5073"]
roles = [sender]
}
}
]]></hocon>
我们如何解决这个问题呢?谢谢。
发布于 2016-06-07 17:02:05
这绝对是EndpointManager在Akka.Remote中的一个bug。Akka.NET 1.1 --定于6月14日发布,应该能解决这个问题。我们已经修复了大量的集群,按照这些思路重新加入了but,但它们还没有发布。Akka.Cluster将作为该版本的一部分进行RTM编辑。
同时,如果您现在想尝试新的比特,也可以尝试使用Akka.NET夜间构建。
https://stackoverflow.com/questions/37680960
复制相似问题