Don‘t Exit this APP. (server)‘ ~ Consumer closed input channel or an error occurred. events=0x9

实际场景:

实际开发当中遇到一个问题,当从一个app 点击systemUI 返回到 launcher 时,出现了卡顿、黑屏等问题,几秒十几秒后恢复正常。

从日志上看都是正常的,但是报出了如下错误:

InputDispatcher: channel 'fbefe69 Copy Log, Don't Exit this APP. (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
InputDispatcher: channel '141f8ce com.wt.emode/com.wt.emode.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

消费者关闭了输入通道或者发生了错误

通道是被不可恢复地破坏了,将被放弃。

 

这里看到更像是异常退出了app,但是依旧想往该通道里分发数据。

分析:

这是一个必现问题,当点击exit 按钮去退出 app,再进入app 时,必报以上错误。

这里找到了该app 退出的逻辑代码,发现是在onStop() 的生命周期调用了 System.exit() 方法(因为该app不希望在后台运行)。所以推断是当时因为退出了该app界面,Activity生命周期走到了onStop(),所以执行了退出方法,但是资源并没有被完全释放,这时很短的时间间隔内,有进程在向该通道分发数据,导致系统出现卡顿、黑屏现象。

 

解决:

在ondestroy() 生命周期执行  System.exit() 方法时,再用 Handler 做了一个 3s 的延时,相当于给系统充分时间去释放资源。

 

结果:

问题不在复现

 

===============================================================================================

12/28 补充:leader 解释了一下,该错误在调用 exit() 方法强杀进程就会报该错误

07-07 14:44:01.144 1936 3340 W ActivityManager: Force finishing activity com.zhiying.settings/.about.LegalInformationActivity 07-07 14:44:01.152 1936 1936 E PowerManagerService: screensaver enable true 07-07 14:44:01.166 1936 1952 E memtrack: Couldn't load memtrack module 07-07 14:44:01.166 1936 1952 W android.os.Debug: failed to get memory consumption info: -1 07-07 14:44:01.215 1936 2009 W InputDispatcher: channel '5cfd4ab com.zhiying.settings/com.zhiying.settings.about.LegalInformationStartWebActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 07-07 14:44:01.215 1936 2009 E InputDispatcher: channel '5cfd4ab com.zhiying.settings/com.zhiying.settings.about.LegalInformationStartWebActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 07-07 14:44:01.215 1936 2009 W InputDispatcher: channel 'c486525 com.zhiying.settings/com.zhiying.settings.about.LegalInformationStartWebActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 07-07 14:44:01.215 1936 2009 E InputDispatcher: channel 'c486525 com.zhiying.settings/com.zhiying.settings.about.LegalInformationStartWebActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 07-07 14:44:01.216 1936 2009 W InputDispatcher: channel 'b3becb6 com.zhiying.settings/com.zhiying.settings.about.LegalInformationActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 07-07 14:44:01.216 1936 2009 E InputDispatcher: channel 'b3becb6 com.zhiying.settings/com.zhiying.settings.about.LegalInformationActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 07-07 14:44:01.216 1936 2009 W InputDispatcher: channel '1712ca6 com.zhiying.settings/com.zhiying.settings.about.SystemInfoActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 07-07 14:44:01.216 1936 2009 E InputDispatcher: channel '1712ca6 com.zhiying.settings/com.zhiying.settings.about.SystemInfoActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 07-07 14:44:01.216 1936 2009 W InputDispatcher: channel 'd7b4fb2 com.zhiying.settings/com.zhiying.settings.MainZYActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 07-07 14:44:01.217 1936 2009 E InputDispatcher: channel 'd7b4fb2 com.zhiying.settings/com.zhiying.settings.MainZYActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
最新发布
07-08
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值