Describe the issue
On Windows UWP / Xbox AppContainer, loading ONNX models with large external data (.onnx.data) via WindowsEnv::ReadFileIntoBuffer can fail intermittently with:
ReadFile … fail, errcode = 1450 - ERROR_NO_SYSTEM_RESOURCES
This was observed on Xbox Series S Dev Mode with ORT DirectML 1.24.4 when reading a ~1.86 GB external-data blob (e.g. large un-quantized embed_tokens.weight inside the external file). The failure is intermittent under memory pressure; reducing the per-ReadFile chunk size eliminated it (6/6 clean restarts).
Related path work
AppContainer path canonicalization for external data was addressed on main in #28509 (GetWeaklyCanonicalPath + NT-volume fallback). That fix is not in the 1.24.4 NuGet pin many consumers still use. Independently of path validation, the 1 GB read chunk remains a problem under AppContainer commit-charge limits (mmap fallback is not available via non-FromApp APIs in this sandbox).
Suggested change
In onnxruntime/core/platform/windows/env.cc (WindowsEnv::ReadFileIntoBuffer):
// current (main and 1.24.4)
constexpr DWORD k_max_bytes_to_read = 1 << 30; // 1 GB
// proposed (or a more conservative constant, e.g. 16–64 MB)
constexpr DWORD k_max_bytes_to_read = 1 << 24; // 16 MB
Semantic: smaller successive ReadFile calls lock fewer pages in the MDL for each transfer and stay within AppContainer resources. Desktop behavior should be unchanged aside from more loop iterations.
Validation
- Platform: Xbox Series S, UWP AppContainer, ORT DirectML 1.24.4
- Model: int4 ONNX with ~1.86 GB external data
- Before: intermittent errcode 1450 on
ReadFile model.onnx.data
- After 16 MB chunks: load + generate, 6/6 restarts, 0× 1450
Happy to open a PR against main if this direction is acceptable to maintainers.
Urgency
Low for desktop; blocking for AppContainer / Xbox-class sandboxes that cannot use full mmap and hit large external tensors.
Describe the issue
On Windows UWP / Xbox AppContainer, loading ONNX models with large external data (
.onnx.data) viaWindowsEnv::ReadFileIntoBuffercan fail intermittently with:This was observed on Xbox Series S Dev Mode with ORT DirectML 1.24.4 when reading a ~1.86 GB external-data blob (e.g. large un-quantized
embed_tokens.weightinside the external file). The failure is intermittent under memory pressure; reducing the per-ReadFilechunk size eliminated it (6/6 clean restarts).Related path work
AppContainer path canonicalization for external data was addressed on
mainin #28509 (GetWeaklyCanonicalPath+ NT-volume fallback). That fix is not in the 1.24.4 NuGet pin many consumers still use. Independently of path validation, the 1 GB read chunk remains a problem under AppContainer commit-charge limits (mmap fallback is not available via non-FromAppAPIs in this sandbox).Suggested change
In
onnxruntime/core/platform/windows/env.cc(WindowsEnv::ReadFileIntoBuffer):Semantic: smaller successive
ReadFilecalls lock fewer pages in the MDL for each transfer and stay within AppContainer resources. Desktop behavior should be unchanged aside from more loop iterations.Validation
ReadFile model.onnx.dataHappy to open a PR against
mainif this direction is acceptable to maintainers.Urgency
Low for desktop; blocking for AppContainer / Xbox-class sandboxes that cannot use full mmap and hit large external tensors.