private AssistantTaskContext ProcessMailboxUnderPoisonControl(AssistantTaskContext context, EmergencyKit kit)
        {
            AIException          exception   = null;
            AssistantTaskContext nextContext = null;

            try
            {
                base.CatchMeIfYouCan(delegate
                {
                    AdminRpcMailboxData adminRpcMailboxData = context.MailboxData as AdminRpcMailboxData;
                    if (adminRpcMailboxData != null)
                    {
                        nextContext = this.ProcessAdminRpcMailboxUnderPoisonControl(context, kit);
                        return;
                    }
                    StoreMailboxData storeMailboxData = context.MailboxData as StoreMailboxData;
                    if (storeMailboxData != null)
                    {
                        nextContext = this.ProcessStoreMailboxUnderPoisonControl(context, kit);
                    }
                }, this.Assistant.NonLocalizedName);
            }
            catch (AIException ex)
            {
                this.LogAIException(context.MailboxData, ex);
                exception = ex;
            }
            this.PostProcessMailbox(exception, nextContext, context.MailboxData);
            return(nextContext);
        }
示例#2
0
        public bool ReportResult(AIException exception)
        {
            bool flag = true;

            ExTraceGlobals.GovernorTracer.TraceDebug <Governor, AIException>((long)this.GetHashCode(), "{0}: ReportResult: {1}", this, exception);
            AITransientException ex = null;

            if (exception is AITransientException && this.IsFailureRelevant((AITransientException)exception))
            {
                ex = (AITransientException)exception;
                ExTraceGlobals.GovernorTracer.TraceDebug <Governor>((long)this.GetHashCode(), "{0}: Exception is relevant", this);
            }
            lock (this)
            {
                switch (this.status)
                {
                case GovernorStatus.Running:
                    if (ex != null)
                    {
                        this.numberConsecutiveFailures = 0U;
                        this.lastRunTime = DateTime.UtcNow;
                        this.ReportFailure(ex);
                        flag = false;
                    }
                    break;

                case GovernorStatus.Retry:
                    if (ex == null)
                    {
                        this.LogRecovery(exception);
                        this.EnterRun();
                    }
                    else if (ex.RetrySchedule.FinalAction != FinalAction.RetryForever && this.lastRunTime + ex.RetrySchedule.TimeToGiveUp <= DateTime.UtcNow)
                    {
                        this.numberConsecutiveFailures += 1U;
                        this.LogGiveUp(exception);
                        this.EnterRun();
                    }
                    else
                    {
                        this.ReportFailure(ex);
                        flag = false;
                    }
                    break;

                case GovernorStatus.Failure:
                    if (ex != null)
                    {
                        flag = false;
                        this.LogFailure(GovernorStatus.Failure, ex);
                    }
                    break;
                }
            }
            if (this.parentGovernor != null)
            {
                flag &= this.parentGovernor.ReportResult(exception);
            }
            return(flag);
        }
 // Token: 0x06000270 RID: 624 RVA: 0x0000DBB8 File Offset: 0x0000BDB8
 protected override void OnCompletedItem(InterestingEvent interestingEvent, AIException exception)
 {
     base.OnCompletedItem(interestingEvent, exception);
     if (this.IsInRetry && !this.IsMailboxDead)
     {
         ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: Recovering from retry state, mapiEvent {1}", this, interestingEvent.MapiEvent.EventCounter);
         this.recoveryEventCounter = interestingEvent.MapiEvent.EventCounter + 1L;
         this.ControllerPrivate.RequestRecovery(this);
     }
 }
 internal void LogAIException(MailboxData mailbox, AIException e)
 {
     ExTraceGlobals.TimeBasedDatabaseJobTracer.TraceError <TimeBasedDatabaseJob, string, AIException>((long)this.GetHashCode(), "{0}: Exception on mailbox {1}: {2}", this, (mailbox == null) ? "No Mailbox Present" : mailbox.DisplayName, e);
     base.LogEvent(AssistantsEventLogConstants.Tuple_TimeBasedAssistantFailed, null, new object[]
     {
         this.Assistant.Name,
         (mailbox == null) ? "No Mailbox Present" : mailbox.MailboxGuid.ToString(),
         e
     });
     AssistantsLog.LogErrorProcessingMailboxEvent(this.Assistant.NonLocalizedName, mailbox, e, this.DatabaseInfo.DatabaseName, this.StartTime.ToString("O"), (this is TimeBasedDatabaseWindowJob) ? MailboxSlaRequestType.Scheduled : MailboxSlaRequestType.OnDemand);
 }
 private void FinalizeMailboxProcessing(MailboxData mailbox, AIException e)
 {
     if (e != null)
     {
         lock (this.skippedMailboxesLock)
         {
             this.skippedMailboxes.Add(mailbox);
         }
         Interlocked.Increment(ref this.mailboxesProcessedFailureCount);
         return;
     }
     Interlocked.Increment(ref this.mailboxesProcessedSuccessfullyCount);
 }
 // Token: 0x0600024B RID: 587 RVA: 0x0000C81C File Offset: 0x0000AA1C
 protected override void OnCompletedItem(InterestingEvent interestingEvent, AIException exception)
 {
     this.Assistant.PerformanceCounters.EventsProcessed.Increment();
     this.Assistant.PerformanceCounters.EventsInQueueCurrent.Decrement();
     if (this.CountEvents)
     {
         this.controller.DecrementEventQueueCount();
     }
     if (exception != null)
     {
         this.NotifySkippedEvent(interestingEvent.MapiEvent, exception);
     }
 }
示例#7
0
		// Token: 0x06000479 RID: 1145 RVA: 0x000182C4 File Offset: 0x000164C4
		private static void TraceAndThrow(CatchMe function, AIException aiException, string nonLocalizedAssistantName)
		{
			if (aiException != null)
			{
				Util.Tracer.TraceError((long)function.GetHashCode(), "CatchMeIfYouCan: Assistant:{0}, {1} on target {2} with exception: {3}", new object[]
				{
					nonLocalizedAssistantName,
					function.Method,
					function.Target,
					aiException
				});
				aiException.Data["AssistantName"] = nonLocalizedAssistantName;
				throw aiException;
			}
		}
        // Token: 0x0600026F RID: 623 RVA: 0x0000DA84 File Offset: 0x0000BC84
        protected override AIException DangerousProcessItem(EmergencyKit kit, InterestingEvent interestingEvent)
        {
            ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: Dequeued event {1}", this, interestingEvent.MapiEvent.EventCounter);
            long        lastEventCounter = 0L;
            AIException ex = null;

            try
            {
                base.CatchMeIfYouCan(delegate
                {
                    try
                    {
                        this.DispatchOneEvent(kit, interestingEvent);
                    }
                    catch (DeadMailboxException ex3)
                    {
                        ExTraceGlobals.EventDispatcherTracer.TraceError <EventDispatcherPrivate, DeadMailboxException>((long)this.GetHashCode(), "{0}: Encountered DeadMailboxException #1: {1}", this, ex3);
                        lastEventCounter = this.ControllerPrivate.GetLastEventCounter();
                        ExTraceGlobals.EventDispatcherTracer.TraceError((long)this.GetHashCode(), "{0}: Read lastEventCounter {1} after DeadMailboxExcetion.  Retrying eventDispatch {2}.  Previous exception: {3}", new object[]
                        {
                            this,
                            lastEventCounter,
                            interestingEvent.MapiEvent.EventCounter,
                            ex3
                        });
                        this.DispatchOneEvent(kit, interestingEvent);
                        ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: DispatchOneEvent returned successfully for mapiEvent {1}", this, interestingEvent.MapiEvent.EventCounter);
                    }
                }, (base.Assistant != null) ? base.Assistant.Name : "<null>");
            }
            catch (AIException ex2)
            {
                ExTraceGlobals.EventDispatcherTracer.TraceError <EventDispatcherPrivate, AIException>((long)this.GetHashCode(), "{0}: Exception from DispatchOneEvent: {1}", this, ex2);
                ex = ex2;
            }
            if (ex is DeadMailboxException)
            {
                ExTraceGlobals.EventDispatcherTracer.TraceError((long)this.GetHashCode(), "{0}: Encountered DeadMailboxException #2.  mapiEvent: {1}, lastEventCounter: {2}, exception: {3}", new object[]
                {
                    this,
                    interestingEvent.MapiEvent.EventCounter,
                    lastEventCounter,
                    ex
                });
                this.SetAsDeadMailbox(interestingEvent.MapiEvent.EventCounter, lastEventCounter);
            }
            return(ex);
        }
