Tencent / ncnn

ncnn is a high-performance neural network inference framework optimized for the mobile platform
Other
20.56k stars 4.18k forks source link

安卓崩溃问题求助 #5723

Closed leizh007 closed 1 week ago

leizh007 commented 1 month ago

error log | 日志或报错信息 | ログ

context | 编译/运行环境 | バックグラウンド

how to reproduce | 复现步骤 | 再現方法

1. 2. 3.

more | 其他 | その他

线上bugly上报的崩溃栈,不是必现的,本地暂时没有复现,单线程中调用,有什么规避思路吗?感谢

SIGSEGV(SEGV_MAPERR)
0
#00 pc 0000000000057680 /apex/com.android.runtime/lib64/bionic/libc.so (je_huge_salloc+20) [arm64-v8a::b91c775ccc9b0556e91bc575a2511cd0]
1
#01 pc 000000000005c000 /apex/com.android.runtime/lib64/bionic/libc.so (ifree+316) [arm64-v8a::b91c775ccc9b0556e91bc575a2511cd0]
2
#02 pc 000000000005c480 /apex/com.android.runtime/lib64/bionic/libc.so (je_free+120) [arm64-v8a::b91c775ccc9b0556e91bc575a2511cd0]
3
#03 pc 0000000000358444 ncnn::NetPrivate::do_forward_layer(ncnn::Layer const*, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+1932
4
#04 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
5
#05 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
6
#06 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
7
#07 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
8
#08 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
9
#09 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
10
#10 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
11
#11 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
12
#12 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
13
#13 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
14
#14 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
15
#15 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
16
#16 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
17
#17 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
18
#18 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
19
#19 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
20
#20 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
21
#21 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
22
#22 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
23
#23 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
24
#24 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
25
#25 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
26
#26 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
27
#27 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
28
#28 pc 000000000035e88c ncnn::Extractor::extract(int, ncnn::Mat&, int)+412
nihui commented 1 month ago

backtrace 上看很像是内存不足导致

leizh007 commented 1 month ago

backtrace 上看很像是内存不足导致

感谢,还有些不一样的栈

SIGABRT
0
#00 pc 000000000007da34 /apex/com.android.runtime/lib64/bionic/libc.so (abort+168) [arm64-v8a::e9653d1f6c173c6b86b171a5be6af6eb]
1
#01 pc 0000000000064a64 /apex/com.android.runtime/lib64/bionic/libc.so (ifree+592) [arm64-v8a::e9653d1f6c173c6b86b171a5be6af6eb]
2
#02 pc 0000000000064ce4 /apex/com.android.runtime/lib64/bionic/libc.so (je_free+112) [arm64-v8a::e9653d1f6c173c6b86b171a5be6af6eb]
3
#03 pc 0000000000358b6c ncnn::NetPrivate::do_forward_layer(ncnn::Layer const*, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+3764
4
#04 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
5
#05 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
6
#06 pc 0000000000357b44 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152

看着都是从je_free进去的,是内存释放的时候崩溃的吧?

leizh007 commented 1 month ago

看bugly上报的现场数据,内存是够的

网络APN Wi-Fi
是否ROOT
可用内存大小 5.17 GB ( 46.52% )
总内存大小 11.12 GB
可用存储空间 154.63 GB ( 68.35% )
可用SD卡大小 154.63 GB ( 68.35% )
JVM最大内存 512 MB
JVM已分配内存 110.54 MB
JavaHeap 101.03 MB
PSS 755 MB
VSS 31.03 GB

Bugly SDK版本号4.3.2.9