Akka.Remote - 解除关联后无法向远程actor发送消息

时间:2016-01-21 12:29:04

标签: akka.net

我正在使用Akka.Remote在服务器端服务应用程序和多个桌面客户端应用程序之间进行通信。客户端向服务器发送请求消息(使用Akka.net)并等待服务器回复响应消息。客户端应用程序是瞬态的,这意味着它们经常连接到服务器,保持连接一段时间,断开连接然后重新连接。

我遇到的问题是,有时当客户端与服务器actor断开连接(通过关闭其ActorSystem)然后重新连接回服务器时,它在一段时间内不会收到来自服务器的任何回复。几分钟后,通信工作没有任何问题。我发现当服务器向请求期间已断开连接且无法再访问的客户端发送回复时,会出现此问题。服务器无法传递响应消息,并以某种方式将客户端端点标记为无效。

在日志中(在服务器端),当客户端断开连接时,我收到以下消息。

[DEBUG] 2016-01-21 13:04:58.6151 received AutoReceiveMessage <Terminated>: [akka.tcp://qb@client:8090/user/qb] - ExistenceConfirmed=True  ServerActor
[DEBUG] 2016-01-21 13:04:58.6550 Stopped  Akka.Remote.Transport.ProtocolStateActor
[ INFO] 2016-01-21 13:04:58.6550 Quarantined address [akka.tcp://qb@client:8090] is still unreachable or has not been restarted. Keeping it quarantined.  Akka.Event.DummyClassForStringSources
[DEBUG] 2016-01-21 13:04:58.6725 Stopped  Akka.Remote.ReliableDeliverySupervisor
[DEBUG] 2016-01-21 13:04:58.6725 no longer watched by [akka://myservice/system/endpointManager/reliableEndpointWriter-akka.tcp%3a%2f%2fqb%40client%3a8090-2]  Akka.Remote.EndpointWriter
[DEBUG] 2016-01-21 13:04:58.6725 Disassociated [akka.tcp://myservice@server:8081] <- akka.tcp://qb@client:8090  Akka.Remote.EndpointWriter
[DEBUG] 2016-01-21 13:04:58.6725 Stopped  Akka.Remote.EndpointWriter

然后当客户端尝试重新连接时,我得到:

[DEBUG] 2016-01-21 13:05:15.5883 ConnectResponse [akka.tcp://qb@client:8090/user/qb]  ServerActor
[DEBUG] 2016-01-21 13:05:16.0467 Started (Akka.Remote.Transport.ProtocolStateActor)  Akka.Remote.Transport.ProtocolStateActor
[DEBUG] 2016-01-21 13:05:16.0467 Stopped  Akka.Remote.Transport.ProtocolStateActor
[ WARN] 2016-01-21 13:05:16.0467 AssociationError [akka.tcp://myservice@server:8081] -> akka.tcp://qb@client:8090: Error [Invalid address: akka.tcp://qb@client:8090] []  Akka.Remote.EndpointWriter
[ INFO] 2016-01-21 13:05:16.0467 Quarantined address [akka.tcp://qb@client:8090] is still unreachable or has not been restarted. Keeping it quarantined.  Akka.Event.DummyClassForStringSources
[DEBUG] 2016-01-21 13:05:16.0643 Stopped  Akka.Remote.ReliableDeliverySupervisor
[DEBUG] 2016-01-21 13:05:16.0711 no longer watched by [akka://myservice/system/endpointManager/reliableEndpointWriter-akka.tcp%3a%2f%2fqb%40client%3a8090-4]  Akka.Remote.EndpointWriter
[DEBUG] 2016-01-21 13:05:16.0711 Disassociated [akka.tcp://myservice@server:8081] -> akka.tcp://qb@client:8090  Akka.Remote.EndpointWriter
[DEBUG] 2016-01-21 13:05:16.0711 Stopped  Akka.Remote.EndpointWriter
[DEBUG] 2016-01-21 13:05:16.0867 received AutoReceiveMessage <Terminated>: [akka://myservice/system/endpointManager/reliableEndpointWriter-akka.tcp%3a%2f%2fqb%40client%3a8090-4] - ExistenceConfirmed=True  Akka.Remote.EndpointManager
[DEBUG] 2016-01-21 13:05:16.0867 Terminated [akka.tcp://qb@client:8090/user/qb]  ServerActor

我怀疑这种行为是Akka.net的一个功能,但是,我需要实现我的系统,以便客户端可以断开连接,然后重新连接回服务器而无需等待。有没有办法禁用隔离机制或正常关闭服务器上的客户端端点,以便客户端端点不会被隔离?

1 个答案:

答案 0 :(得分:3)

[ INFO] 2016-01-21 13:04:58.6550 Quarantined address [akka.tcp://qb@client:8090] is still unreachable or has not been restarted. Keeping it quarantined. - 说明了一切。该节点被隔离,需要重新启动actor系统。

然而,恕我直言 - 只是升级到星期一发布的Akka.NET 1.0.6。我们使远程政策经理比历史上更加脆弱。