Last Comment Bug 703656 - Attempt to use JS function on a different thread calling nsIWebProgressListener.onStateChange & nsIDOMEventListener.handleEvent results in crash
: Attempt to use JS function on a different thread calling nsIWebProgressListen...
Status: RESOLVED FIXED
[native-crash:P1]
: crash, reproducible
Product: Firefox for Android
Classification: Client Software
Component: General (show other bugs)
: unspecified
: ARM Android
: P2 critical (vote)
: ---
Assigned To: Sriram Ramasubramanian [:sriram]
:
Mentors:
https://crash-stats.mozilla.com/repor...
: 704232 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-18 10:44 PST by Aaron Train [:aaronmt]
Modified: 2012-01-09 15:17 PST (History)
6 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
fixed
11+


Attachments
Patch (6.14 KB, patch)
2011-11-22 12:39 PST, Sriram Ramasubramanian [:sriram]
mark.finkle: review+
Details | Diff | Review

Description Aaron Train [:aaronmt] 2011-11-18 10:44:08 PST
E/GeckoConsole( 2909): Attempt to use JS function on a different thread calling nsIWebProgressListener.onStateChange. JS objects may not be shared across threads.
E/GeckoConsole( 2909): Attempt to use JS function on a different thread calling nsIDOMEventListener.handleEvent. JS objects may not be shared across threads.
W/InputConnectionWrapper.ICC(  188): Timed out waiting on IInputContextCallback
I/ActivityManager(  110): Process org.mozilla.fennec (pid 2909) has died.
D/Zygote  (   75): Process 2909 exited cleanly (1)
I/WindowManager(  110): WIN DEATH: Window{40b89098 SurfaceView paused=false}
I/WindowManager(  110): WIN DEATH: Window{40553400 org.mozilla.fennec/org.mozilla.fennec.App paused=false}
I/InputDispatcher(  110): Dropping event because there is no touched window or focused application.
I/WindowManager(  110): WIN DEATH: Window{408f9440 org.mozilla.fennec/org.mozilla.gecko.TabsTray paused=false}


STR: 

1. Open two tabs with different pages
2. Reload a single tab, and during reload switch to the other tab

--
Samsung Nexus S (Android 2.3.6)
20111118040220
http://hg.mozilla.org/projects/birch/rev/9999a423d8ab
Comment 1 Aaron Train [:aaronmt] 2011-11-18 10:45:52 PST
bp-f16bca24-7e06-4de5-960a-b09302111118
Comment 2 Naoki Hirata :nhirata (please use needinfo instead of cc) 2011-11-18 10:59:41 PST
similar steps to bug 702619?
Comment 3 Aaron Train [:aaronmt] 2011-11-18 11:07:24 PST
(In reply to Naoki Hirata :nhirata from comment #2)
> similar steps to bug 702619?

Nope, much simpler ala comment #0.
Comment 4 Mark Finkle (:mfinkle) (use needinfo?) 2011-11-21 13:54:13 PST
*** Bug 704232 has been marked as a duplicate of this bug. ***
Comment 5 Naoki Hirata :nhirata (please use needinfo instead of cc) 2011-11-21 22:17:09 PST
Setting to end user priority P1; STR available
Comment 6 Sriram Ramasubramanian [:sriram] 2011-11-22 12:39:45 PST
Created attachment 576229 [details] [diff] [review]
Patch

The problem is not with "JS objects accessed in wrong thread" or "TabsTray". I narrowed down the problem to allocation of "ArrayListIterator" and "Rect" in TileLayer.java. The number of objects created for tab switching increases very fast, causing all background processes to be killed by android one by one. This can be seen in the logs. Once android runs out of heap (even after killing background processes), it eventually kills the Fennec application. The GL layer needs to be optimized to fix this issue.

Also, I've optimized TabsTray to use less memory when shown. The OnClickListeners are reused between each row in the list. To ensure the selected tab is in bold, the view needs to be read from XML every time a row is created. This is a bottleneck. Though this can cause memory issues, I didn't find any with it in AllocationTracker in DDMS tool -- mostly because the number of list entries is minimal and the lifespan of TabsTray is small (also GC is called once activity finishes).

Bug 704162, bug 704232 are all related to the same issue of "switching tabs".
Bug 704575 is tracking the dirty rectangle problem.
Comment 7 Mark Finkle (:mfinkle) (use needinfo?) 2011-11-22 13:30:50 PST
Comment on attachment 576229 [details] [diff] [review]
Patch

These changes look good and if they save some memory, we should do it. The changes are not insane.
Comment 8 Mark Finkle (:mfinkle) (use needinfo?) 2011-12-03 14:26:04 PST
https://hg.mozilla.org/projects/birch/rev/fd9726529749

Note You need to log in before you can comment on or make changes to this bug.