GithubHelp home page GithubHelp logo

meitu / mthawkeye Goto Github PK

View Code? Open in Web Editor NEW
1.5K 39.0 186.0 20.5 MB

Profiling / Debugging assist tools for iOS. (Memory Leak, OOM, ANR, Hard Stalling, Network, OpenGL, Time Profile ...)

License: MIT License

C++ 2.49% Objective-C++ 10.28% Ruby 0.99% Objective-C 84.41% C 1.50% Python 0.01% Shell 0.32%
ios debugging profiling assistant tool performance-analysis autotesting performance-monitoring memory-leak-detection time-profile

mthawkeye's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mthawkeye's Issues

ANR Trace crash

Describe the bug
为了测试ANR 在点击事件中做了100w次循环 然后crash了

Log

*** Assertion failure in -[MTHawkeyeStorage syncStoreValue:withKey:inCollection:], /Pods/MTHawkeye/MTHawkeye/Core/MTHawkeyeStorage.m:123
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'line lenght should less than 16KB'
*** First throw call stack:
(
0 CoreFoundation 0x00000001158626fb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000113ab9ac5 objc_exception_throw + 48
2 CoreFoundation 0x0000000115862482 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000113507927 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 MTHawkeye 0x0000000110b661d1 -[MTHawkeyeStorage syncStoreValue:withKey:inCollection:] + 993
5 MTHawkeye 0x0000000110b65d23 __57-[MTHawkeyeStorage asyncStoreValue:withKey:inCollection:]_block_invoke + 51
6 libdispatch.dylib 0x0000000117d82d7f _dispatch_call_block_and_release + 12
7 libdispatch.dylib 0x0000000117d83db5 _dispatch_client_callout + 8
8 libdispatch.dylib 0x0000000117d8b225 _dispatch_lane_serial_drain + 778
9 libdispatch.dylib 0x0000000117d8be9c _dispatch_lane_invoke + 425
10 libdispatch.dylib 0x0000000117d95ea3 _dispatch_workloop_worker_thread + 733
11 libsystem_pthread.dylib 0x0000000118231611 _pthread_wqthread + 421
12 libsystem_pthread.dylib 0x00000001182313fd start_wqthread + 13
)
To Reproduce

点击事件中做了100w次循环

Environment (please complete the following information):

  • Device: iphone6s模拟器
  • OS: 12.2
  • Xcode Version: 10.2.1

Additional context
用的是swift4

UI 线程崩溃

MTHANRDetectThread.m 中:

 BOOL isStalling = ((now - curRunloopStartFrom) >= self.stallingThresholdInSeconds);
        if (isStalling) {
            if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
                [self processBackgroundStillRunningWithSnapshots:self.stallingSnapshots];
            }

在子线程中访问 UI!!!

在使用过程中关闭性能检测crash

Describe the bug
在使用过程中,调用stop方法,停止检测时crash
To Reproduce
Steps to reproduce the behavior:

  1. 程序正常启动,并开启性能检测
  2. 在使用过程中调用stop方法停止检测
  3. 程序crash ,以下是调用堆栈信息
    2019-04-28 17:32:53.221379+0800 StarMaker[564:102528] dynamic_cast error 2: One or more of the following type_info's has hidden visibility. They should all have public visibility. N10__cxxabiv116__shim_type_infoE, id, N10__cxxabiv117__pbase_type_infoE.
    2019-04-28 17:32:53.221538+0800 StarMaker[564:102528] dynamic_cast error 2: One or more of the following type_info's has hidden visibility. They should all have public visibility. N10__cxxabiv116__shim_type_infoE, id, N10__cxxabiv117__pbase_type_infoE.
    2019-04-28 17:32:53.221894+0800 StarMaker[564:102528] [Bugly][Info] Handle the crash scene in callback
    2019-04-28 17:32:53.253270+0800 StarMaker[564:103034] [Bugly][Info] MemoryMonitorThread is canceled
    2019-04-28 17:32:53.346582+0800 StarMaker[564:102528] [Bugly] Trapped uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <MTHawkeyeUIClient 0x1c40f7980> for the key path "window" from <GUL_AppDelegate-7CC4C951-CAEF-4111-A255-CD1A9498CA5F 0x1c40963a0> because it is not registered as an observer.'
    (
    0 CoreFoundation 0x0000000181fd2da4 + 252
    1 libobjc.A.dylib 0x000000018118c5ec objc_exception_throw + 56
    2 CoreFoundation 0x0000000181fd2c6c + 0
    3 Foundation 0x000000018296e10c + 496
    4 Foundation 0x000000018296dbfc + 92
    5 StarMaker 0x0000000102e10120 hook_Objc_msgSend + 136
    6 libdispatch.dylib 0x000000010ab011dc _dispatch_call_block_and_release + 24
    7 libdispatch.dylib 0x000000010ab0119c _dispatch_client_callout + 16
    8 libdispatch.dylib 0x000000010ab05d2c _dispatch_main_queue_callback_4CF + 1180
    9 CoreFoundation 0x0000000181f7b070 + 12
    10 CoreFoundation 0x0000000181f78bc8 + 2272
    11 CoreFoundation 0x0000000181e98da8 CFRunLoopRunSpecific + 552
    12 GraphicsServices 0x0000000183e7d020 GSEventRunModal + 100
    13 UIKit 0x000000018beb5758 UIApplicationMain + 236
    14 StarMaker 0x0000000100c384d8 main + 124
    15 libdyld.dylib 0x0000000181929fc0 + 4
    )
    Screenshots
    image

Environment (please complete the following information):

  • Device: 6sp
  • OS: 11.4
  • Xcode Version: 10.2.1

Ability to use MTHawkeye on jailbroken phones without app modifications

Is your feature request related to a problem? Please describe.
When reviewing iOS apps with the FLEX bar, there are limitations to the Network Monitoring functionality. i.e. Not able to export all captured traffic, no persistence if the app crashes, no detailed filter like MTHawkeye.

Describe the solution you'd like
I would like MTHawkeye releases to include a .deb file, to be released in github and idelally also a Cydia repo. The goal would be to be able to use MTHawkeye functionality while performing security audits of mobile apps. For this purpose, MTHawkeye could be a standalone tweak or be somehow integrated into the FLEX bar.

Describe alternatives you've considered
The FLEX bar is currently insufficient for this as described in the problem description above.

Additional context
MTHawkeye seems great for situation where developers manually add this to their apps, it would be great to be able to use MTHawkeye at runtime to audit any app without having the source code, i.e. at runtime using the FLEX bar or similar.

请问为什么pod后使用OneLine start没有内置Graphics(0.12版本)

这是Pod的内容

pod 'MTHawkeye', :configurations => 'Debug'

pod 'FLEX', :configurations => ['Debug']
pod 'FBRetainCycleDetector', :configurations => ['Debug']
pod 'fishhook', :configurations => ['Debug']

pod 'CocoaLumberjack', :configurations => ['Debug'] # CocoaLumberjack is optional, change to MTHawkeye/DefaultPluginsWithoutLog if don't need.

pod 'MTGLDebug', :configurations => ['Debug'] # MTGLDebug is exclude by default, change MTHawkeye to MTHawkeye/DefaultPlugins to include.
pod 'MTAppenderFile', :configurations => ['Debug']

安装你的pod库时出现以下提示

Describe the bug
安装该库时出现以下提示:
[!] Smart quotes were detected and ignored in your Podfile. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.
请确认下podspec文件中是否有不规范的字符

Environment (please complete the following information):

  • pod Version: 1.5.0
  • Xcode Version: 10.2.1

工程接入AFNetworking,同时使用AFURLSessionManager得到NSURLSessionDownloadTask,在iOS8下面会unrecognized selector崩溃

Describe the bug
工程接入AFNetworking,同时使用NSURLSessionDownloadTask,在iOS8下面会崩溃

Log
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFLocalDownloadTask _hawkeye_swizzle_e8dba47d_resume]: unrecognized selector sent to instance 0x103c0440'

Last Exception Backtrace:
0 CoreFoundation 0x28634f87 0x2852d000 + 1081223
1 libobjc.A.dylib 0x35c57c77 0x35c51000 + 27767
2 CoreFoundation 0x2863a37d 0x2852d000 + 1102717
3 CoreFoundation 0x28638259 0x2852d000 + 1094233
4 CoreFoundation 0x28569d68 0x2852d000 + 249192
5 MTHawkeye 0x054c81cb __54+[MTHNetworkObserver injectIntoNSURLSessionTaskResume]_block_invoke_2 (MTHNetworkObserver.m:256)
6 MTHawkeye 0x054c81cb __54+[MTHNetworkObserver injectIntoNSURLSessionTaskResume]_block_invoke_2 (MTHNetworkObserver.m:256)
7 MTHawkeye 0x054c81cb __54+[MTHNetworkObserver injectIntoNSURLSessionTaskResume]_block_invoke_2 (MTHNetworkObserver.m:256)
8 ThirdBase 0x059077d9 -[_AFURLSessionTaskSwizzling af_resume] (AFURLSessionManager.m:456)

Additional context
使用[AFURLSessionManager downloadTaskWithRequest:progress:destination:completionHandler]得到NSURLSessionDownloadTask,这是个类簇,实际得到__NSCFLocalDownloadTask,调用resume的时候崩溃 。

继承关系如下:
iOS8:__NSCFLocalDownloadTask -> __NSCFLocalSessionTask -> NSURLSessionTask;
iOS8以上:__NSCFLocalDownloadTask -> __NSCFLocalSessionTask -> __NSCFURLSessionTask-> NSURLSessionTask;

在MTHNetworkObserver中(大概240行左右),通过NSURLSessionDownloadTask拿到的是__NSCFLocalDataTask(继承关系和__NSCFLocalDownloadTask同一个层级 )。你们处理了iOS8以上的直接用__NSCFURLSessionTask及更底层的NSURLSessionTask进行方法交换. iOS8及已下没处理。

Question
1.是否特意这样处理(用硬编码的方式进行处理)。如果是的话,修改方法:在iOS的情况下,currnetClass = NSStringFromString("__NSCFLocalSessionTask")
2.是否想hook对应的resume方法,插入对应的MT框架的代码,如果是的话可以尝试AFURLSessionManager的方式。(我看了代码AFURLSessionManager的代码,和你们的处理逻辑相仿,但是不明白为什么写到后面的方法交换没有用AF那套逻辑,我试了改写代码用AFNetworking这套逻辑是可以正常工作的)

很多地方可能有错误,请指正。

从pods上安装后无法运行项目

无论是真机还是模拟器模拟器
都会报Undefined symbols错误
Undefined symbols for architecture arm64: "_OBJC_CLASS_$_MTRunHawkeyeInOneLine", referenced from: objc-class-ref in AppDelegate.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

0.12.8卡主线程

Describe the bug
A clear and concise description of what the bug is.

Log
There are two ways to get the running log of MTHawkeye:
A: Filter the Xcode Console log, they are start with [hawkeye]
B: Under the com.meitu.hawkeye folder in sandbox, the log was store as log.mtlog & log.mmap2

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • Device: iPhone 13Mini
  • OS:iOS 16.5.1
  • Xcode Version:15.0.1

Additional context
Add any other context about the problem here.

真机崩

iPhone8,iOS 13.3.1 真机启动Demo直接崩溃....

网络模拟出错

Describe the bug
进入Network Monitor必现
Log
[Bugly] Trapped uncaught exception 'NSUnknownKeyException', reason: '[<NSURLSessionTaskMetrics 0x283eba430> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key redirectCount.'
(
0 CoreFoundation 0x00000001a0ba2a04 2D4D4E9A-884C-31FE-90BE-B324E7B02A3F + 1223172
1 libobjc.A.dylib 0x00000001a10af4fc objc_exception_throw + 56
2 CoreFoundation 0x00000001a0aa81e4 2D4D4E9A-884C-31FE-90BE-B324E7B02A3F + 197092
3 Foundation 0x00000001a06d31f8 6511D0A1-2D67-36FA-BA0E-8FB08A6380FE + 205304
4 StarMaker 0x00000001029fd3a8 +[MTHNetworkTransaction transactionFromPropertyDictionary:] + 3276
5 StarMaker 0x00000001029de070 __51-[MTHNetworkRecordsStorage readNetworkTransactions]_block_invoke.52 + 268
6 Foundation 0x00000001a06c50fc 6511D0A1-2D67-36FA-BA0E-8FB08A6380FE + 147708
7 Foundation 0x00000001a0720fb8 6511D0A1-2D67-36FA-BA0E-8FB08A6380FE + 524216
8 StarMaker 0x00000001029dd848 -[MTHNetworkRecordsStorage readNetworkTransactions] + 532
9 StarMaker 0x00000001029cd41c -[MTHNetworkMonitorViewModel loadTransactionsWithInspectComoletion:] + 116
10 StarMaker 0x00000001029c73cc __51-[MTHNetworkMonitorViewController loadTransactions]_block_invoke + 216
11 libdispatch.dylib 0x00000001093e1874 _dispatch_call_block_and_release + 24
12 libdispatch.dylib 0x00000001093e2c50 _dispatch_client_callout + 16
13 libdispatch.dylib 0x00000001093e5354 _dispatch_queue_override_invoke + 876
14 libdispatch.dylib 0x00000001093f41d8 _dispatch_root_queue_drain + 376
15 libdispatch.dylib 0x00000001093f4b00 _dispatch_worker_thread2 + 156
16 libsystem_pthread.dylib 0x00000001a13effcc _pthread_wqthread + 416
17 libsystem_pthread.dylib 0x00000001a13f2aa0 start_wqthread + 8
)

To Reproduce
进入Network Monitor

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • Device: iPhone8
  • OS: iOS13
  • Xcode Version: xcode11

Additional context
Add any other context about the problem here.

调用栈回溯问题

前提:新建项目,仅仅导入mth_stack_backtrace.h与mth_stack_backtrace.mm文件,然后回溯主线程的调用栈,发现当回溯到mth_stack_backtrace_of_thread方法后便停止了,后发现mth_stack_backtrace_of_thread方法的偏移不在主项目的Image范围内。

后尝试使用pod直接导入MTHawkeye,然后使用同样的代码回溯主线程调用栈,发现可以正常回溯,同时mth_stack_backtrace_of_thread方法的偏移在主项目的Image范围呢。

猜测是在编译选项中做了处理,可以解释一下MTHawkeye有做何种特殊处理吗?

使用该库进行pod install时生成以下提示信息

Describe the bug
在不添加该库时,不会产生以下信息,只有在添加该库时出现
Log
[!] The StarMakerLite [Release] target overrides the CLANG_CXX_LANGUAGE_STANDARD build setting defined in Pods/Target Support Files/Pods-StarMakerLite/Pods-StarMakerLite.release.xcconfig'. This can lead to problems with the CocoaPods installation - Use the $(inherited)` flag, or
- Remove the build settings from the target.

目前项目中CLANG_CXX_LANGUAGE_STANDARD 的值为 CLANG_CXX_LANGUAGE_STANDARD = c++11

暂时不清楚是本库是否有某些参数与项目的设置有冲突

MTHNetworkObserver类ReceiveData里面appendData的时候,会报NSMallocException内存错误

作者你好:
我这边监听直播推流请求的时候,发现会crash,看了崩溃日志,提示NSMallocException 错误

代码定位到

- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data impl:(id)impl

函数是

[NSConcreteMutableData  appendbytes:length]
[NSConcreteMutableData  appendData:]

我看dataAccumulator逻辑是
didReceiveResponse 初始化
didReceiveData 里面拼接
didCompleteWithError 后面计算大小,移除

有没可能一开始dataAccumulator这个初始化的时候申请内存小了,然后后面不断拼返回的data,造成内存OOM了,直播的时候可能时间很长,导致数据越来越大,dataAccumulator这部分内存没有到didCompleteWithError就没有清除

'FLEX/FLEXImagePreviewViewController.h' file not found

In Swift project

 pod 'MTHawkeye', :configurations => 'Debug'

 pod 'FLEX', :configurations => ['Debug']
 pod 'FBRetainCycleDetector', :configurations => ['Debug']
 pod 'fishhook', :configurations => ['Debug']
 pod 'CocoaLumberjack', '3.6.0', :configurations => ['Debug'] # CocoaLumberjack is optional, change to `MTHawkeye/DefaultPluginsWithoutLog` if don't need.
 # pod 'MTGLDebug', :configurations => ['Debug'] # MTGLDebug is exclude by default, change `MTHawkeye` to `MTHawkeye/DefaultPlugins` to include.

 pod 'MTAppenderFile', :configurations => ['Debug']

Build fail: 'FLEX/FLEXImagePreviewViewController.h' file not found

FLEX版本依赖升级为4.0.0,uiwebview改为了wkwebview

Describe the bug
A clear and concise description of what the bug is.

Log
There are two ways to get the running log of MTHawkeye:
A: Filter the Xcode Console log, they are start with [hawkeye]
B: Under the com.meitu.hawkeye folder in sandbox, the log was store as log.mtlog & log.mmap2

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Xcode Version: [e.g. 10.2]

Additional context
Add any other context about the problem here.

实现NSURLSessionDelegate方法会监控不到数据

你好,我在Network Inject Test中
MTURLConnectionInjectTestViewController类中
实现了
- (void)URLSession:(NSURLSession *)session dataTask:(nonnull NSURLSessionDataTask *)dataTask didReceiveResponse:(nonnull NSURLResponse *)response completionHandler:(nonnull void (^)(NSURLSessionResponseDisposition))completionHandler
点击URLSession Without delegate选项,监控不到数据

还有在MTHNetworkObserver中injectIntoURLSessionTaskCreator和injectIntoNSURLConnectionCreator方法中,都有
if (TRUE)的写法,这个判断起什么作用?

  • Device: XR
  • OS: 12.2
  • Xcode Version: 10.2.1

Swift方法调用的耗时监测

现在Swift项目越来越多了,我们目前就是用的Swif语言开发的项目,请问对Swift耗时方法的监测什么时候可以支持呢?或者有什么好的思路?

异步获取UI信息

Describe the bug
该监测工具会在异步线程中获取UI信息
Screenshots
image

Improve ANR Trace

Is your feature request related to a problem? Please describe.
Try to improve the ANR Trace, capture more call backtrace on main thread will be useful while the stack_backtrace method impact the performance little.

Describe the solution you'd like
Capture the backtrace every 50ms, and when ANR happens, merge backtrace and store the record.

README上没有找到注册插件的方法

Describe the bug
A clear and concise description of what the bug is.

Log
There are two ways to get the running log of MTHawkeye:
A: Filter the Xcode Console log, they are start with [hawkeye]
B: Under the com.meitu.hawkeye folder in sandbox, the log was store as log.mtlog & log.mmap2

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Xcode Version: [e.g. 10.2]

Additional context
Add any other context about the problem here.

动态库问题

前提:第三方库是以动态库的方式集成到项目中

当调用MTHawkeyeDyldImagesUtils的mtha_addr_is_in_sys_libraries方法时,如果传入方法地址是该动态库中地址,那么会判断为系统库。

自测发现原因为sys_images_begin值有误,在上述情况下,image从低地址到高地址可能为 主APP-libobjc-trampolines-动态库 这种布局,在libobjc-trampolines地址之上均认为是系统库。

不知该机制是否是刻意如此设计?若是,可以解释下如此设计的原因吗?

使用FLEX heap Objects 必crash

Describe the bug
使用内置的FLEX查看Heap Object必crash

Screenshots
image

Environment (please complete the following information):

  • Device: iphone6sp
  • OS: 11.4
  • Xcode Version: 10.2.1

开启 Allocation 之后启动就崩

Describe the bug
开启 mtha_isAllocTracking 之后,再次启动 App,崩溃,如下图.
另外,FLEX 4.0.0 版本,不存在以下方法:

//MTHNetworkTransactionDetailTableViewController.m
detailViewController = [[FLEXImagePreviewViewController alloc] initWithImage:image]; // 改为 [FLEXImagePreviewViewController forImage:image];

//MTHDirectoryWatcherViewController.m
else if ([FLEXUtility isImagePathExtension:pathExtension]) { // 不存在 isImagePathExtension:
        UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
        vc = [[FLEXImagePreviewViewController alloc] initWithImage:image]; // 改为 [FLEXImagePreviewViewController forImage:image];
    }

Screenshots
image

Environment (please complete the following information):

  • Device: [e.g. iPhone 8]
  • OS: [e.g. iOS 14.2]
  • Xcode Version: [e.g. 12.2]
  • MTAppenderFile (0.4.4)
  • MTGLDebug (3.1.2)
  • MTHawkeye (0.11.4)
  • FLEX (= 4.0.0)

开启大块内存监控有问题啊,开启不了啊

`+ (void)startSingleChunkMallocTracer {
if ([MTHAllocations shared].isLoggingOn)
return;

[[MTHAllocations shared]
    startSingleChunkMallocDetector:[MTHawkeyeUserDefaults shared].chunkMallocThresholdInBytes
                          callback:^(size_t bytes, vm_address_t *_Nonnull stack_frames, size_t frames_count) {
                              MTHLogInfo(@"chunk malloc:%.2fmb stack: ", bytes / 1024 / 1024.f);
                          }];

MTHLogInfo(@"allocations single chunk malloc start");

}`

if ([MTHAllocations shared].isLoggingOn) /// 这块判断有问题,开启了log, 就不能开启大块内存监控

长时间后台进入前台,偶现ANR记录异常

Describe the bug
长时间后台进入前台,偶现ANR记录异常

Log
custom-time-event,1562657739.233881,{"event":"App::DidEnterBackground","time":1562657739.233881}
(中间大量CPU,MEM已忽略)
custom-time-event,1562671401.548742,{"event":"App::WillEnterForeground","time":1562671401.5487421}
view-ctrl,8,{"loadViewExit":1562671401.5686679,"didLoadExit":1562671401.568696,"loadViewEnter":1562671401.568583,"didAppearExit":1562671401.688776,"initExit":1562671401.567296,"willAppearExit":1562671401.5822461,"didLoadEnter":1562671401.568692,"willAppearEnter":1562671401.5822361,"name":"HXKaiPingAdRootViewController","didAppearEnter":1562671401.6887641}
custom-time-event,1562671401.795998,{"event":"App::DidBecomeActive","time":1562671401.7959981}
anr,1562671401.899392,{"biases":"4.884004592895508","duration":"5023540.706038475","stacks":[{"titleframe":"0x104b9565f","time":1562671401.796412,"stackframes":"0x2063cfea4,0x2063cf37b,0x20624f603,0x20624faa3,0x206497e9f,0x20740aab7,0x2071d256b,0x2071e0333,0x207410a63,0x210d07bdb,0x20627e483,0x20625e743,0x210d07a77,0x210d05747,0x233a3faf3,0x104b9565f,0x2067b483b,0x2067b4807,0x2067b3cf7,0x2067b39a3,0x20672bb7f,0x2067b342f,0x2071c4c9f,0x233a16a63,0x2332bdfc3,0x2332bee23,0x2332bdd7b,0x2332c2c67,0x233608727,0x20927d6e3,0x20627e483,0x2062553df,0x2092bba9b,0x2092bb727,0x2092bbd43,0x2067d60df,0x2067d605f,0x2067d5943,0x2067d080f,0x2067d00df,0x208a49583,0x233a20bff,0x1024472eb,0x20628ebb3"}]}

To Reproduce

  1. 进入后台
  2. 等待一段时间
  3. 在WillEnterForeground,代码执行开屏广告处理
  4. 出现异常ANR

Expected behavior
没有这条ANR信息

Additional context
1.为什么会有一条长达5023540.706038475耗时的ANR信息
2.为什么这段耗时和前后台切换的差值出入较大

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.