Android app crashing showing "Input dispatching timed out "

2120 views android
3

I am opening 5 fragments in a activity all the fragments calls volley request. And they are in a viewpager. And one of the fragments contains Mapbox map. Now if I navigate fragments it shows this error in the log cat and crashes.

E/ActivityManager: ANR in tashik.me (tashik.me/tashik.meactivity.HomeActivity)
PID: 8806
Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.  Wait queue length: 13.  Wait queue head age: 6345.7ms.)
Load: 0.63 / 0.53 / 0.39
CPU usage from 8613ms to 0ms ago (2018-09-16 11:29:51.557 to 2018-09-16 11:30:00.169):
  16% 8806/dingi.teamwork: 12% user + 3.9% kernel / faults: 4083 minor
  7% 1448/surfaceflinger: 1.6% user + 5.4% kernel / faults: 2 minor
  2.9% 1668/system_server: 1.5% user + 1.3% kernel / faults: 248 minor 9 major
  2.3% 1430/android.hardware.audio@2.0-service: 0.1% user + 2.2% kernel
  1.8% 1528/audioserver: 0.9% user + 0.9% kernel
  1.5% 1439/android.hardware.graphics.composer@2.1-service: 0.3% user + 1.1% kernel / faults: 3 minor
  1.3% 1441/android.hardware.sensors@1.0-service: 0.2% user + 1.1% kernel
  0.3% 1537/netd: 0.3% user + 0% kernel / faults: 108 minor
  0.2% 1495/kworker/u9:0: 0% user + 0.2% kernel
  0.2% 1800/com.android.systemui: 0% user + 0.2% kernel / faults: 9 minor
  0.1% 1//init: 0% user + 0.1% kernel / faults: 29 minor
  0.1% 7/rcu_preempt: 0% user + 0.1% kernel
  0.1% 12/ksoftirqd/1: 0% user + 0.1% kernel
  0.1% 16/ksoftirqd/2: 0% user + 0.1% kernel
  0.1% 1455/adbd: 0% user + 0.1% kernel / faults: 21 minor
  0.1% 1497/dmcrypt_write: 0% user + 0.1% kernel
  0.1% 1516/jbd2/dm-0-8: 0% user + 0.1% kernel
  0.1% 1631/dhcpclient: 0% user + 0.1% kernel
  0.1% 1897/com.android.phone: 0.1% user + 0% kernel / faults: 1 minor
  0.1% 2191/com.google.android.gms.persistent: 0.1% user + 0% kernel / faults: 7 minor
  0.1% 2448/android.process.acore: 0.1% user + 0% kernel
  0.1% 5782/kworker/u9:3: 0% user + 0.1% kernel
  0.1% 6485/kworker/u9:1: 0% user + 0.1% kernel
  0.1% 8027/kworker/u8:1: 0% user + 0.1% kernel
  0.1% 8216/kworker/u9:4: 0% user + 0.1% kernel
7% TOTAL: 3.7% user + 2.8% kernel + 0.1% iowait + 0.2% softirq
CPU usage from 13ms to 266ms later (2018-09-16 11:30:00.182 to 2018-09-16 11:30:00.436):
  17% 1668/system_server: 0% user + 17% kernel / faults: 267 minor
    12% 1687/ActivityManager: 0% user + 12% kernel
5% TOTAL: 0% user + 5% kernel

answered question

Looks like you are doing long running task in Main/UI thread. You need move out long running task in separate thread

You are calling 5 threads of Volleys together which is bad for performance.

1 Answer

3

This happened to me when I had a loop and there was a condition for the loop to get incremented. I had not set the increment for when the condition was not met. Hence, the loop stalled. This resulted in the above error.

Without your code, I cannot help. But the above is a possible cause of your error.

posted this

Have an answer?

JD

Please login first before posting an answer.