Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WaitForGcToComplete blocked for 89.851ms for cause DisableMovingGc [closed]

I have two versions of an app, a paid and a free version. Both versions share the same code for a notification service. One version is working the other seems to run through the code and starts the method to show the alert but this never displays to the user and instead I get this in the logcat:

20:23:51.926 I/art: WaitForGcToComplete blocked for 5.737ms for cause DisableMovingGc
04-20 20:23:54.531 I/art: Thread[5,tid=12452,WaitingInMainSignalCatcherLoop,Thread*=0xb7e9eec0,peer=0x32c0a0a0,"Signal Catcher"]: reacting to signal 3
04-20 20:23:54.755 I/art: Wrote stack traces to '/data/anr/traces.txt'

There are quite a few differences in other areas of the apps but one recent addition was that of mixpanel tracking which I have seen linked to garbage collection issues in the past. This is present in both apps but different tracking in each.

I have looked in the traces.txt file but to be honest its massive and im not sure what im looking for. I have found things like this but its not helping:

"ActivityManager" prio=5 tid=16 TimedWaiting
  | group="main" sCount=1 dsCount=0 obj=0x12d4c9e0 self=0xb7e73020
  | sysTid=579 nice=-2 cgrp=default sched=0/0 handle=0xb7e73628
  | state=S schedstat=( 0 0 0 ) utm=2110 stm=2446 core=1 HZ=100
  | stack=0xa396a000-0xa396c000 stackSize=1036KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x1b396375> (a com.android.server.am.ActivityManagerService$5)
  at java.lang.Object.wait(Object.java:422)
  at com.android.server.am.ActivityManagerService.dumpStackTraces(ActivityManagerService.java:4800)
  - locked <0x1b396375> (a com.android.server.am.ActivityManagerService$5)
  at com.android.server.am.ActivityManagerService.dumpStackTraces(ActivityManagerService.java:4777)
  at com.android.server.am.ActivityManagerService.appNotResponding(ActivityManagerService.java:5018)
  at com.android.server.am.BroadcastQueue$AppNotResponding.run(BroadcastQueue.java:171)
  at android.os.Handler.handleCallback(Handler.java:739)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:135)
  at android.os.HandlerThread.run(HandlerThread.java:61)
  at com.android.server.ServiceThread.run(ServiceThread.java:46)

how do I go about debugging this?


EDIT

In Lieu knowing how to debug I am just hacking about and commenting out the code below allow the service to keep running so its something in here causing the Gc error but why, its identical to the other app that works?

void sendNotification(String message) {
        Log.e(TAG, "send notification");

        /*NotificationCompat.Builder mBuilder =
                (NotificationCompat.Builder) new NotificationCompat.Builder(this)
                        .setSmallIcon(R.drawable.ic_notification_icon)
                        .setContentTitle(message)
                        .setContentText("since you last serviced your shocks")
                        .setColor(0xffCDDC39)
                        .setAutoCancel(true);
        Intent resultIntent = new Intent(this, ActivitiesActivity.class);
        TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
        stackBuilder.addParentStack(ActivitiesActivity.class);
        stackBuilder.addNextIntent(resultIntent);
        PendingIntent resultPendingIntent =
                stackBuilder.getPendingIntent(
                        0,
                        PendingIntent.FLAG_UPDATE_CURRENT
                );
        mBuilder.setContentIntent(resultPendingIntent);
        NotificationManager mNotificationManager =
                (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        mNotificationManager.notify(mId, mBuilder.build());*/
    }
like image 478
EnduroDave Avatar asked Oct 19 '22 11:10

EnduroDave


1 Answers

Found the bug. This is a rather foolish mistake.

Turns out that of you have android:parentActivityName= equal to the activity name (copy and paste typo) it causes all sorts of garbage collection errors that you might not notice unless you are trying to send a notification. Who knew?

like image 142
EnduroDave Avatar answered Oct 21 '22 06:10

EnduroDave