-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash with bus error on Android (arm-v7a) when creating InferenceSession with SSD model #4103
Comments
Could you try building with |
Looks like building with
addr2line for NDK v19 build gives something like this:
Output for NDK v21 is similar:
UPD: ndk-stack gave me something:
|
It looks like something is going wrong inserting into a vector where a new allocation is required to grow the vector, but it's not clear what code is trying to do the insert as the stack has no info on that. Can this be reproduced in an emulator or is an ARM device needed? Some info on running that here: https://github.com/microsoft/onnxruntime/blob/master/docs/Android_testing.md. Possibly need to specify the RAM size to match the device it fails on using the '-memory' parameter. You'd have to rebuild ORT targeting the host device though. Or alternatively can you run the program in GDB and see if a more complete stack can be obtained? https://source.android.com/devices/tech/debug/gdb |
I think that this issue can't be reproduced in an emulator because the x86 platform is not affected by memory alignment issues, so I skipped this step for now.
I tried to track the issue manually and found the function which causes the problem:
Function:
Lines:
We are receiving SIGBUS in targetShape.insert() because bytes.c_str() pointer must be aligned to int64_t size (I tried to use memalign() to check my idea and succeeded). Also I found similar issue in TypeAndShapeInferenceFunction() for Slice operator (checked on different model file) which uses ParseData() from https://github.com/onnx/onnx/blob/master/onnx/defs/tensor_proto_util.cc:
These lines also cause SIGBUS. Hope it helps (should I create issue in ONNX repo for these cases?). |
Thanks for the detailed info! If you could create an issue on the ONNX repo that would be awesome as the problem needs to be fixed there. Out of interest what did your change to use memalign involve? Also curious as to why it's only a Release build that fails. |
I've just opened the issue in ONNX repo: onnx/onnx#2813
I created char * storage aligned to sizeof(int64_t) and copied data from bytes.c_str() using memcpy() |
This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details. |
This issue has been automatically closed due to inactivity. Please reactivate if further support is needed. |
Describe the bug
Application linked with release build of libonnxruntime.so crashes due to SIGBUS. Logcat output:
Urgency
None.
System information
To Reproduce
Code to reproduce:
This is how I build libonnxruntime.so:
https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/ssd
Expected behavior
InferenceSession is created without errors.
Screenshots
Not applicable.
Additional context
Debug build works fine.
Other models with NMS layers are affected too.
The text was updated successfully, but these errors were encountered: