Skip to content

xWebAppPool: 'logEventOnRecyle' causes configuration to return false if the order of your desired events does not match what is written to applicationHost.config #434

@mcbobke

Description

@mcbobke

Details of the scenario you tried and the problem that is occurring

When defining xWebAppPool and setting the logEventOnRecycle property, the order in which each desired event is placed in the string should not matter. However, if this string is written with each item in a different order than will be written to applicationHost.config then the resource will fail on Test-DscConfiguration every time.

For example, setting logEventOnRecycle = 'Time,Memory,PrivateMemory' is fine because that's the order that will show in applicationHost.config, but logEventOnRecycle = 'PrivateMemory,Time,Memory' will fail.

Verbose logs showing the problem

  {"time": "2019-07-30T12:13:58.019-7:00", "type": "verbose", "message": "[HOSTNAME]: LCM:  [ Start  Resource ]  [[xWebAppPool]ProdAppPool]  "},
  {"time": "2019-07-30T12:13:58.019-7:00", "type": "verbose", "message": "[HOSTNAME]: LCM:  [ Start  Test     ]  [[xWebAppPool]ProdAppPool]  "},
  {"time": "2019-07-30T12:13:58.285-7:00", "type": "verbose", "message": "[HOSTNAME]:                            [[xWebAppPool]ProdAppPool] Application pool \"ProdAppPool\" was found."},
  {"time": "2019-07-30T12:13:58.425-7:00", "type": "verbose", "message": "[HOSTNAME]:                            [[xWebAppPool]ProdAppPool] The \"logEventOnRecycle\" property of application pool \"ProdAppPool\" does not match the desired state."},
  {"time": "2019-07-30T12:13:58.472-7:00", "type": "verbose", "message": "[HOSTNAME]:                            [[xWebAppPool]ProdAppPool] The target resource is not in the desired state."},
  {"time": "2019-07-30T12:13:58.472-7:00", "type": "verbose", "message": "[HOSTNAME]: LCM:  [ End    Test     ]  [[xWebAppPool]ProdAppPool] False in 0.4530 seconds."},
  {"time": "2019-07-30T12:13:58.472-7:00", "type": "verbose", "message": "[HOSTNAME]: LCM:  [ End    Resource ]  [[xWebAppPool]ProdAppPool]  "}

Suggested solution to the issue

Make the property value string be order-agnostic and test against each individual event in the sting.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

        xWebAppPool 'ProdAppPool' {
            Name                           = 'Prod'
            Ensure                         = 'Present'
            managedRuntimeVersion          = 'v4.0'
            enable32BitAppOnWin64          = $false
            managedPipelineMode            = 'Integrated'
            queueLength                    = 1000
            startMode                      = 'OnDemand'
            cpuLimit                       = 0
            cpuAction                      = 'NoAction'
            cpuResetInterval               = (New-TimeSpan -Minutes 5).ToString()
            cpuSmpAffinitized              = $false
            logEventOnProcessModel         = 'IdleTimeout'
            Credential                     = $ProdCredential
            identityType                   = 'SpecificUser'
            idleTimeout                    = (New-TimeSpan -Minutes 20).ToString()
            idleTimeoutAction              = 'Terminate'
            loadUserProfile                = $false
            maxProcesses                   = 1
            pingingEnabled                 = $true
            pingResponseTime               = (New-TimeSpan -Seconds 90).ToString()
            pingInterval                   = (New-TimeSpan -Seconds 30).ToString()
            shutdownTimeLimit              = (New-TimeSpan -Seconds 90).ToString()
            startupTimeLimit               = (New-TimeSpan -Seconds 90).ToString()
            orphanWorkerProcess            = $false
            rapidFailProtection            = $true
            rapidFailProtectionInterval    = (New-TimeSpan -Minutes 5).ToString()
            rapidFailProtectionMaxCrashes  = 5
            autoShutdownExe                = ''
            autoShutdownParams             = ''
            disallowOverlappingRotation    = $false
            disallowRotationOnConfigChange = $false
            logEventOnRecycle              = 'PrivateMemory,Time,Memory'
            restartPrivateMemoryLimit      = 0
            restartTimeLimit               = (New-TimeSpan -Minutes 1740).ToString()
            restartRequestsLimit           = 0
            restartSchedule                = @()
            restartMemoryLimit             = 0
        }

The operating system the target node is running

OsName               : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.17763.592
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.592
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

PS C:\Windows\system32> Get-Module -Name xWebAdministration -ListAvailable


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   2.6.0.0    xWebAdministration

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions