32-bit application cannot query performance "Server Work Queues" counters on Windows Server 2008 R2-based computer that has more than 32 processors


Symptoms


When you use a 32-bit application to query the performance "Server Work Queues" counter on a Windows Server 2008 R2-based computer that has more than 32 processors, you may notice that many events are reported in the Windows Application log that resemble the following:

Log Name:      Application
Source:        Microsoft-Windows-PerfNet
Date:          <Date> <Time>
Event ID:      2006
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      <ComputerName>
Description:
Unable to read Server Queue performance data from the Server service. The first four bytes (DWORD) of the Data section contains the status code, the second four bytes contains the IOSB.Status and the next four bytes contains the IOSB.Information.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Microsoft-Windows-PerfNet" Guid="{CAB2B8A5-49B9-4EEC-B1B0-FAC21DA05A3B}" EventSourceName="PerfNet" />
    <EventID Qualifiers="49152">2006</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="<Date><Time>" />
    <EventRecordID>3884</EventRecordID>
    <Correlation />
    <Execution ProcessID="0" ThreadID="0" />
    <Channel>Application</Channel>
    <Computer><ComputerName></Computer>
    <Security />
  </System>
  <EventData>
    <Binary>230000C00000000078E44F00</Binary>
  </EventData>
</Event>

Cause


This issue occurs because the performance "Server Work Queues" counter provider PerfNet.dll used the NtQuerySystemInformation function in order to determine the number of processors that are available for the computer. 32-bit Windows supports a maximum of 32 processors. The NtQuerySystemInformation function's WOW64 implementation supports a maximum of 32 processors also. If more than 32 processors are available, the Microsoft-Windows-PerfNet event is logged every time a 32-bit application queries the performance "Server Work Queues" counters.

Resolution


To work around this issue, use one of the following methods:

1. Upgrade the 32-bit application to 64-bit if available.
2. If the 32-bit application queries the performance "Server Work Queues" counters using WMI, please specifically requests the 64-bit WMI providers. The More Information section below shows a code sample for how to do this.

More Information


This sample Visual Basic Script specifically requests the 64-bit WMI provider irrespective of whether it is a 32-bit or 64-bit application:

Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
objCtx.Add "__ProviderArchitecture", 64
objCtx.Add "__RequiredArchitecture", TRUE

Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objCimv2 = objLocator.ConnectServer(".", "root\cimv2","","",,,,objCtx)