Skip to content

Windows AppContainer: large ReadFileIntoBuffer chunks can fail with ERROR_NO_SYSTEM_RESOURCES (1450) #29730

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .net codeep:DMLissues related to the DirectML execution providerplatform:windowsissues related to the Windows platformstaleissues that have not been addressed in a while; categorized by a bot

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions