private void ProcessCrashed(object sender, ActivityHostCrashedEventArgs e)
        {
            // the process crashed, we need to not use it anymore
            ActivityHostProcess process = sender as ActivityHostProcess;

            Debug.Assert(process != null, "ActivityHostProcess did not raise event correctly");
            Debug.Assert(process.Busy, "When ProcessCrashed is raised busy should not be reset");
            process.MarkForRemoval = true;

            if (e.FailureOnSetup)
            {
                // the request needs to be processed again
                _failedRequests.Enqueue(e.Invoker);
                PerfCountersMgr.UpdateCounterByValue(
                    PSWorkflowPerformanceCounterSetInfo.CounterSetId,
                    PSWorkflowPerformanceCounterIds.ActivityHostMgrFailedRequestsPerSec);
                PerfCountersMgr.UpdateCounterByValue(
                    PSWorkflowPerformanceCounterSetInfo.CounterSetId,
                    PSWorkflowPerformanceCounterIds.ActivityHostMgrFailedRequestsQueueLength);
            }

            // Below call is added to fix the race condition:
            // When OOP host process is crashed, ProcessCrashed() method sets the process as MarkForRemoval, context switch happened at this time
            // and another process has finished and started the servicing thread, which checks the above process as MarkForRemoval and disposes it.
            // ProcessFinished event handler is unregistered from the process and ActivityHostProcess.HandleTransportError will not be able to raise
            // process finished event, resulting inconsistent _busyHost count.
            //
            DecrementHostCountAndStartThreads();
        }
 private void HandleTransportError(PSRemotingTransportException transportException, bool onSetup)
 {
     this._tracer.TraceException(transportException);
     if (this.ProcessCrashed != null)
     {
         ActivityHostCrashedEventArgs activityHostCrashedEventArg = new ActivityHostCrashedEventArgs();
         activityHostCrashedEventArg.FailureOnSetup = onSetup;
         activityHostCrashedEventArg.Invoker        = this._currentInvoker;
         ActivityHostCrashedEventArgs activityHostCrashedEventArg1 = activityHostCrashedEventArg;
         this.ProcessCrashed(this, activityHostCrashedEventArg1);
     }
 }
Exemple #3
0
        private void ProcessCrashed(object sender, ActivityHostCrashedEventArgs e)
        {
            ActivityHostProcess activityHostProcess = sender as ActivityHostProcess;

            activityHostProcess.MarkForRemoval = true;
            if (e.FailureOnSetup)
            {
                this._failedRequests.Enqueue(e.Invoker);
                PSOutOfProcessActivityController.PerfCountersMgr.UpdateCounterByValue(PSWorkflowPerformanceCounterSetInfo.CounterSetId, 17, (long)1, true);
                PSOutOfProcessActivityController.PerfCountersMgr.UpdateCounterByValue(PSWorkflowPerformanceCounterSetInfo.CounterSetId, 18, (long)1, true);
            }
            this.DecrementHostCountAndStartThreads();
        }
        /// <summary>
        /// Handles a transport error since it is most likely that
        /// the process crash
        /// </summary>
        /// <param name="transportException">the transport exception
        /// that was raised</param>
        /// <param name="onSetup">true indicates that the crash was
        /// encountered when setting up the process and not when the
        /// command was run</param>
        private void HandleTransportError(PSRemotingTransportException transportException, bool onSetup)
        {
            _tracer.TraceException(transportException);

            if (ProcessCrashed != null)
            {
                ActivityHostCrashedEventArgs eventArgs = new ActivityHostCrashedEventArgs
                {
                    FailureOnSetup = onSetup,
                    Invoker        = _currentInvoker
                };
                ProcessCrashed(this, eventArgs);
            }
        }
        private void ProcessCrashed(object sender, ActivityHostCrashedEventArgs e)
        {
            // the process crashed, we need to not use it anymore
            ActivityHostProcess process = sender as ActivityHostProcess;
            Debug.Assert(process != null, "ActivityHostProcess did not raise event correctly");
            Debug.Assert(process.Busy, "When ProcessCrashed is raised busy should not be reset");
            process.MarkForRemoval = true;                

            if (e.FailureOnSetup)
            {
                // the request needs to be processed again
                _failedRequests.Enqueue(e.Invoker);
                PerfCountersMgr.UpdateCounterByValue(
                    PSWorkflowPerformanceCounterSetInfo.CounterSetId,
                    PSWorkflowPerformanceCounterIds.ActivityHostMgrFailedRequestsPerSec);
                PerfCountersMgr.UpdateCounterByValue(
                    PSWorkflowPerformanceCounterSetInfo.CounterSetId,
                    PSWorkflowPerformanceCounterIds.ActivityHostMgrFailedRequestsQueueLength);
            }

            // Below call is added to fix the race condition:
            // When OOP host process is crashed, ProcessCrashed() method sets the process as MarkForRemoval, context switch happened at this time
            // and another process has finished and started the servicing thread, which checks the above process as MarkForRemoval and disposes it. 
            // ProcessFinished event handler is unregistered from the process and ActivityHostProcess.HandleTransportError will not be able to raise
            // process finished event, resulting inconsistent _busyHost count.
            //
            DecrementHostCountAndStartThreads();
        }
        /// <summary>
        /// Handles a transport error since it is most likely that
        /// the process crash
        /// </summary>
        /// <param name="transportException">the transport exception
        /// that was raised</param>
        /// <param name="onSetup">true indicates that the crash was
        /// encountered when setting up the process and not when the
        /// command was run</param>
        private void HandleTransportError(PSRemotingTransportException transportException, bool onSetup)
        {
            _tracer.TraceException(transportException);

            if (ProcessCrashed != null)
            {
                ActivityHostCrashedEventArgs eventArgs = new ActivityHostCrashedEventArgs
                                                         {FailureOnSetup = onSetup, 
                                                          Invoker = _currentInvoker};
                ProcessCrashed(this, eventArgs);
            }
        }
		private void ProcessCrashed(object sender, ActivityHostCrashedEventArgs e)
		{
			ActivityHostProcess activityHostProcess = sender as ActivityHostProcess;
			activityHostProcess.MarkForRemoval = true;
			if (e.FailureOnSetup)
			{
				this._failedRequests.Enqueue(e.Invoker);
				PSOutOfProcessActivityController.PerfCountersMgr.UpdateCounterByValue(PSWorkflowPerformanceCounterSetInfo.CounterSetId, 17, (long)1, true);
				PSOutOfProcessActivityController.PerfCountersMgr.UpdateCounterByValue(PSWorkflowPerformanceCounterSetInfo.CounterSetId, 18, (long)1, true);
			}
			this.DecrementHostCountAndStartThreads();
		}
Exemple #8
0
		private void HandleTransportError(PSRemotingTransportException transportException, bool onSetup)
		{
			this._tracer.TraceException(transportException);
			if (this.ProcessCrashed != null)
			{
				ActivityHostCrashedEventArgs activityHostCrashedEventArg = new ActivityHostCrashedEventArgs();
				activityHostCrashedEventArg.FailureOnSetup = onSetup;
				activityHostCrashedEventArg.Invoker = this._currentInvoker;
				ActivityHostCrashedEventArgs activityHostCrashedEventArg1 = activityHostCrashedEventArg;
				this.ProcessCrashed(this, activityHostCrashedEventArg1);
			}
		}