示例#9
0
        // Token: 0x0600023C RID: 572 RVA: 0x0000C5D0 File Offset: 0x0000A7D0
        private void ProcessOneItem()
        {
            bool flag = false;
            T    t    = this.pendingQueue[0];

            this.pendingQueue.RemoveAt(0);
            this.activeQueue.Add(t);
            ExTraceGlobals.QueueProcessorTracer.TraceDebug <QueueProcessor <T>, T>((long)this.GetHashCode(), "{0}: ProcessOneItem releasing lock for item: {1}", this, t);
            Monitor.Exit(this.Locker);
            try
            {
                AIException ex = this.ProcessItem(t);
                ExTraceGlobals.QueueProcessorTracer.TraceDebug <QueueProcessor <T>, T, AIException>((long)this.GetHashCode(), "{0}: Item: {1}, Result: {2}", this, t, ex);
                flag = this.governor.ReportResult(ex);
                if (flag)
                {
                    ExTraceGlobals.QueueProcessorTracer.TraceDebug <QueueProcessor <T>, T, AIException>((long)this.GetHashCode(), "{0}: OpComplete, Item: {1}, Result: {2}", this, t, ex);
                    this.OnCompletedItem(t, ex);
                    if (QueueProcessor <T> .syncWithTestCodeAfterOnCompletedItem != null)
                    {
                        QueueProcessor <T> .syncWithTestCodeAfterOnCompletedItem();
                    }
                }
                else
                {
                    ExTraceGlobals.QueueProcessorTracer.TraceDebug <QueueProcessor <T>, T, AIException>((long)this.GetHashCode(), "{0}: WillRetry, Item: {1}, Result: {2}", this, t, ex);
                    if (QueueProcessor <T> .syncWithTestCodeBeforeOnTransientFailure != null)
                    {
                        QueueProcessor <T> .syncWithTestCodeBeforeOnTransientFailure();
                    }
                    this.OnTransientFailure(t, ex);
                }
            }
            finally
            {
                Monitor.Enter(this.Locker);
                ExTraceGlobals.QueueProcessorTracer.TraceDebug <QueueProcessor <T>, T>((long)this.GetHashCode(), "{0}: ProcessOneItem reacquire lock for item: {1}", this, t);
                this.activeQueue.Remove(t);
                if (!flag)
                {
                    ExTraceGlobals.QueueProcessorTracer.TraceDebug <QueueProcessor <T>, T>((long)this.GetHashCode(), "{0}: Requeing item for retry: {1}", this, t);
                    this.pendingQueue.Insert(0, t);
                    this.QueueWorkersIfNecessary();
                }
            }
        }
示例#10
0
 private void LogGiveUp(AIException exception)
 {
     ExTraceGlobals.GovernorTracer.TraceDebug((long)this.GetHashCode(), "{0}: Retry->Running. Giving up after {1} attempts in timespan {2}. Exception: {3}", new object[]
     {
         this,
         this.numberConsecutiveFailures,
         DateTime.UtcNow - this.lastRunTime,
         exception
     });
     base.LogEvent(AssistantsEventLogConstants.Tuple_GovernorGiveUp, null, new object[]
     {
         this,
         this.numberConsecutiveFailures,
         DateTime.UtcNow - this.lastRunTime,
         exception
     });
 }
示例#11
0
        // Token: 0x06000280 RID: 640 RVA: 0x0000E4FC File Offset: 0x0000C6FC
        protected override AIException DangerousProcessItem(EmergencyKit kit, InterestingEvent interestingEvent)
        {
            AIException result = null;

            try
            {
                base.CatchMeIfYouCan(delegate
                {
                    this.HandleEvent(kit, interestingEvent, null, null);
                }, (base.Assistant != null) ? base.Assistant.Name : "<null>");
            }
            catch (AIException ex)
            {
                ExTraceGlobals.EventDispatcherTracer.TraceError <EventDispatcherPublic, AIException>((long)this.GetHashCode(), "{0}: Exception from HandleEvent: {1}", this, ex);
                result = ex;
            }
            return(result);
        }
 private void PostProcessMailbox(AIException exception, AssistantTaskContext nextContext, MailboxData mailbox)
 {
     lock (this.instanceLock)
     {
         bool flag2 = this.Driver.Governor.ReportResult(exception);
         if (flag2)
         {
             if (nextContext == null)
             {
                 this.FinalizeMailboxProcessing(mailbox, exception);
             }
         }
         else
         {
             this.AddForRetry(mailbox);
         }
     }
 }
