gpt4 book ai didi

c# - 升级到SDK 2.3.301后,Service Fabric Actor或服务将变得无法访问

转载 作者:行者123 更新时间:2023-12-01 19:42:55 28 4
gpt4 key购买 nike

从Service Fabric SDK 2.0.135升级到2.3.301之后,我们开始遇到无法在Service Fabric资源管理器中正常显示Service Fabric角色或服务的情况。一旦处于此状态,则通过ActorProxy或ServiceProxy对actor或服务的任何调用将挂起5分钟,直到最终给出TimeoutException。一旦处于这种状态,参与者或服务将永远无法自行恢复-即使离开一个小时。唯一的解决方案是重置角色或服务所在的节点,重新部署角色或服务(完全相同的EXE),重置整个群集或重新启动所有群集计算机。

部署或重新部署SF应用程序后,通常会进入此状态。

在使用Service Fabric的最后一年(自SDK v1.3起),我们从未遇到过此问题。它只有在移至2.3.301之后才开始。

它似乎随机且不一致地发生。解决方案中的13个SF应用程序中哪个生效,也是随机的。

是否有人对我们如何解决此问题有任何想法?似乎是最新版本的Service Fabric中的错误,但也许我们最终做错了什么。

任何帮助表示赞赏。

以下是许多额外的信息,希望对理解我们面临的此问题有用。

非常感谢

步骤

