Ejemplo n.º 1
0
        internal void HandleRunAsyncUnexpectedFabricException(IServicePartition partition, FabricException fex)
        {
            ServiceTrace.Source.WriteErrorWithId(
                this.traceType + ApiErrorTraceTypeSuffix,
                this.traceId,
                "RunAsync failed due to an unhandled FabricException causing replica to fault: {0}",
                fex.ToString());

            this.ReportRunAsyncUnexpectedExceptionHealth(partition, fex);
            partition.ReportFault(FaultType.Transient);
        }
        internal void HandleRunAsyncUnexpectedException(IServicePartition partition, Exception ex)
        {
            // ReSharper disable once UseStringInterpolation
            var msg = $"RunAsync failed due to an unhandled exception causing the host process to crash: {ex}";

            ServiceTrace.Source.WriteErrorWithId(this.traceType + ApiErrorTraceTypeSuffix, this.traceId, msg);

            this.ReportRunAsyncUnexpectedExceptionHealth(partition, ex);

            // In LRC test we have observed that sometimes FailFast takes time to write error
            // details to WER and bring down the service host. This causes delays in failover
            // and availibility loss to service.
            //
            // Report fault transient and post FailFast on another thread to unblock ChangeRole.
            // Service host will come down once FailFast completes.
            //
            partition.ReportFault(FaultType.Transient);
            Task.Run(() => Environment.FailFast(msg));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Monitors the current silo, reporting a fault to the specified <paramref name="partition"/> if it faults.
 /// </summary>
 /// <param name="partition">
 /// The partition.
 /// </param>
 private void MonitorSilo(IServicePartition partition)
 {
     this.fabricSilo.Stopped.ContinueWith(
         _ =>
             {
                 if (_.IsFaulted)
                 {
                     partition.ReportFault(FaultType.Transient);
                     this.stopped.TrySetException(
                         _.Exception ?? new Exception(typeof(OrleansFabricSilo).Name + " faulted."));
                 }
                 else if (_.IsCanceled)
                 {
                     this.stopped.TrySetCanceled();
                 }
                 else if (_.IsCompleted)
                 {
                     this.stopped.TrySetResult(0);
                 }
             }, 
         TaskContinuationOptions.ExecuteSynchronously);
 }