目录

页面发生卡死,无法响应点击或侧滑操作

问题现象

应用内跳转页面,一直显示加载中,或长时间停留未跳转,点击或侧滑操作都无响应。

背景知识

场景一

[h2]问题定位

  1. 当faultlogger目录下没有卡死日志生成时,可以结合trace进行分析。
  2. 使用HiSmartPerf工具抓取该过程的trace信息,查看应用主线程,排查卡死阶段有没有耗时特别长的函数。

  3. 从trace日志中看出,OnBackground函数执行时间超过了20s。

[h2]分析结论

函数执行时间过长导致应用卡死。

[h2]修改建议

排查函数执行耗时长的原因。

场景二

[h2]问题定位

  1. 当faultlogger目录下没有卡死日志生成时,结合trace分析,也没有耗时特别长的函数,需要排查是否是页面跳转逻辑问题导致页面卡在启动页。
  2. 结合代码分析页面跳转逻辑。

[h2]分析结论

存在页面跳转逻辑问题导致应用卡死在启动页。

[h2]修改建议

修复页面跳转逻辑。

场景三

[h2]问题定位

  1. 当faultlogger目录下没有卡死日志生成时,使用HiSmartPerf工具抓取该过程的trace信息,结合trace分析,查看应用主线程,可以看到部分时间段无内容加载,进一步发现http请求执行时间过长,持续时间36s。

  2. 记下TaskId=-2147483648,在hilog日志中查找对应网络请求日志。

    发现http请求报错,错误码为2300028,查询文档HTTP错误码。

    2300028:操作超时,可能原因为TCP连接超时或读写超时。需要排查网络或服务器问题,例如网络是否稳定、信号强度是否较弱、服务器负载是否过高、处理速度是否正常等。
    03-17 16:24:20.846 13583 13773 E C015B0/com.hx.example/NETSTACK: [http_exec.cpp:312] CURLcode result 28
    03-17 16:24:20.846 13583 13773 I C015B0/com.hx.example/NETSTACK: [http_exec.cpp:418] taskid=-2147483648, size:0, dns:76179.535, connect:0.000, tls:0.000, firstSend:0.000, firstRecv:0.000, total:76179.699, redirect:0.000, errCode:2300028, RespCode:0, httpVer:0, method:POST, osErr:0
  1. 在应用没有freeze的情况下,网络请求超时是不会阻塞手势事件的,需要继续排查为什么点击或侧滑操作无响应,查看hilog中关于手势的日志,搜索OnInputEvent。观察到Touch test result is empty,说明触碰测试结果为空,应用前端组件未绑定事件。
    03-17 16:23:21.369 13583 13747 I C02805/com.hx.example/InputKeyFlow: [P:D:22511][OnPointerEvent:508] id:22511 recv
    03-17 16:23:21.369 13583 13747 I C04213/com.hx.example/InputKeyFlow: [] OnInputEvent(86): eid:4,InputId:22511,wid:77,action:2
    03-17 16:23:21.370 13583 13747 W C04219/com.hx.example/WMSDecor:  [invalidDomain][] GetDecorHeight(2212): Get app window decor height failed
    03-17 16:23:21.370  3529  3533 I C04200/com.ohos.sceneboard/Session: (2120)TransferPointerEvent: Session TransferPointEvent, eventId:22511, action:down, persistentId:77, bundleName:, pid:13583
    03-17 16:23:21.370 13583 13747 I C0420C/com.hx.example/WMSEvent: [] NotifyPointerEvent(3782): Input id:22511
    03-17 16:23:21.370 13583 13747 I C0420C/com.hx.example/WMSEvent: [] NotifyPointerEvent(3784): Start to process pointerEvent, id: 22511
    03-17 16:23:21.370 13583 13747 I C03919/com.hx.example/AceInputTracking: [(-1:100000:singleton)] pointdown windowId: 77
    03-17 16:23:21.370 13583 13747 I C04213/com.hx.example/InputKeyFlow: [] ConsumePointerEventInner(818): InputId:22511,wid:77,pointId:0,srcType:2,rect:[0,0,1320,2120],notify:1
    03-17 16:23:21.371 13583 13747 I C02805/com.hx.example/InputKeyFlow: [][OnPointerEvent:215] ac: move: 22512
    03-17 16:23:21.371 13583 13747 I C0420C/com.hx.example/WMSEvent: [] NotifyPointerEvent(3784): Start to process pointerEvent, id: 22512
    03-17 16:23:21.371 13583 13583 I C03951/com.hx.example/InputKeyFlow: [(100000:100000:scope)] InputTracking id:22511, fingerId:0, type=0, inject=0, isPrivacyMode=0
    03-17 16:23:21.371 13583 13747 I C0420C/com.hx.example/WMSEvent: [] NotifyPointerEvent(3784): Start to process pointerEvent, id: 22513
    03-17 16:23:21.371 13583 13583 I C03951/com.hx.example/InputKeyFlow: [(100000:100000:scope)] InputTracking id:22511, touch test hitted node info: fingerId: 0
    03-17 16:23:21.371 13583 13583 W C03951/com.hx.example/InputKeyFlow: [(100000:100000:scope)] Touch test result is empty.
    03-17 16:23:21.371 13583 13583 I C03951/com.hx.example/InputKeyFlow: [(100000:100000:scope)] InputTracking id:22511, touch test hitted recognizer type info: 
    03-17 16:23:21.371 13583 13583 I C03919/com.hx.example/AceInputTracking: [(100000:100000:scope)] Hitted recognizer info is empty.
    03-17 16:23:21.372 13583 13747 I C0420C/com.hx.example/WMSEvent: [] NotifyPointerEvent(3784): Start to process pointerEvent, id: 22514
    03-17 16:23:21.372 13583 13583 I C03919/com.hx.example/AceInputTracking: [(100000:100000:scope)] Consumed new event id=22511 in ace_container, lastEventInfo: id:22509

[h2]分析结论

网络超时导致页面一直加载,组件未绑定事件导致无响应。

[h2]修改建议

检查设备网络是否稳定,检查服务器是否能正常建立连接并传输数据。