Tuesday, January 1, 2013

Re: [android-developers] How can an app cause a hard freeze?


On Friday, December 28, 2012 4:45:44 PM UTC-8, Mark Murphy (a Commons Guy) wrote:
On Fri, Dec 28, 2012 at 7:34 PM, Nathan <nathan....@gmail.com> wrote:
> Here are a few things I suspect might cause these things:
> Firmware/hardware errors in the device:

"Device or storage overheats" is a duplicate of this, IMHO. This
category should cover 100% of device-freeze situations, at least if
"OS bugs" are considered "firmware errors". There's nothing an SDK app
should be able to do in its own process that can lock up the device
that isn't some sort of low-level issue, AFAIK.

While most of these will be problems originating from the device
manufacturer, modded ROMs can also introduce firmware errors or
trigger hardware problems (e.g., overclocking and runaway heat
buildup).

OK. I doubt telling a user "it's your devices problem" will solve much, even though it is likely true. I'm no closer to preventing or solving it.
 
> Runs out of memory:

"Event loop gets full" is a duplicate of this, IMHO -- leastways, I am
unaware of another bound on the queue used by Looper and kin. I don't
think that this will cause a device freeze, though I could certainly
be wrong about that.

I have gotten stack traces that indicate a ThreadPool caused an OutofMemoryError because of the sheer number of Runnable's in its queue. It hit the OutofMemory before any other arbitrary limit, so I suspect you are right there.

But I was actually thinking of this as a duplicate of CPU overload. An overfull event loop is almost certain to max out the CPU to 100%. I would expect something like this to cause a Force Close long before it maxed out memory or CPU, but it didn't in the stress test I mentioned above.


> Any sure fire technique you have found for freezing an Android, let me know
> and I will try to *not* do it.

I'd stay away from the liquid nitrogen. :-)

If you block the main thread on a ReEntrantLock that is never released by its owning thread, that might do it. This is something that should cause a force close, and I believe it does at least some of the time. I believe I did create a hard freeze doing this once, but can't reproduce it today even when trying.

Nathan

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment