ncnn icon indicating copy to clipboard operation
ncnn copied to clipboard

安卓崩溃问题求助

Open leizh007 opened this issue 1 year ago • 3 comments

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

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

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

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

leizh007 avatar Oct 08 '24 11:10 leizh007

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

nihui avatar Oct 08 '24 11:10 nihui

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 avatar Oct 08 '24 12:10 leizh007

看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

leizh007 avatar Oct 08 '24 12:10 leizh007

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

我看崩溃的时候有个ncnn的错误输出,这个会跟崩溃有关系吗?

12-06 13:51:21.425 12118 13482 W ncnn : FATAL ERROR! unlocked pool allocator get wild 0x6f93c00000

崩溃的时候是发生在内存释放的地方

SIGSEGV(SEGV_MAPERR)
0
#00 pc 00000000000874b0 /apex/com.android.runtime/lib64/bionic/libc.so (je_chp_huge_salloc+24) [arm64-v8a::d1a98b526f2f94260a53c3055979a4f6]
1
#01 pc 000000000008be74 /apex/com.android.runtime/lib64/bionic/libc.so (ifree+340) [arm64-v8a::d1a98b526f2f94260a53c3055979a4f6]
2
#02 pc 000000000008c224 /apex/com.android.runtime/lib64/bionic/libc.so (je_chp_free+112) [arm64-v8a::d1a98b526f2f94260a53c3055979a4f6]
3
#03 pc 000000000035d048 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 000000000035c020 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
5
#05 pc 000000000035c020 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152
6
#06 pc 000000000035c020 ncnn::NetPrivate::forward_layer(int, std::__ndk1::vector<ncnn::Mat, std::__ndk1::allocator<ncnn::Mat> >&, ncnn::Option const&) const+152

leizh007 avatar Dec 06 '24 11:12 leizh007