VirtualMemory: 'value out of range' error when sizes > 1/8th of the disk
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 32/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- powershell
調査の方向性
VirtualMemory リソースの Set-PageFileSetting エントリポイントから開始し、InitialSize 4096、MaximumSize 7000 の、提供された 8 GB の D: ドライブ構成を使用して問題を再現します。CIM の失敗とレジストリベースの回避策を比較し、既存の PagingFiles エントリが保持されることも確認します。ディスク容量の 8 分の 1 を超える有効なページファイル設定が、他のドライブの設定を失うことなく適用されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Details of the scenario you tried and the problem that is occurring
I'm trying to utilize Azure VM temp disks for the pagefile but due to their small size (typically 2x RAM) and a limitation in Set-CimInstance (and similar methods), it's not possible to create anything of much use (e.g. only 1Gb on an 8Gb temp drive).
For example, splitting out the offending command in Set-PageFileSetting against an 8Gb drive with sufficient free space:
$Drive = 'D:'
$InitialSize = 4096
$MaximumSize = 7000
$setParams = @{
Namespace = 'root\cimv2'
Query = "Select * from Win32_PageFileSetting where SettingID='pagefile.sys @ $Drive'"
Property = @{
InitialSize = $InitialSize
MaximumSize = $MaximumSize
}
}
Set-CimInstance @setParams
Throws the following error:
Verbose logs showing the problem
Set-CimInstance : Value out of range
At line:1 char:5
+ Set-CimInstance @setParams
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Win32_PageFileS...\pagefile.sys"):CimInstance) [Set-CimInstance], CimException
+ FullyQualifiedErrorId : HRESULT 0x8004102b,Microsoft.Management.Infrastructure.CimCmdlets.SetCimInstanceCommand
Suggested solution to the issue
All the CIM-based solutions seem to have a base class that is the underlying issue. To work around it, the only solution I've found is to directly set the registry key:
<#
.SYNOPSIS
Sets a new page file name.
.PARAMETER Drive
The letter of the drive containing the page file
to change the settings of.
.PARAMETER InitialSize
The initial size to set the page file to.
.PARAMETER MaximumSize
The maximum size to set the page file to.
#>
function Set-PageFileSetting
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[System.String]
$Drive,
[Parameter()]
[System.Int64]
$InitialSize = 0,
[Parameter()]
[System.Int64]
$MaximumSize = 0
)
# Using Set-CimInstance fails if pagefile exceeds 1/8th of the available disk space so we're switching to using direct registry key settings.
$pageFileName = Join-Path `
-Path $driveInfo.Name `
-ChildPath 'pagefile.sys'
$value = "$pageFileName $InitialSize $MaximumSize`n" # Even though it's a Reg_SZ_Multi, it's not double-null terminated
# TODO: Fix to support other drive values
Set-ItemProperty `
-LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management' `
-Name 'PagingFiles' `
-Type MultiString `
-Value $value `
-Force
}
Write-Verbose -Message ($script:localizedData.SettingPageFileSettingsMessage -f $Drive, $InitialSize, $MaximumSize)
}
The above is incomplete as it does not account for any other / pre-existing settings on another drive but that shouldn't be too hard to work out given the simple data structure of the registry key.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
Using a system with a D: drive that is 8Gb in size:
VirtualMemory "pagefile"
{
Type = 'CustomSize'
Drive = 'D'
InitialSize = 4096
MaximumSize = 7000
}
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.1971
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1971
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)
8.4.0
- 主要言語
- PowerShell
- スター
- 338
- フォーク
- 80
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dsccommunity/ComputerManagementDsc のほかの issue
-
chore
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
chore
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
-
chore
難易度 4/5 3〜5日 初心者へのやさしさ 64/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
dsccommunity/ComputerManagementDsc の issue をすべて見る
似ている issue
-
area: tests perceived difficulty: 2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Nitjsefnie-Harness-Commons/daedalus#1255 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
siderolabs/terraform-provider-talos#414 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
agent/quality hive/hosted-available-lke648397-260827-5n31 quality testing
難易度 2/5 1〜3時間 初心者へのやさしさ 91/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
scaleway/helm-charts#61 ·