Closed Bug 703256 Opened 8 years ago Closed 8 years ago

android.view.ViewRoot$CalledFromWrongThreadException @ android.view.ViewRoot.checkThread(ViewRoot.java:2932)

Categories

(Firefox for Android :: General, defect, P2, critical)

ARM
Android
defect

Tracking

()

VERIFIED FIXED
Tracking Status
firefox11 --- verified
firefox12 --- verified
firefox13 --- verified
fennec 11+ ---

People

(Reporter: aaronmt, Assigned: kats)

References

Details

(Keywords: crash, Whiteboard: [native-crash], strwanted)

Attachments

(1 file)

E/AndroidRuntime( 7329): FATAL EXCEPTION: GLThread 9
E/AndroidRuntime( 7329): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
E/AndroidRuntime( 7329): 	at android.view.ViewRoot.checkThread(ViewRoot.java:2932)
E/AndroidRuntime( 7329): 	at android.view.ViewRoot.requestLayout(ViewRoot.java:629)
E/AndroidRuntime( 7329): 	at android.view.View.requestLayout(View.java:8267)
E/AndroidRuntime( 7329): 	at android.view.View.requestLayout(View.java:8267)
E/AndroidRuntime( 7329): 	at android.view.View.requestLayout(View.java:8267)
E/AndroidRuntime( 7329): 	at android.view.View.requestLayout(View.java:8267)
E/AndroidRuntime( 7329): 	at android.view.View.requestLayout(View.java:8267)
E/AndroidRuntime( 7329): 	at android.view.View.setLayoutParams(View.java:5000)
E/AndroidRuntime( 7329): 	at android.view.ViewGroup.updateViewLayout(ViewGroup.java:1884)
E/AndroidRuntime( 7329): 	at org.mozilla.gecko.GeckoApp.repositionPluginViews(GeckoApp.java:1046)
E/AndroidRuntime( 7329): 	at org.mozilla.gecko.GeckoApp.repositionPluginViews(GeckoApp.java:1034)
E/AndroidRuntime( 7329): 	at org.mozilla.gecko.gfx.LayerController.setVisibleRect(LayerController.java:168)
E/AndroidRuntime( 7329): 	at org.mozilla.gecko.gfx.LayerController.setScreenSize(LayerController.java:151)
E/AndroidRuntime( 7329): 	at org.mozilla.gecko.gfx.LayerView.setScreenSize(LayerView.java:99)
E/AndroidRuntime( 7329): 	at org.mozilla.gecko.gfx.LayerRenderer.onSurfaceChanged(LayerRenderer.java:188)
E/AndroidRuntime( 7329): 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1356)
E/AndroidRuntime( 7329): 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
W/ActivityManager(  110):   Force finishing activity org.mozilla.fennec/.App

--
Samsung Nexus S (Android 2.3.6)
20111117040329
http://hg.mozilla.org/projects/birch/rev/d7fa4814218d
Assignee: nobody → kgupta
Priority: -- → P2
Attached patch Fix threadingSplinter Review
I wasn't able to reproduce this exact problem because it seems to be an Android configuration option that I can't find. However, I simulated it by dumping a stack trace just before the call to updateViewLayout. Steps to repro were (1) loading dairy queen's flash home page and (2) rotating device. I verified that with this patch the stack changes from the one in this bug to one that is rooted on the UI thread.
Attachment #575289 - Flags: review?(pwalton)
Duplicate of this bug: 703464
From bug 703464 / Pcwalton : 
I started loading techcrunch.com, opened the Awesome Screen, clicked on techcrunch.com again, and it crashed with this stack trace.
Comment on attachment 575289 [details] [diff] [review]
Fix threading

Review of attachment 575289 [details] [diff] [review]:
-----------------------------------------------------------------

Good catch.
Attachment #575289 - Flags: review?(pwalton) → review+
https://hg.mozilla.org/projects/birch/rev/6e07405e7c50
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Hi Kartikaya:

I found the following link:

https://hg.mozilla.org/projects/birch/rev/6e07405e7c50

is not available any more. is the repository moving to a different URL? 

It is also weird (to me) that there is no:

/embedding/android/gfx/LayerRenderer.java  file in:

http://hg.mozilla.org/projects/birch/. 

Did I went to the wrong place?

I am a little bit confused at the stack trace, why it is "org.mozilla.gecko.gfx.LayerRenderer" instead of 
"embedding/android/gfx/LayerRenderer.java" as in the fix?

I am newer to Firefox development, and would like to have a deep understanding on this problem. Your response is highly appreciated.

Thank you very much.



(In reply to Kartikaya Gupta (:kats) from comment #5)
> https://hg.mozilla.org/projects/birch/rev/6e07405e7c50
(In reply to Sai from comment #6)
> https://hg.mozilla.org/projects/birch/rev/6e07405e7c50
> 
> is not available any more. is the repository moving to a different URL? 

Yeah, we had some repository moves and resets. The birch branch was closed recently and all the code was merged into mozilla-central, so that changeset can be found at https://hg.mozilla.org/mozilla-central/rev/6e07405e7c50

> 
> It is also weird (to me) that there is no:
> 
> /embedding/android/gfx/LayerRenderer.java  file in:
> 
> http://hg.mozilla.org/projects/birch/. 

The files were also moved around to make merging with mozilla-central easier. All of /embedding/android was moved to /mobile/android/base, so if you look in there you should see it.

> I am a little bit confused at the stack trace, why it is
> "org.mozilla.gecko.gfx.LayerRenderer" instead of 
> "embedding/android/gfx/LayerRenderer.java" as in the fix?

That's just how java works - it prints the package/class names, not the file names, in the stack trace.
Thanks a lot, Kartikaya.

(In reply to Kartikaya Gupta (:kats) from comment #7)
> (In reply to Sai from comment #6)
> > https://hg.mozilla.org/projects/birch/rev/6e07405e7c50
> > 
> > is not available any more. is the repository moving to a different URL? 
> 
> Yeah, we had some repository moves and resets. The birch branch was closed
> recently and all the code was merged into mozilla-central, so that changeset
> can be found at https://hg.mozilla.org/mozilla-central/rev/6e07405e7c50

Thanks for your information. It is very helpful.

Could I use command like:

hg clone http://hg.mozilla.org/mozilla-central/ -r 6e07405e7c50

to check out that specific revision? Seems that the server does not response right now. Is it for maintenance right now. If I use the wrong URL or command, please correct me. Thank you.

> 
> > 
> > It is also weird (to me) that there is no:
> > 
> > /embedding/android/gfx/LayerRenderer.java  file in:
> > 
> > http://hg.mozilla.org/projects/birch/. 
> 
> The files were also moved around to make merging with mozilla-central
> easier. All of /embedding/android was moved to /mobile/android/base, so if
> you look in there you should see it.


Thank you. I see the needed files right now. Actually, I am doing development on top of the Android mobile platform, and want to re-use part of the Fennec code. So, is it possible to just built all the java files (for Android platform) into a single jar. In other words, I do not need to re-built the whole Fennec code place; I am only interested in the java part (of course with its dependent libs). Is it possible to do that?  Any comments or guidance is highly appreciated. Thank you.

> 
> > I am a little bit confused at the stack trace, why it is
> > "org.mozilla.gecko.gfx.LayerRenderer" instead of 
> > "embedding/android/gfx/LayerRenderer.java" as in the fix?
> 
> That's just how java works - it prints the package/class names, not the file
> names, in the stack trace.

Thank you for the reminder. I overlooked the fact that org.mozilla.gecko.gfx.LayerRenderer is put into the folder: embedding/android/gfx.  ;-)
I'm happy to help, but this is probably not the best place to have this discussion. Log in to the mozilla IRC server (irc.mozilla.org) and join #mobile or #introduction and I or somebody else can help you out.
Hi Kartikaya, thanks for pointing me to irc.mozilla.org, where I got great answers to my question.

A closely-related question *just* for this bug, I try to understand why "android.opengl.GLSurfaceView$GLThread.run" would be called from a non-UI thread, but did not find it textually in available java code. (under the folder: mobile/android/base) 

I searched "LayerRenderer.onSurfaceChanged", and found it is only referred in "org.mozilla.gecko.gfx.LayerView#<init>"; and seems that that part of the code does not initialize a new thread (non-UI thread). So, can you please kindly tell me which thread calls ”onSurfaceChanged“ and leads to the crash? I really want to better understand such bug to avoid that!  Thanks.
tracking-fennec: --- → 11+
This crash cannot be reproduced anymore using the steps from comment #3

Verified fixed on:

Firefox 13.0a1 (2012-02-20)
20120220031231
http://hg.mozilla.org/mozilla-central/rev/561771f01881

Firefox 12.0a2 (2012-02-20)
20120220042008
http://hg.mozilla.org/releases/mozilla-aurora/rev/dfb7c3567c49

Firefox 11.0 (2012-02-19)
20120219151859
http://hg.mozilla.org/releases/mozilla-beta/rev/6df75f4d5ccc

--
Device: Motorola Droid PRO
OS: Android 2.3.3
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.