4

I've a strange black screen problem at app restart after the app wasn't used for a while reported by users in the play store developer console with an ANR with a quite strange stack trace:

----- pid 2704 at 2013-08-15 09:08:32 -----
Cmd line: system_server

DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0 hwl=0 hwll=0)
"main" prio=5 tid=1 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x400281b8 self=0xd088
  | sysTid=2704 nice=0 sched=0/0 cgrp=default handle=-1345006464
  | schedstat=( 29713532638 35237133707 131286 )
  at com.android.server.SystemServer.init1(Native Method)
  at com.android.server.SystemServer.main(SystemServer.java:918)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:507)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(...)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
  at dalvik.system.NativeStart.main(Native Method)
 ...

and no thread with app code involved. I can kind of reproduce it on one of my test devices but it is quite random and takes really long to run into the error. But if I'm able to I get the following messages in the log of the device right after starting the app:

I/ActivityManager( 2704): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.client.android/.ExampleMainActivity bnds=[125,494][235,632] } from pid 2908
W/ActivityManager( 2704): Receiver during timeout: BroadcastFilter{40b8b180 ReceiverList{40b8b108 32495 com.example.client.android/10107 remote:40b34b28}}
I/ActivityManager( 2704): Skipping duplicate ANR: ProcessRecord{40bfc8c0 32495:com.example.client.android/10107} Broadcast of Intent { act=android.intent.action.SCREEN_OFF flg=0x40000000 }
W/ActivityManager( 2704): Activity idle timeout for HistoryRecord{40578b78 com.example.client.android/.ExampleMainActivity}

I already googled around and found the following posts on StackOverflow concerning these messages:

Activity idle timeout for HistoryRecord?

Activity idle timeout for HistoryRecord

And the following post in google groups:

https://groups.google.com/forum/?fromgroups#!topic/android-developers/TfkPlN5b-ig

I checked for services, if there's anything heavy-weight in onReceive of the BroadcastReceivers but haven't found anything.

We use a OnGlobalChangeLayoutListener, which applied an View.invalidate() to work around a WebView repaint probelm which maybe could cause a draw-Looping. I removed it but still do get the problem.

Anyone maybe having the same problem and having an idea how to fix it or to isolate it? I'm pretty much out of ideas here and would love to understand what's going on here.

UPDATE

I forgot to mention: if this black screen problem happened the only way getting the app out of this is a forced stop of the application process. Otherwise the log lines get logged every time I try to start the app.

UPDATE 2

A more detailed description of what is happening as requested: The black screen occurs very randomly. It always happens at start of the app and if happened only a force stop gets the app out of this. It seems to happen only after the app wasn't used for a longer and was probably swapped out of memory. And it looks like only Android 2.x devices are affected although I'm not sure with this.

UPDATE 3

I've added a button which calls android.os.Process.killProcess(Process.myPid()); and if I call this again and again I've been able to reproduce it after some time, by starting the app and quitting it using the button. After some time (quite random), I get this right after quitting using the button:

E/JavaBinder( 2704): !!! FAILED BINDER TRANSACTION !!!

followed by a:

W/ActivityManager( 2704): Activity pause timeout for HistoryRecord{40976dd8 com.example.client.android/.ExampleMainActivity}

and next time I restart the app I just get a black screen and the log messages mentioned above. I've been unable to reproduce the same with an android 4.1 device, only with two 2.3 devices.

Googling around I found this:

http://androiddiscuss.com/1-android-discuss/42614.html

suggesting the binder transaction buffer is somewhat exhausted. We use the MediaPlayer, InApp-Billing and Google Cloud Messages which use binding. I removed all of them and still get into this error. Maybe someone knows other hidden binder related stuff to check for?

Community
  • 1
  • 1
HefferWolf
  • 3,894
  • 1
  • 23
  • 29
  • `com.example.client.android` is your package and app you're referring to that is giving you trouble? – t0mm13b Aug 15 '13 at 12:06
  • Yes, I replaced the real package name with com.example in the log file snippet above. But that's the app causing the trouble and the lines get logged at start of the app. – HefferWolf Aug 15 '13 at 12:10
  • Too vague, sorry, cannot tell exactly what happened there, as for that ANR report on that end user's device where the situation occurred, there, the first snippet in the above, indicating the Android runtime `system_server`, looks like it crashed on their device, not your app, the stack trace would show in the second snippet above, and so far, there's no stack trace. So its more than likely the end user who alerted you about it, their handset was crashing due to possible overload, software/hardware malfunction, not necessarily your app. *You need to post more details* – t0mm13b Aug 15 '13 at 12:16
  • The ANR-Dump-Snippet I posted is in fact from the device (a Samsung Galaxy S2) I have here which I was able to randomly "reproduce" it. And anything else is still running fine on the device, despite my app. – HefferWolf Aug 15 '13 at 12:21
  • If `system_server` crashed, it would have negative affect on the Android runtime, loading apps, would fail with black screen, the real question is **why?** Like as I said, the second snippet is far too short for us to be able to deduce properly! What's your app on the play store, why the secrecy, if any SO users saw this, they'd think `com.example.client.android` is an exercise code taken from some site... just saying :) – t0mm13b Aug 15 '13 at 12:25
  • The second snippet is all that gets logged concerning the app (I stripped any samsung wifi debug logging). And only our app (https://play.google.com/store/apps/details?id=com.bluelionmobile.qeep.client.android) is affected, other apps just start fine while our app has a black screen. – HefferWolf Aug 15 '13 at 12:33
  • Right, will load it up on mine here, and report back shortly if that helps :) PS you say 2.x devices, will try that on Froyo here :) – t0mm13b Aug 15 '13 at 12:44
  • Where abouts exactly does it black screen? is it sensitive to screen timeouts - I ask because, the third line in the logcat in second snippet above. Its a very media heavy app, which may have thrown wobblers on the `system_server`? ... so far, running on Froyo on Samsung 5 Europa FYI. and have it logcat'ted – t0mm13b Aug 15 '13 at 12:56
  • As I said in the post: "app restart after the app wasn't used for a while" – HefferWolf Aug 15 '13 at 13:07
  • Hmmm.... I'll throw a few pointers in there,*focus* on the media parts of the app, as the device goes to sleep, are you keeping wakelocks active, perhaps, sleeping, then when it wakes up, their handle on some media (sound, visual) is lost inducing system_server hang. To be quite honest, if you're using a release version, you're going to have a much harder time in trying to figure it out despite ACRA being loaded which is of very little use! *time to get your debugging hat on and use a debug version and watch the logcats* Cannot do this here! – t0mm13b Aug 15 '13 at 13:11
  • -1 from me, cannot expect SO users like myself to help with this question considering how vague the question was initially and reluctance to give more details. After clarifications, the app queep is somewhat misbehaving but that's down to some code fault unique to 2.x devices and is wildly speculative as app is release build and we're not remote debuggers on the whim to satisfy OP's question. As said, you need to investigate *more* thoroughly in to this yourself, we cannot do it! – t0mm13b Aug 15 '13 at 13:33

1 Answers1

0

I was finally able to identify the faulty component: I recently updated the used Admob-SDK from 6.2.1 to 6.4.1 and the black screen (and the Java-Binder message) happens since the update. Rolling back to 6.2.1 solved the issue.

HefferWolf
  • 3,894
  • 1
  • 23
  • 29