示例#13
0
		// Token: 0x06000478 RID: 1144 RVA: 0x00018280 File Offset: 0x00016480
		public static void CoreCatchMeIfYouCan(CatchMe function, string nonLocalizedAssistantName)
		{
			AIException aiException = null;
			GrayException.MapAndReportGrayExceptions(delegate()
			{
				try
				{
					Util.Tracer.TraceDebug<MethodInfo, object>((long)function.GetHashCode(), "CatchMeIfYouCan: calling {0} on target {1}...", function.Method, function.Target);
					function();
					Util.Tracer.TraceDebug<MethodInfo, object>((long)function.GetHashCode(), "CatchMeIfYouCan: {0} on target {1} without exception", function.Method, function.Target);
				}
				catch (AIException aiException)
				{
					AIException aiException = aiException;
				}
				catch (AccessDeniedException innerException)
				{
					AIException aiException = new SkipException(innerException);
				}
				catch (TenantAccessBlockedException innerException2)
				{
					AIException aiException = new SkipException(innerException2);
				}
				catch (AccountDisabledException innerException3)
				{
					AIException aiException = new DisconnectedMailboxException(innerException3);
				}
				catch (MailboxInTransitException innerException4)
				{
					AIException aiException = new AIMailboxInTransitException(innerException4);
				}
				catch (WrongServerException innerException5)
				{
					AIException aiException = new DeadMailboxException(innerException5);
				}
				catch (ConnectionFailedPermanentException innerException6)
				{
					AIException aiException = new TransientMailboxException(innerException6);
				}
				catch (ConnectionFailedTransientException innerException7)
				{
					AIException aiException = new DatabaseIneptException(innerException7);
				}
				catch (DataSourceTransientException innerException8)
				{
					AIException aiException = new ServerIneptException(innerException8);
				}
				catch (MailboxUnavailableException innerException9)
				{
					AIException aiException = new AIMailboxUnavailableException(innerException9);
				}
				catch (MapiExceptionAmbiguousAlias innerException10)
				{
					AIException aiException = new AmbiguousAliasMailboxException(innerException10);
				}
				catch (MapiExceptionJetErrorReadVerifyFailure innerException11)
				{
					AIException aiException = new DatabaseIneptException(innerException11);
				}
				catch (MapiExceptionMdbOffline innerException12)
				{
					AIException aiException = new DatabaseIneptException(innerException12);
				}
				catch (MapiExceptionDatabaseError innerException13)
				{
					AIException aiException = new DatabaseIneptException(innerException13);
				}
				catch (MapiExceptionNotEnoughMemory innerException14)
				{
					AIException aiException = new ServerIneptException(innerException14);
				}
				catch (MapiExceptionJetErrorLogDiskFull innerException15)
				{
					AIException aiException = new DatabaseIneptException(innerException15);
				}
				catch (MapiExceptionJetErrorInstanceUnavailableDueToFatalLogDiskFull innerException16)
				{
					AIException aiException = new DatabaseIneptException(innerException16);
				}
				catch (QuotaExceededException innerException17)
				{
					AIException aiException = new MailboxIneptException(innerException17);
				}
				catch (ResourcesException innerException18)
				{
					AIException aiException = new ServerIneptException(innerException18);
				}
				catch (ServerPausedException innerException19)
				{
					AIException aiException = new TransientMailboxException(innerException19);
				}
				catch (VirusScanInProgressException innerException20)
				{
					AIException aiException = new MailboxIneptException(innerException20);
				}
				catch (MapiExceptionJetErrorIndexNotFound innerException21)
				{
					AIException aiException = new DatabaseIneptException(innerException21);
				}
				catch (MapiExceptionJetErrorFileNotFound innerException22)
				{
					AIException aiException = new MapiTransientException(innerException22);
				}
				catch (MapiExceptionRpcServerTooBusy innerException23)
				{
					AIException aiException = new DatabaseIneptException(innerException23);
				}
				catch (TransientException innerException24)
				{
					AIException aiException = new TransientMailboxException(innerException24);
				}
				catch (VirusDetectedException innerException25)
				{
					AIException aiException = new SkipException(innerException25);
				}
				catch (CannotResolveExternalDirectoryOrganizationIdException innerException26)
				{
					AIException aiException = new SkipException(innerException26);
				}
				catch (DataSourceOperationException innerException27)
				{
					AIException aiException = new ServerIneptException(innerException27);
				}
				catch (MapiExceptionNotFound innerException28)
				{
					AIException aiException = new DatabaseIneptException(innerException28);
				}
				catch (ConfigurationErrorsException innerException29)
				{
					AIException aiException = new AppConfigurationErrorsException(innerException29);
				}
				catch (StoragePermanentException ex)
				{
					if (ex.InnerException is MapiExceptionJetErrorFileNotFound || ex.InnerException is MapiExceptionJetErrorInvalidSesid || ex.InnerException is MapiExceptionJetErrorReadVerifyFailure || ex.InnerException is MapiExceptionJetErrorKeyDuplicate || ex.InnerException is MapiExceptionCallFailed || ex.InnerException is MapiExceptionJetErrorLogDiskFull || ex.InnerException is MapiExceptionDuplicateObject || ex.InnerException is MapiExceptionMailboxSoftDeleted || ex.InnerException is MapiExceptionUnknownMailbox || ex.InnerException is MapiExceptionInvalidParameter)
					{
						AIException aiException = new MapiTransientException(ex);
					}
					else if (ex.InnerException is DataSourceTransientException || ex.InnerException is DataSourceOperationException || ex.InnerException is DataValidationException)
					{
						AIException aiException = new ServerIneptException(ex);
					}
					else if (ex.InnerException is MapiExceptionAmbiguousAlias)
					{
						AIException aiException = new AmbiguousAliasMailboxException(ex);
					}
					else if (ex is ObjectNotFoundException && ex.InnerException is MapiExceptionNotFound)
					{
						AIException aiException = new TransientMailboxException(ex);
					}
					else if (ex.InnerException is MapiExceptionDatabaseError)
					{
						AIException aiException = new DatabaseIneptException(ex);
					}
					else
					{
						if (!(ex is FolderSaveException) || !(ex.InnerException is MailboxUnavailableException))
						{
							throw;
						}
						AIException aiException = new AIMailboxUnavailableException(ex);
					}
				}
			});
			Util.TraceAndThrow(function, aiException, nonLocalizedAssistantName);
		}
