2016-01-21 86 views
2

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

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

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

[DEBUG] 2016-01-21 13:04:58.6151 received AutoReceiveMessage <Terminated>: [akka.tcp://[email protected]: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://[email protected]: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://[email protected]:8081] <- akka.tcp://[email protected]: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://[email protected]: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://[email protected]:8081] -> akka.tcp://[email protected]:8090: Error [Invalid address: akka.tcp://[email protected]:8090] [] Akka.Remote.EndpointWriter 
[ INFO] 2016-01-21 13:05:16.0467 Quarantined address [akka.tcp://[email protected]: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://[email protected]:8081] -> akka.tcp://[email protected]: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://[email protected]:8090/user/qb] ServerActor 

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

回答

3

[ INFO] 2016-01-21 13:04:58.6550 Quarantined address [akka.tcp://[email protected]:8090] is still unreachable or has not been restarted. Keeping it quarantined. - 就是这么说的。节点被隔离,需要重新启动actor系统。

但是,恕我直言 - 只是升级到我们周一发布的Akka.NET 1.0.6。我们让远程政策经理比历史上的脆弱得多。

+1

谢谢@Aaronontheweb。我是否需要重新启动服务器端或客户端的参与者系统?或两者? –

+1

您需要在连接的另一端重新启动参与者系统 - 因此,如果服务器报告它隔离了客户端,则需要重新启动客户端。 – Aaronontheweb