luojilab / DataReporter

Real-time data reporting system based on mobile platform
MIT License
111 stars 46 forks source link

解码时造成的crash #8

Closed liuzitong123a closed 3 years ago

liuzitong123a commented 4 years ago

Binder:21540_1(21589)

SIGSEGV(SEGV_MAPERR)

00 pc 0005f48c /apex/com.android.runtime/lib/bionic/libc.so (__memcpy_base_a55+180) [armeabi-v7a]

01 pc 000a81d7 /apex/com.android.runtime/lib/bionic/libc.so (fread_unlocked+102) [armeabi-v7a]

02 pc 000a813f /apex/com.android.runtime/lib/bionic/libc.so (fread+38) [armeabi-v7a]

03 pc 0002b3fc libdata-reporter.so DecodeData (/Users/lzt/Downloads/DataReporter-master/src/core/base/MiniPBCoder.cpp:193) [armeabi-v7a]

04 pc 0002ae9c libdata-reporter.so DecodeItem (/Users/lzt/Downloads/DataReporter-master/src/core/base/MiniPBCoder.cpp:31) [armeabi-v7a]

05 pc 0003cc5c libdata-reporter.so ReadData (/Users/lzt/Downloads/DataReporter-master/src/core/reporter/FileInputStream.cpp:68) [armeabi-v7a]

06 pc 00030c2c libdata-reporter.so ReadFromFile (/Users/lzt/Downloads/DataReporter-master/src/core/reporter/DataProvider.cpp:114) [armeabi-v7a]

07 pc 0002f398 libdata-reporter.so ReadData (/Users/lzt/Downloads/DataReporter-master/src/core/reporter/DataProvider.cpp:58) [armeabi-v7a]

08 pc 0003f238 libdata-reporter.so Report (/Users/lzt/Downloads/DataReporter-master/src/core/reporter/Reporter.cpp:203) [armeabi-v7a]

09 pc 0004a750 libdata-reporter.so call<std::ndk1::bind<void (future::Reporter::)(), future::Reporter > &> (/Users/lzt/android-ndk-r16b/sources/cxx-stl/llvm-libc++/include/functional:2227 [Inline: mu<future::Reporter *, std::__ndk1::tuple<> >]) [armeabi-v7a]

10 pc 0004a4a8 libdata-reporter.so operator() (/Users/lzt/android-ndk-r16b/sources/cxx-stl/llvm-libc++/include/functional:1562) [armeabi-v7a]

11 pc 0005740c libdata-reporter.so operator() (/Users/lzt/android-ndk-r16b/sources/cxx-stl/llvm-libc++/include/functional:1924) [armeabi-v7a]

12 pc 00058194 libdata-reporter.so operator() (/Users/lzt/Downloads/DataReporter-master/src/core/reporter/Reporter.cpp:424) [armeabi-v7a]

13 pc 00058138 libdata-reporter.so call<(lambda at /Users/lzt/Downloads/DataReporter-master/src/core/reporter/Reporter.cpp:422:26) &> (/Users/lzt/android-ndk-r16b/sources/cxx-stl/llvm-libc++/include/functional_base:349 [Inline: forward<(lambda at /Users/lzt/Downloads/DataReporter-master/src/core/reporter/Reporter.cpp:422:26) &>]) [armeabi-v7a]

14 pc 00057eec libdata-reporter.so operator() (/Users/lzt/android-ndk-r16b/sources/cxx-stl/llvm-libc++/include/functional:1562) [armeabi-v7a]

15 pc 0005740c libdata-reporter.so operator() (/Users/lzt/android-ndk-r16b/sources/cxx-stl/llvm-libc++/include/functional:1924) [armeabi-v7a]

16 pc 000624f4 libdata-reporter.so run (/Users/lzt/Downloads/DataReporter-master/src/core/thread/HandlerThread.cpp:89) [armeabi-v7a]

17 pc 00064ee8 libdata-reporter.so call<std::ndk1::bind<void (WTF::HandlerThread::)(), WTF::HandlerThread > &> (/Users/lzt/android-ndk-r16b/sources/cxx-stl/llvm-libc++/include/functional:2227 [Inline: mu<WTF::HandlerThread *, std::__ndk1::tuple<> >]) [armeabi-v7a]

18 pc 00064c60 libdata-reporter.so operator() (/Users/lzt/android-ndk-r16b/sources/cxx-stl/llvm-libc++/include/functional:1562) [armeabi-v7a]

19 pc 0005740c libdata-reporter.so operator() (/Users/lzt/android-ndk-r16b/sources/cxx-stl/llvm-libc++/include/functional:1924) [armeabi-v7a]

20 pc 00065060 libdata-reporter.so thread_proxy<std::ndk1::tuple<std::ndk1::unique_ptr<std::ndk1::thread_struct, std::__ndk1::default_delete<std::ndk1::thread_struct> >, std::ndk1::function<void ()> > > (/Users/lzt/android-ndk-r16b/sources/cxx-stl/llvm-libc++/include/thread:352 [Inline: thread_execute<std::ndk1::unique_ptr<std::ndk1::thread_struct, std::ndk1::default_delete >, std::ndk1::function<void ()>>]) [armeabi-v7a]

21 pc 000ac4dd /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20) [armeabi-v7a]

22 pc 00062989 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) [armeabi-v7a]

liuzitong123a commented 4 years ago

目前看来编码写入了异常数据造成的现象,出现crash后必须要清除缓存数据

pengjiangithub commented 4 years ago

if (out.data_len != 0) { Buffer data(out.data_len); read_len = fread(data.GetBegin(), 1, data.Length(), fp); }

Buffer::Buffer(size_t length) : m_Ptr(nullptr), m_Size(length), m_IsNoCopy(BufferCopy) { if (m_Size > 0) { m_Ptr = malloc(m_Size); } }

看代码,应该是 out.data_len<0时,空指针了。

lixiaoyu0123 commented 4 years ago

麻烦升级最新版本1.4.2, 另外请确认 Application中不存在多进程多次初始化问题,多进程多次使用相同参数初始化,是会出现问题。