我确实没有采取步骤来始终如一地重现该问题。这就是我有时观察到的。

  • 我已编译,然后从Visual Studio重新部署了我的SF项目(“调试”->“不调试就开始”)
  • Visual Studio表示已成功部署项目
  • Service Fabric资源管理器将我的所有服务都显示为“健康”,包括数据绑定(bind)
  • 有问题的SF项目有2个参与者,它们是单个EXE的一部分。 Service Fabric资源管理器显示了每个在不同节点上运行的参与者。
  • Windows任务管理器显示了EXE的两个运行副本,这很有意义,因为有两个节点正在运行EXE。

  • 同样,在直接使用PowerShell部署到Azure之后,我们的质量检查人员会遇到该问题。 (他没有从Visual Studio部署。)

    回顾
  • Visual Studio说部署成功
  • Service Fabric资源管理器显示一切正常
  • 任务管理器显示EXE
  • 的两个运行副本

    ,当我看到失败

    我有一个SF服务使用ServiceProxy或ActorProxy类调用另一个SF服务。在整个解决方案中,我们通过组合13种不同的应用程序和大约25种不同的服务与参与者来做到这一点。自2015年11月我们开始使用Service Fabric SDK v1.3以来,它一直成功运行。

    现在,升级到2.3.301后,我们会周期性地出现随机的Actor或Service进入从ServiceProxy或ActorProxy调用时无法响应方法调用的状态。挂起5分钟后,我们收到以下消息的System.Timeout异常:

    This can happen if message is dropped when service is busy or its long running operation and taking more time than configured Operation Timeout.



    请注意该服务不忙,也不执行长时间运行的操作。作为 Actor ,该服务根本不会进行任何持续的操作。它只是公开其他服务可以使用的公共(public)方法。从第一次调用开始就失败了。

    实际上,跟踪向我们显示,即使参与者中的方法的第一行也永远不会被调用。就像Service Fabric通信基础结构无法传递消息一样。

    开始的时间

    在过去的12个月中,我们从未见过此问题。

    现在,自上周升级Service Fabric以来,在各种情况下,我们经常看到此问题。

    我们升级到Service Fabric SDK 2.3.301.9590和Service Fabric 5.3.301.9590。

    最初,团队中的每个开发人员都独立遇到此问题,并且每个人都认为这只是我们的机器的暂时性问题。 Service Fabric确实存在一些问题,因此我们只接受此问题并继续。但是后来我们开始互相抱怨,意识到我们都看到了。甚至我们的QA也在即将投入生产的环境中的云中看到它。

    同样,这只有在上周我们升级到Service Fabric的最新版本时才开始。

    以前,我们运行Service Fabric SDK 2.0.135。

    我们通过安装SDK v 2.3.301,打开每个解决方案并允许Visual Studio进行升级来升级代码库。

    环境

    我正在具有16 GB RAM的i7上运行Windows 10 Enterprise的全新安装(不到2周前安装)。我重新安装了Visual Studio 2015 Update 3和SF 2.3.301.9590。我把所有东西都装干净了。没有升级。

    这在我所有同事的机器(不同年龄,配置和“新鲜程度”)上也都在发生。它偶尔发生在我们每个人身上。

    最关键的是,这也在Azure上的Service Fabric VM上发生。这些是我们的质量检查人员大约一个月前使用Azure上Service Fabric VM的标准模板创建的计算机。它已经预装了5.3.301.9590。他没有手动安装Service Fabric的任何更新。在开发人员升级到新版本之后,基于SF的应用程序在Azure(或我们自己的开发计算机)上才遇到此问题。

    这不是我的机器,也不是仅局限于开发环境。我们所有人唯一一致的变化就是SF版本的更新。

    原因

    我们不知道是什么原因造成的。

    通常在部署新的SF应用程序后立即发生。是的,我们确实要等待SF部署后通常需要2到3分钟才能“自行确定”。我们已经将其保留了一个小时或更长时间,但它永远无法正常工作。

    有趣的是,我认为我的SF服务正常运行,然后突然停止工作,但这是在我们意识到存在问题之前,所以我没有在寻找它。我不能确定。

    工作环境

    一旦我们的SF服务处于“无法访问”状态,Service Fabric就不会再次退出该状态。该应用程序完全无法使用。通过不同程度的成功,我们将执行以下操作:
  • 重新部署无法访问的SF应用程序
  • 重新启动节点(通过Service Fabric资源管理器,请转到
    节点,单击省略号按钮,然后单击“重新启动”选项)
    托管无法访问的SF服务和参与者
  • 重新启动整个SF群集(先停止然后再启动)
  • 重新启动所有运行SF节点的机器
  • 重置整个集群,然后重新部署一切(最后一招,但这是
    必要几次)

  • 有趣的是,无济于事的是使用任务管理器杀死有问题的进程。如果我终止了令人反感的进程,则Service Fabric将按预期方式将其重新启动,但是它仍然不会响应消息。

    因此,问题似乎出在Service Fabric本身,而不是EXE。

    当然,这些根本不是“解决方案”,因为在SF重新启动/重新平衡之前,它们将无法访问我们的整个应用程序。即使重新启动几个节点,也会使很多东西脱机。

    从本质上讲,这是我们的制胜法宝。像这样的Service Fabric,我们不可能将应用程序投入生产(甚至测试版)。

    使用服务代理或Actor代理时的C#异常:

    ActorProxy或ServicePRoxy抛出的异常的JSON呈现
    "exception": {
    "ClassName": "System.TimeoutException",
    "Message": "This can happen if message is dropped when service is busy or its long running operation and taking more time than configured Operation Timeout.",
    "Data": null,
    "InnerException": null,
    "HelpURL": null,
    "StackTraceString": " at Microsoft.ServiceFabric.Services.Communication.Client.ServicePartitionClient`1.<InvokeWithRetryAsync>d__7`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.ServiceFabric.Services.Remoting.Client.ServiceRemotingPartitionClient.<InvokeAsync>d__8.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.ServiceFabric.Services.Remoting.Builder.ProxyBase.<InvokeAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.ServiceFabric.Services.Remoting.Builder.ProxyBase.<ContinueWithResult>d__7`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at RenderingCachingEngine.RenderingCachingEngine.<Render>d__10.MoveNext() in C:\\Code\\Ink\\Dev\\Current\\Source\\Rendering Service Fabric\\RenderingCachingEngine\\RenderingCachingEngine.cs:line 381",
    "RemoteStackTraceString": null,
    "RemoteStackIndex": 0,
    "ExceptionMethod": "8\nMoveNext\nMicrosoft.ServiceFabric.Services, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\nMicrosoft.ServiceFabric.Services.Communication.Client.ServicePartitionClient`1+<InvokeWithRetryAsync>d__7`1\nVoid MoveNext()",
    "HResult": -2146233083,
    "Source": "Microsoft.ServiceFabric.Services",
    "WatsonBuckets": null
    }

    这是Service Fabric信息的JSON呈现:
      "serviceFabricInfo": {
    "serviceFabricServiceName": "fabric:/Rendering/RenderingCachingEngine",
    "serviceFabricServiceTypeName": "RenderingCachingEngineType",
    "serviceFabricReplicaId": 131225099453058851,
    "serviceFabricPartitionId": "e400087d-8a08-4dab-bcdd-1f5ce82f374f",
    "serviceFabricApplicationName": "fabric:/Rendering",
    "serviceFabricApplicationTypeName": "RenderingType",
    "serviceFabricNodeName": "_Node_4"
    }

    重新部署时,事件查看器会记录日志

    Windows事件查看器确实在“应用程序和服务日志-> Microsoft-Service Fabric->管理员”下显示了一些值得注意的日志。

    在重新部署应用程序的更新版本时发生了以下日志(请注意,DataBinding.exe是包含我的两个SF actor的EXE的名称):
    Log Name:      Microsoft-ServiceFabric/Admin
    Source: Microsoft-ServiceFabric
    Date: 11/2/2016 2:38:53 PM
    Event ID: 256
    Task Category: Common
    Level: Error
    Keywords: Default
    User: NETWORK SERVICE
    Computer: shayward10.ovx.local
    Description:
    WriteNode failed. HRESULT=-2147467259, Output=CustomOutput
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider Name="Microsoft-ServiceFabric" Guid="{CBD93BC2-71E5-4566-B3A7-595D8EECA6E8}" />
    <EventID>256</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>1</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8000000000000001</Keywords>
    <TimeCreated SystemTime="2016-11-02T18:38:53.678587200Z" />
    <EventRecordID>7620</EventRecordID>
    <Correlation />
    <Execution ProcessID="4440" ThreadID="7360" />
    <Channel>Microsoft-ServiceFabric/Admin</Channel>
    <Computer>shayward10.ovx.local</Computer>
    <Security UserID="S-1-5-20" />
    </System>
    <EventData>
    <Data Name="id">
    </Data>
    <Data Name="type">XmlLiteWriter</Data>
    <Data Name="text">WriteNode failed. HRESULT=-2147467259, Output=CustomOutput</Data>
    </EventData>
    </Event>

    Log Name: Microsoft-ServiceFabric/Admin
    Source: Microsoft-ServiceFabric
    Date: 11/2/2016 2:38:54 PM
    Event ID: 23073
    Task Category: Hosting
    Level: Warning
    Keywords: Default
    User: SYSTEM
    Computer: shayward10.ovx.local
    Description:
    ServiceHostProcess: DataBinding.exe for ApplicationId 805915c7-456c-49d3-af95-62cc44650664 terminated unexpectedly with exit code 3221225786 on node id bf865279ba277deb864a976fbf4c200e
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider Name="Microsoft-ServiceFabric" Guid="{CBD93BC2-71E5-4566-B3A7-595D8EECA6E8}" />
    <EventID>23073</EventID>
    <Version>0</Version>
    <Level>3</Level>
    <Task>90</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8000000000000001</Keywords>
    <TimeCreated SystemTime="2016-11-02T18:38:54.820567800Z" />
    <EventRecordID>7621</EventRecordID>
    <Correlation />
    <Execution ProcessID="6944" ThreadID="3812" />
    <Channel>Microsoft-ServiceFabric/Admin</Channel>
    <Computer>shayward10.ovx.local</Computer>
    <Security UserID="S-1-5-18" />
    </System>
    <EventData>
    <Data Name="id">bf865279ba277deb864a976fbf4c200e</Data>
    <Data Name="AppId">805915c7-456c-49d3-af95-62cc44650664</Data>
    <Data Name="ReturnCode">3221225786</Data>
    <Data Name="ProcessName">DataBinding.exe</Data>
    </EventData>
    </Event>

    Log Name: Microsoft-ServiceFabric/Admin
    Source: Microsoft-ServiceFabric
    Date: 11/2/2016 2:38:56 PM
    Event ID: 256
    Task Category: Common
    Level: Error
    Keywords: Default
    User: NETWORK SERVICE
    Computer: shayward10.ovx.local
    Description:
    WriteNode failed. HRESULT=-2147467259, Output=CustomOutput
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider Name="Microsoft-ServiceFabric" Guid="{CBD93BC2-71E5-4566-B3A7-595D8EECA6E8}" />
    <EventID>256</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>1</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8000000000000001</Keywords>
    <TimeCreated SystemTime="2016-11-02T18:38:56.261857600Z" />
    <EventRecordID>7627</EventRecordID>
    <Correlation />
    <Execution ProcessID="4440" ThreadID="8564" />
    <Channel>Microsoft-ServiceFabric/Admin</Channel>
    <Computer>shayward10.ovx.local</Computer>
    <Security UserID="S-1-5-20" />
    </System>
    <EventData>
    <Data Name="id">
    </Data>
    <Data Name="type">XmlLiteWriter</Data>
    <Data Name="text">WriteNode failed. HRESULT=-2147467259, Output=CustomOutput</Data>
    </EventData>
    </Event>

    事件查看器在超时时记录日志

    服务处于不可访问状态后,尝试调用该服务将在每个请求上生成以下日志(等待5分钟后):
    Log Name:      Microsoft-ServiceFabric/Admin
    Source: Microsoft-ServiceFabric
    Date: 11/2/2016 2:44:55 PM
    Event ID: 44289
    Task Category: FabricTransport
    Level: Warning
    Keywords: Default
    User: NETWORK SERVICE
    Computer: shayward10.ovx.local
    Description:
    Error While Sending Message : FABRIC_E_TIMEOUT
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider Name="Microsoft-ServiceFabric" Guid="{CBD93BC2-71E5-4566-B3A7-595D8EECA6E8}" />
    <EventID>44289</EventID>
    <Version>0</Version>
    <Level>3</Level>
    <Task>173</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8000000000000001</Keywords>
    <TimeCreated SystemTime="2016-11-02T18:44:55.349048200Z" />
    <EventRecordID>7629</EventRecordID>
    <Correlation />
    <Execution ProcessID="18600" ThreadID="8076" />
    <Channel>Microsoft-ServiceFabric/Admin</Channel>
    <Computer>shayward10.ovx.local</Computer>
    <Security UserID="S-1-5-20" />
    </System>
    <EventData>
    <Data Name="id">
    </Data>
    <Data Name="type">ServiceCommunicationClient</Data>
    <Data Name="text">Error While Sending Message : FABRIC_E_TIMEOUT</Data>
    </EventData>
    </Event>

    最佳答案

    在2种情况下可能会发生此问题。

  • 如果您的ActorService方法处理所花费的时间超过了默认超时时间,则需要更改OperationTimeout值。默认情况下是5分钟。如果要更改超时,可以通过在客户端程序集中添加程序集 FabricTransportServiceRemotingProviderAttribute 来更改它。

  • https://msdn.microsoft.com/en-us/library/microsoft.servicefabric.services.remoting.fabrictransport.fabrictransportserviceremotingproviderattribute.aspx
  • 如果不是第一种情况,则可以按照以下缓解方法尝试解决已知错误。
  • 在服务 list 中为ActorService端点指定端口0。默认情况下,ActorEndpoint将列在ServiceManifest中,但端口将不存在。

  • 进行更改后,这就是ActorService的外观。
    <Endpoint Name="Actor1ActorServiceEndpoint" Port="0" />

    我们已意识到问题所在,并且正在解决中。

    关于c# - 升级到SDK 2.3.301后,Service Fabric Actor或服务将变得无法访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40405876/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com