Community support for Analyzers (Intel VTune™ Profiler, Intel Advisor, Intel Inspector)
4921 Discussions

Failed to get a thread handle when attaching to the process due to OS error (Access is denied. )


I run into the following problem when try to collect data:

Collection failed

    7/6/2017 3:28:51 PM  Collection failed. The data cannot be displayed. 
    Failed to get a thread handle when attaching to the process due to OS error (Access is denied.
). Data for the thread will not be collected.

The OS: Windows 10.

Target application: MSSQL2014 (sqlservr.exe) and it is Log On as "Network Service", Session 0.

I try to use "Attach to Process" & Basic Hotspots.



0 Kudos
1 Reply

Hi Michael,

I suppose that this process is protected from some access rights required for user-mode profiling. In this case I can suggest to use "advanced-hotspots" as a workaround or. to try to come around the basic-hotspots issue. I assume it can be done in the following ways:

1. to decrease protection for a running process if you can control this.

2. to try an instruction for attachment to system processes got from "Troubleshooting" section of Amplifier's help:

Attachment as Administrator to a process that launched by the 'System' user fails (200259643)

You may use a utility from to profile a system service (for example, w3wp.exe-based code) from the command line using amplxe-cl.exe that is located in <product_install_dir>/bin32. Do the following:

  1. Configure the w3wp service to run with the permissions you use to log in: Open IIS Manager, right-click an application pool you are using and set “Process model:Identity” to the account under which w3wp needs to be run.

  2. Run the w3wp service and make sure you run it with proper credentials and remember its PID.

  3. Start data collection:

    psexec -i 0 /path/to/amplxe-cl.exe -c=hotspots -r /path/for/your/data_dir --target-pid=PID

  4. Run your workload.

  5. Stop data collection:

    psexec -i 0 /path/to/amplxe-cl.exe -command detach -r /path/for/your/data_dir

  6. Open /path/for/your/data_dir in GUI:

    <product_install_dir>/bin32/amplxe-gui /path/to/your/data_dir


0 Kudos