Skip to content

Deterministic SIGSEGV in Method::execute_instruction via EventTracerProfileOpScope destructor — QNN restore-fails→DLC-fallback path #21804

Description

@ivaylo681-dev

🐛 Describe the bug

Reproduce:
python mobilenet_v2.py --device <device_serial> --soc_model "SM8750" --build_folder /path/to/build-android -d /path/to/imagenet-mini/val
Setup: executorch @ latest main as of 2026-08-07, QAIRT SDK 2.49.0.260730, Android NDK r27c, arm64-v8a. Device: SM8750P.

Output:
[INFO] QnnContextCustomProtocol expected magic number: 0x5678abcd but get: 0x4034b50
[INFO] Deserializing processed data using Dlc
[WARNING] Failed to interpret QNN context binary. Error code 30010. Try verifying binary with online-prepare format.
[INFO] Skip qnn_graph_create, graph has already been composed from Dlc.
Segmentation fault

Reproduces identically with --online_prepare set.
Symbolized backtrace (via lldb-server on-device + host lldb, locally-built non-stripped binary):

Root cause found in source — backends/qualcomm/runtime/backends/QnnGraphCommon.cpp, QnnGraph::Configure():

Qnn_GraphHandle_t graph_handle = nullptr;
// ...
} else if (context_->GetCacheState() == QnnBackendCache::ONLINE_PREPARE) {
QNN_EXECUTORCH_LOG_INFO("Skip qnn_graph_create, graph has already been composed from Dlc.");
// graph_handle is never assigned in this branch
}
// ...
handle_[graph_name] = graph_handle; // stores nullptr when state == ONLINE_PREPARE

In the ONLINE_PREPARE branch, graph_handle stays nullptr and gets stored with no validation. Whatever later consumes it operates on a null/invalid handle — a sufficient, deterministic explanation for the crash.

Versions

Collecting environment information...
PyTorch version: 2.13.0+cpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 11 Pro (10.0.26100 64-bit)
GCC version: Could not collect
Clang version: Could not collect
CMake version: version 3.31.7
Libc version: N/A

Python version: 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.26100-SP0
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
Is XPU available: False
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: False
Caching allocator config: N/A

CPU:
Name: Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
Manufacturer: GenuineIntel
Family: 205
Architecture: 9
ProcessorType: 3
DeviceID: CPU0
CurrentClockSpeed: 2901
MaxClockSpeed: 2901
L2CacheSize: 1536
L2CacheSpeed: None
Revision: None

Versions of relevant libraries:
[pip3] numpy==2.4.6
[pip3] onnx==1.22.0
[pip3] onnxruntime==1.27.0
[pip3] onnxslim==0.1.94
[pip3] optree==0.19.1
[pip3] torch==2.13.0
[pip3] torchvision==0.28.0
[conda] Could not collect

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions