How to ‘solve’ host instance state ‘Stop pending’

By jpsmit
June 2, 2015
0

Every now and then you run into this, like I did today. It’s the issue when you try to stop or restart the host instance but it hangs in the ‘Stop pending’ state. Nothing seems help, you cannot do anything in the BizTalk management console nor in the Windows Services console.
Integration MVP Sandro Pereira blogged about this some time ago.

His blog post mentions some solutions, but my favorite one is just kill the process and start again. This option is mentioned, but how to figure out which process to kill? They all look alike in the Task Manager. In Windows Server 2012 and up the processes in the Task Manager can be expanded so the actual name is displayed. This makes it easy to kill the correct process. However in Windows Server 2008 this isn’t the case, and this posts can help you.

The first step is determine which process id is causing the trouble. You can find this piece of PowerShell also in a post from Sandro. For completeness sake I’ll show it here:

$machineName= hostname
$query= "root\MicrosoftBizTalkServer", "Select * from MSBTS_HostInstance where HostType = 1 and ServiceState = 4 and RunningServer = '$machineName'"
$hostInstanceSearch= new-objectsystem.management.managementObjectsearcher($query)
$hostInstanceList= $hostInstanceSearch.get()
foreach($hostInstanceItemin$hostInstanceList)
{
$processName= $hostInstanceItem.HostName
$perfCounter= New-ObjectSystem.Diagnostics.PerformanceCounter("BizTalk:Messaging", "ID Process", $processName)
$processID= $perfCounter.NextValue()
Write-Host
Write-Host"HostName: "-foregroundcoloryellow-NoNewLine
Write-Host$hostInstanceItem.HostName-foregroundcolorwhite
Write-Host"Process Id: "-foregroundcoloryellow-NoNewLine
Write-Host$processID-foregroundcolorwhite
Write-Host
}

The output of this script will be like this:

PowerShell

However I found that this list is sometimes not complete. The problem-host-instance is missing, so we now know which aren’t the problem. With the next command run from a command window you can get all BizTalk host instance process on your machine:

tasklist /FI “IMAGENAME eq btsntsvc.exe”

The output is like this:

TaskList

In this particular example there is no difference between the two because I can enforce the ‘Stop pending’ problem. However you can compare the two outputs now and see which PID is missing and thus causing the problems.

Finally use this command from a command window to kill the process:

taskkill /PID 4160

Comments: 0

Leave a Reply

Your email address will not be published. Required fields are marked *