microsoft / microsoft/onnxruntime

[Bug] C# InferenceSession.RunAsync access violation

Open
#29,633 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api:CSharp
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### Describe the issue

InferenceSession.RunAsync occasionally crashes with access violation 0xc0000005
```
Faulting module name: onnxruntime.dll, version: 1.26.26.508, time stamp: 0x69fdf731
Exception code: 0xc0000005
Fault offset: 0x0000000000092274
```

The issue must be in incorrect pinning of data on C# side. GC is able to move data during the model inference. The PR with the fix is available https://github.com/microsoft/onnxruntime/pull/29391

### To reproduce

Call InferenceSession.RunAsync continuously, it will crash eventually at random moment.

### Urgency

RunAsync is unusable in production

### Platform

Windows

### OS Version

11

### ONNX Runtime Installation

Released Package

### ONNX Runtime Version or Commit ID

1.26

### ONNX Runtime API

C#

### Architecture

X64

### Execution Provider

TensorRT

### Execution Provider Library Version

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the C# InferenceSession.RunAsync entry point and review the proposed fix in pull request #29391, focusing on the reported data-pinning failure. Reproduce continuous RunAsync calls on Windows 11 with ONNX Runtime 1.26 and TensorRT, and verify that the access violation no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.