I guess the solution is trying to debug the heck out of it, that's also 
what the OP was basically asking for. The causes in her/his case will most 
likely be too different to be useful for you, since I think it's related to 
multithreading deadlocks due to bad locking / synchronization. I had 
similar problems in my last game, because I screwed up at some places. 
Proper thread synchronization can be subtly difficult to implement.

What you could do is running your app using a debugger. As soon as the app 
gets unresponsive, look into the list of currently active threads that 
belong to your app process (in Eclipse that would be in the debug view in 
the debug perspective). As far as I recall, locked up threads are marked as 
"waiting". You should be able to see the currently executing method names 
and complete call stacks per thread. Their locations in code may give you 
hints what's causing the problem. You also may have to pause your app in 
order to avoid that crash happening.


On Monday, February 10, 2014 3:48:02 AM UTC-6, Landry shuai wrote:
>
> I have met the same problem. Do you have a solution for this problem?
>
> On Friday, March 22, 2013 12:09:25 AM UTC+8, Mind wrote:
>>
>> Hi,
>>
>> I have implemented a 2D game using SurfaceView + GameThread (does nothing 
>> atm) + ViewThread pattern that calls a draw method on the SurfaceView.
>>
>> However, it randomly stops redrawing the screen.  "Randomly" means it can 
>> take up to several minutes of play to freeze.  Other things like timers/etc 
>> on the Activity itself continue to work.
>>
>> See the tombstone data below.  I really don't know how to read this.  It 
>> seems that the call to RoundRectShape() is the problem while drawing the 
>> rectangle from touchDown to touchUp.  However, it works fine for some 
>> minutes of random touching before crashing.
>>
>> I would appreciate it if someone with more knowledge could give me some 
>> idea on HOW to debug this.  Thanks!
>>
>> Here is the tombstone data:
>>
>> "main" prio=5 tid=1 WAIT
>>   | group="main" sCount=1 dsCount=0 obj=0x41b809a0 self=0x40091010
>>   | sysTid=31227 nice=0 sched=0/0 cgrp=apps handle=1075041244
>>   | state=S schedstat=( 0 0 0 ) utm=67 stm=29 core=1
>>   at java.lang.Object.wait(Native Method)
>>   - waiting on <0x41b80da0> (a java.lang.VMThread) held by tid=1 (main)
>>   at java.lang.Thread.parkFor(Thread.java:1231)
>>   at sun.misc.Unsafe.park(Unsafe.java:323)
>>   at java.util.concurrent.locks.LockSupport.park(LockSupport.java:159)
>>   at 
>> java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:810)
>>   at 
>> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:843)
>>   at 
>> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1173)
>>   at 
>> java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:183)
>>   at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:259)
>>   at android.view.SurfaceView.updateWindow(SurfaceView.java:497)
>>   at 
>> android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:231)
>>   at android.view.View.dispatchWindowVisibilityChanged(View.java:7544)
>>   at 
>> android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1039)
>>   at 
>> android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1039)
>>   at 
>> android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1039)
>>   at 
>> android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1039)
>>   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1211)
>>   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
>>   at 
>> android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
>>   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
>>   at android.view.Choreographer.doCallbacks(Choreographer.java:562)
>>   at android.view.Choreographer.doFrame(Choreographer.java:532)
>>   at 
>> android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
>>   at android.os.Handler.handleCallback(Handler.java:725)
>>   at android.os.Handler.dispatchMessage(Handler.java:92)
>>   at android.os.Looper.loop(Looper.java:137)
>>   at android.app.ActivityThread.main(ActivityThread.java:5041)
>>   at java.lang.reflect.Method.invokeNative(Native Method)
>>   at java.lang.reflect.Method.invoke(Method.java:511)
>>   at 
>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
>>   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
>>   at dalvik.system.NativeStart.main(Native Method)
>>
>> "Thread-3900" prio=5 tid=12 TIMED_WAIT
>>   | group="main" sCount=1 dsCount=0 obj=0x4242c4c8 self=0x73c2f6c0
>>   | sysTid=31253 nice=0 sched=0/0 cgrp=apps handle=1924236928
>>   | state=S schedstat=( 0 0 0 ) utm=62 stm=44 core=1
>>   at java.lang.VMThread.sleep(Native Method)
>>   at java.lang.Thread.sleep(Thread.java:1031)
>>   at java.lang.Thread.sleep(Thread.java:1013)
>>   at com.rhs.wordsearch.Threads.GameThread.run(GameThread.java:62)
>>
>> "Thread-3899" prio=5 tid=11 NATIVE
>>   | group="main" sCount=1 dsCount=0 obj=0x4242c270 self=0x73c2f270
>>   | sysTid=31252 nice=0 sched=0/0 cgrp=apps handle=1925462672
>>   | state=R schedstat=( 0 0 0 ) utm=8667 stm=274 core=1
>>   #00  pc 0007f9cc  /system/lib/libskia.so 
>> (SkPath::Iter::consumeDegenerateSegments()+60)
>>   #01  pc 0007fbcc  /system/lib/libskia.so 
>> (SkPath::Iter::next(SkPoint*)+12)
>>   #02  pc 0006e014  /system/lib/libskia.so (SkEdgeBuilder::build(SkPath 
>> const&, SkIRect const*, int)+328)
>>   #03  pc 00091e58  /system/lib/libskia.so (sk_fill_path(SkPath const&, 
>> SkIRect const*, SkBlitter*, int, int, int, SkRegion const&)+56)
>>   #04  pc 0008ec40  /system/lib/libskia.so (SkScan::AntiFillPath(SkPath 
>> const&, SkRegion const&, SkBlitter*, bool)+776)
>>   #05  pc 0008ef9c  /system/lib/libskia.so (SkScan::AntiFillPath(SkPath 
>> const&, SkRasterClip const&, SkBlitter*)+204)
>>   #06  pc 0006be64  /system/lib/libskia.so
>>   #07  pc 00060ae8  /system/lib/libskia.so (SkCanvas::drawPath(SkPath 
>> const&, SkPaint const&)+520)
>>   #08  pc 0006a9ff  /system/lib/libandroid_runtime.so
>>   #09  pc 0001e290  /system/lib/libdvm.so (dvmPlatformInvoke+112)
>>   #10  pc 0004d411  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int 
>> const*, JValue*, Method const*, Thread*)+396)
>>   #11  pc 00000214  /dev/ashmem/dalvik-jit-code-cache (deleted)
>>   at android.graphics.Canvas.native_drawPath(Native Method)
>>   at android.graphics.Canvas.drawPath(Canvas.java:1021)
>>   at 
>> android.graphics.drawable.shapes.RoundRectShape.draw(RoundRectShape.java:78)
>>   at 
>> android.graphics.drawable.ShapeDrawable.onDraw(ShapeDrawable.java:209)
>>   at android.graphics.drawable.ShapeDrawable.draw(ShapeDrawable.java:224)
>>   at com.rhs.wordsearch.Components.Highlight.draw(Highlight.java:230)
>>   at 
>> com.rhs.wordsearch.Views.WordSearchSurfaceView.onDraw(WordSearchSurfaceView.java:283)
>>   at com.rhs.wordsearch.Threads.ViewThread.run(ViewThread.java:69)
>>
>>
>>

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to