This article is contributed. See the original author and article here.

1. SQL SERVER cannot start and reported ‘Failed to allocate pages’. It looks like memory shortage issue. But we are quite sure that the server has enough memory. So we decided to focus on ‘Detected unsupported pre-release version of Windows 7 or Windows Server 2008 R2.‘ Because it looks abnormal. The windows OS is win2016. Why SQL SERVER found it was ‘pre-release version‘ ?

 

2020-07-27 00:01:08.82 Server      Microsoft SQL Server 2016 (SP1-GDR) (KB4458842) – 13.0.4224.16 (X64) 
    Aug 18 2018 09:00:06 
    Copyright (c) Microsoft Corporation
    Standard Edition (64-bit) on Windows Server 2016 Standard 6.3 <X64> (Build 0: ) (Hypervisor)

 

2020-07-27 00:01:08.83 Server      UTC adjustment: -4:00
2020-07-27 00:01:08.83 Server      (c) Microsoft Corporation.
2020-07-27 00:01:08.84 Server      All rights reserved.
2020-07-27 00:01:08.84 Server      Server process ID is 11196.
2020-07-27 00:01:08.84 Server      System Manufacturer: ‘VMware, Inc.’, System Model: ‘VMware Virtual Platform’.
2020-07-27 00:01:08.84 Server      Authentication mode is MIXED.
2020-07-27 00:01:08.84 Server      Logging SQL Server messages in file ‘C:Program FilesMicrosoft SQL ServerMSSQL13.MSSQLSERVERMSSQLLogERRORLOG’.
2020-07-27 00:01:08.84 Server      The service account is ‘Nxxxxxxxxx’. This is an informational message; no user action is required.
2020-07-27 00:01:08.84 Server      Registry startup parameters: 
     -d C:Program FilesMicrosoft SQL ServerMSSQL13.MSSQLSERVERMSSQLDATAmaster.mdf
     -e C:Program FilesMicrosoft SQL ServerMSSQL13.MSSQLSERVERMSSQLLogERRORLOG
     -l C:Program FilesMicrosoft SQL ServerMSSQL13.MSSQLSERVERMSSQLDATAmastlog.ldf
2020-07-27 00:01:08.84 Server      Command Line Startup Parameters:
     -s “MSSQLSERVER”
2020-07-27 00:01:08.86 Server      SQL Server detected 1 sockets with 4 cores per socket and 4 logical processors per socket, 4 total logical processors; using 4 logical processors based on SQL Server licensing. This is an informational message; no user action is required.
2020-07-27 00:01:08.86 Server      SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2020-07-27 00:01:08.86 Server      Detected 12287 MB of RAM. This is an informational message; no user action is required.
2020-07-27 00:01:08.86 Server      Using conventional memory in the memory manager.
2020-07-27 00:01:08.86 Server      Detected unsupported pre-release version of Windows 7 or Windows Server 2008 R2.
2020-07-27 00:01:08.86 Server       Failed allocate pages: FAIL_PAGE_ALLOCATION 2
2020-07-27 00:01:08.86 Server      Error: 17138, Severity: 16, State: 1.
2020-07-27 00:01:08.86 Server      Unable to allocate enough memory to start ‘SQL OS Boot’. Reduce non-essential memory load or increase system memory.
2020-07-27 00:01:08.86 Server      SQL Server shutdown has been initiated

 

2. I searched ‘Detected unsupported pre-release version’ in our source code, and found only  SOS_OS::boot  function can report this error info. SOS_OS::boot calls

SOS_OS::IsWindows7_7065_OrBeyond function. The expected return result of SOS_OS::IsWindows7_7065_OrBeyond is true, but it returned false in our case.

 

3. SOS_OS::IsWindows7_7065_OrBeyond will return true if below 3 clauses are true.

dwMajorVersion == 6 && dwMinorVersion >= 1 && dwBuildNumber >= 7065

 

4. We captured TTT trace. However, TTT trace told us that BuildNumber was 0 in our case. The is the reason SOS_OS::IsWindows7_7065_OrBeyond returned false.

 

Breakpoint 3 hit

Time Travel Position: 20BD3:38

sqldk!SOS_OS::Boot:

00007ffd`b504fc30 57              push    rdi

0:000> knL

# Child-SP          RetAddr           Call Site

00 00000003`665fc5f8 00007ff6`f321ee1b sqldk!SOS_OS::Boot

01 00000003`665fc600 00007ff6`f32188bf sqlservr!sqlservr_main

02 00000003`665fe860 00007ff6`f322fe5e sqlservr!wmain

03 00000003`665ffa90 00007ffd`fc9984d4 sqlservr!__tmainCRTStartup

04 00000003`665ffac0 00007ffd`ff46e871 KERNEL32!BaseThreadInitThunk

05 00000003`665ffaf0 00000000`00000000 ntdll!RtlUserThreadStart

 

0:000> dt sqldk!SOS_OS

  ……

   =00007ffd`b4fd0000 sm_QpcInitializer : SOS_OS::QpcInitializer

   =00007ffd`b5226860 sm_OSVersionInfo : _OSVERSIONINFOEXW

0:000> dx -r1 (*((sqldk!_OSVERSIONINFOEXW *)0x7ffdb5226860))

(*((sqldk!_OSVERSIONINFOEXW *)0x7ffdb5226860))                 [Type: _OSVERSIONINFOEXW]

    [+0x000] dwOSVersionInfoSize : 0x11c [Type: unsigned long]

    [+0x004] dwMajorVersion   : 0x6 [Type: unsigned long] 

    [+0x008] dwMinorVersion   : 0x3 [Type: unsigned long]

    [+0x00c] dwBuildNumber    : 0x0 [Type: unsigned long]

    [+0x010] dwPlatformId     : 0x2 [Type: unsigned long]

 

5. We captured process monitor trace again and finally found that  HKLMSOFTWAREMicrosoftWindows NTCurrentVersionCurrentBuild  key was missing

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.