示例#14
0
 // Token: 0x06000235 RID: 565 RVA: 0x0000C311 File Offset: 0x0000A511
 protected virtual void OnTransientFailure(T item, AIException exception)
 {
 }
示例#15
0
 // Token: 0x06000234 RID: 564 RVA: 0x0000C30F File Offset: 0x0000A50F
 protected virtual void OnCompletedItem(T item, AIException exception)
 {
 }
 // Token: 0x06000271 RID: 625 RVA: 0x0000DC20 File Offset: 0x0000BE20
 protected override void OnTransientFailure(InterestingEvent interestingEvent, AIException exception)
 {
     if (exception is TransientMailboxException)
     {
         ExTraceGlobals.EventDispatcherTracer.TraceError <EventDispatcherPrivate, long, AIException>((long)this.GetHashCode(), "{0}: retryable mailbox exception, mapiEvent {1}: {2}", this, interestingEvent.MapiEvent.EventCounter, exception);
         lock (base.Locker)
         {
             this.ClearPendingQueue();
             if (!this.IsInRetry)
             {
                 if (this.IsMailboxDead && ExTraceGlobals.EventDispatcherTracer.IsTraceEnabled(TraceType.DebugTrace))
                 {
                     ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate>((long)this.GetHashCode(), "{0}: Mailbox had been on TransientFailure, but was found dead", this);
                 }
                 this.isInRetry = true;
                 base.Controller.DecrementEventQueueCount();
                 base.Assistant.PerformanceCounters.FailedDispatchers.Increment();
                 if (EventDispatcherPrivate.syncWithTestCodeAfterEventQueueCountDecrementedForRetry != null)
                 {
                     EventDispatcherPrivate.syncWithTestCodeAfterEventQueueCountDecrementedForRetry();
                 }
             }
         }
     }
 }