Scanner discovery gets stuck when scan is almost complete

Scanner discovery gets stuck when scan is almost complete

166
Created On 11/10/26 11:01 AM - Last Modified 11/10/26 16:12 PM


Symptom


An Accounts Feed Discovery scan gets stuck when the scan is almost complete. In the PVWA Accounts Feed Discovery Management, the scan will have a state of "Running" with 100% complete or 99% complete but will never actually complete. 

When the scanner service is restarted it continues with the next scheduled scan.

 

In the CACPMScanner.log there will be many lines like the following:

23/03/2020 04:20:28.055 | tid=8  | user=CACPMScanner  | TasksRunner | UpdateActiveTasks | Active tasks: 1 | Running: 1 | Stopping: 0

 

 

 

 



Environment


Privileged Access Manager (PAM, self-hosted) Discovery and Accounts Feed

Accounts Feed Discovery Scanner



Cause


The scanner has one or more tasks stuck while trying to scan a machine, which is a problem that prevents the machine scan from completing.

 

The task is forever waiting for an answer from this machine, so the scan never completes.

 



Resolution


For some issues with WMI, setting the parameter <add key="DistributedWMI" value="yes"/> in the CACPMScanner.exe.config file solves the problem. This parameter works from version 10.2 and up. After setting the parameter restart the Scanner service.

If the scan still gets stuck even with DistributedWMI set to yes, then we can attempt to lower the timeout value under the parameter MachineScanTimeoutInMinutes to the lowest accepted value which is currently 30.

Please add the parameter MachineScanTimeoutInMinutes=30 (you may need to kill the Idira Scanner process on the CPM to clear this if the Stop button does not work) 

Steps are listed below:

1. Open “C:\Program Files (x86)\CyberArk\Password Manager\Scanner\CACPMScanner.exe.config”

2. Locate <add key="DistributedWMITimeoutInSeconds" value="600" /> and under it on the next line, please add the following: <add key="MachineScanTimeoutInMinutes" value="30" />

Example below:

<add key="DistributedWMITimeoutInSeconds" value="600" />
<add key="MachineScanTimeoutInMinutes" value="30" />

3. Restart the Idira Central Policy Manager Scanner service


However, for other issues this does not help, and the scan can still get stuck.

If the scan still gets stuck even with DistributedWMI set to yes and MachineScanTimeoutInMinutes=30, then the only solution is to fix or remove the machine that the scan is stuck on.

The following PowerShell script can help to find the machine that is causing the problem:

 

#Analyze CACPMScanner log for threads started/stopped

cls

$path = "C:\Program Files (x86)\CyberArk\Password Manager\Logs\CACPMScanner.log"

$pattern = "ScannerThreadPool \| InsertToQueue \| (.*?) \| Start|ScannerThreadPool \| EndThread \| (.*?) \| End"

$threads = @{}

Select-String -Path $path -Pattern $pattern |

ForEach-Object {

  If ($_ -match "Start") {

    $threads[$_.Matches.Groups[1].value] = [pscustomobject]@{ScanTarget = $_.Matches.Groups[1].value; Start = $true; End = $false}

  } Else {

    ($threads[$_.Matches.Groups[2].Value]).End = $true

  }

}

$threads.Values | Where-Object {$_.End -eq $false} | FT -AutoSize

 

To use the script, first, create a clean capture of the Accounts Discovery that hangs by clearing the CACPMScanner.log and thereby reproducing the issue. This way, only the stuck Accounts Discovery scan is captured in the log.

 

Once you have collected the CACPMScanner.log, run it against the above script. Update the "$path" variable in the script to point to the path of the CACPMScanner.log you wish to analyze.

 

The script is looking for machines that the scanner started scanning but never finished. These are the machine scans that never completed running and are hanging the process.

The results of the script will look similar to the following:

ScanTarget             Start  End

----------             -----  ---

SV101.domain.org True False

 

Using these results, you can then check the Machine Scan log for the machine/s listed to confirm that the scan did not finish and where it was stuck.

 

 

Sub-Issue: Resolving Scheduled Tasks Hang on MachineScan

If a machine is hung on the Scheduled Tasks part of the scan, the log will display entries near the end of the file similar to the following:

Example log excerpt from a machine log (e.g., DNA_WINSERVER1.acme.corp.log):

11/25/2024 7:58:50 PM [396][5] - .ctor - Scheduled Tasks - Started  
11/25/2024 7:58:50 PM [396][5] - startImpersonatedContext - DNAPR072I Impersonate account using domain user 'CyberArkScanUser' in domain 'WINSERVER1.acme.corp'.  
11/25/2024 7:58:50 PM [396][5] - startImpersonatedContext - DNAPR126I LogonUser successful, context handle: 2324. Impersonating...  
11/25/2024 7:58:52 PM [396][5] - InnerScan - DNAPR125I Connected to remote machine WINSERVER1.acme.corp's task scheduler service. Supported tasks API version on the remote machine: 1.6 (10006)

To resolve this issue, follow the steps below:

  1. Log on to the CPM/Component server (preferably as an admin or with a user account that can edit files).

  2. Open the CACPMScanner.exe.config file located at:

    C:\Program Files (x86)\CyberArk\Password Manager\Scanner\
    
  3. Modify the configuration file:
    • Under the following key:

      <add key="DistributedWMITimeoutInSeconds" value="600" />
    • Add the following key to the configuration:

      <add key="WindowsCommandExecutionTimeoutInSeconds" value="300" />

      Important Notes:

      • DistributedScansTimeoutInSeconds:
        • Description: The maximum time (in seconds) that DNA will wait for a distributed scan to execute. This parameter overrides the following parameters and must be configured in correlation with their values:
          • SSHCommandExecutionTimeoutInSeconds: For best practices, DistributedScansTimeoutInSeconds should be at least 10 times higher than SSHCommandExecutionTimeoutInSeconds.
          • WindowsCommandExecutionTimeoutInSeconds: For best practices, DistributedScansTimeoutInSeconds should be at least 300 seconds higher than WindowsCommandExecutionTimeoutInSeconds.
        • Acceptable Value: Numeric (in seconds)
        • Default Value: 1800 seconds (30 minutes)
  4. Restart the Idira Central Policy Manager Scanner service to apply the changes.

  5. Attempt to reproduce the issue. If necessary, you can tweak the values to achieve the desired result.

 



Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1hj0000001eTICAY&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail