Last Comment Bug 711453 - Error serializing viewportmetrics org.json.JSONException: Forbidden numeric value: NaN @ org.json.JSON.checkDouble(JSON.java:25)
: Error serializing viewportmetrics org.json.JSONException: Forbidden numeric v...
Status: VERIFIED FIXED
: regression, reproducible
Product: Firefox for Android
Classification: Client Software
Component: General (show other bugs)
: unspecified
: ARM Android
: -- major (vote)
: Firefox 12
Assigned To: Kartikaya Gupta (email:kats@mozilla.com)
:
Mentors:
www.timecube.com
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-16 07:25 PST by Aaron Train [:aaronmt]
Modified: 2012-01-16 22:55 PST (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
fixed
fixed
11+


Attachments
full console log (~1.0MB) (1.75 MB, text/plain)
2011-12-16 11:02 PST, Aaron Train [:aaronmt]
no flags Details
Patch (1.39 KB, patch)
2011-12-16 13:31 PST, Kartikaya Gupta (email:kats@mozilla.com)
pwalton: review+
Details | Diff | Review
Nightly (12/20) - raw log (319.52 KB, text/plain)
2011-12-20 08:44 PST, Aaron Train [:aaronmt]
no flags Details
Guard against a zero prev-span (1.30 KB, patch)
2011-12-20 12:05 PST, Kartikaya Gupta (email:kats@mozilla.com)
pwalton: review+
akeybl: approval‑mozilla‑aurora+
Details | Diff | Review

Description Aaron Train [:aaronmt] 2011-12-16 07:25:01 PST
I/GeckoSoftwareLayerClient( 1431): Adjusting viewport
E/GeckoViewportMetrics( 1431): Error serializing viewportmetrics
E/GeckoViewportMetrics( 1431): org.json.JSONException: Forbidden numeric value: NaN
E/GeckoViewportMetrics( 1431): 	at org.json.JSON.checkDouble(JSON.java:25)
E/GeckoViewportMetrics( 1431): 	at org.json.JSONObject.numberToString(JSONObject.java:684)
E/GeckoViewportMetrics( 1431): 	at org.json.JSONStringer.value(JSONStringer.java:284)
E/GeckoViewportMetrics( 1431): 	at org.mozilla.gecko.gfx.ViewportMetrics.toJSON(ViewportMetrics.java:246)
E/GeckoViewportMetrics( 1431): 	at org.mozilla.gecko.gfx.GeckoSoftwareLayerClient.adjustViewport(GeckoSoftwareLayerClient.java:309)
E/GeckoViewportMetrics( 1431): 	at org.mozilla.gecko.gfx.GeckoSoftwareLayerClient.adjustViewportWithThrottling(GeckoSoftwareLayerClient.java:297)
E/GeckoViewportMetrics( 1431): 	at org.mozilla.gecko.gfx.GeckoSoftwareLayerClient.render(GeckoSoftwareLayerClient.java:274)
E/GeckoViewportMetrics( 1431): 	at org.mozilla.gecko.gfx.GeckoSoftwareLayerClient.geometryChanged(GeckoSoftwareLayerClient.java:264)
E/GeckoViewportMetrics( 1431): 	at org.mozilla.gecko.gfx.LayerController.notifyLayerClientOfGeometryChange(LayerController.java:275)
E/GeckoViewportMetrics( 1431): 	at org.mozilla.gecko.gfx.LayerController.scrollBy(LayerController.java:195)
E/GeckoViewportMetrics( 1431): 	at org.mozilla.gecko.ui.PanZoomController.updatePosition(PanZoomController.java:573)
E/GeckoViewportMetrics( 1431): 	at org.mozilla.gecko.ui.PanZoomController.access$500(PanZoomController.java:69)
E/GeckoViewportMetrics( 1431): 	at org.mozilla.gecko.ui.PanZoomController$FlingRunnable.run(PanZoomController.java:649)
E/GeckoViewportMetrics( 1431): 	at android.os.Handler.handleCallback(Handler.java:587)
E/GeckoViewportMetrics( 1431): 	at android.os.Handler.dispatchMessage(Handler.java:92)
E/GeckoViewportMetrics( 1431): 	at android.os.Looper.loop(Looper.java:130)
E/GeckoViewportMetrics( 1431): 	at org.mozilla.gecko.GeckoApp$28.run(GeckoApp.java:1403)
E/GeckoViewportMetrics( 1431): 	at android.os.Handler.handleCallback(Handler.java:587)
E/GeckoViewportMetrics( 1431): 	at android.os.Handler.dispatchMessage(Handler.java:92)
E/GeckoViewportMetrics( 1431): 	at android.os.Looper.loop(Looper.java:130)
E/GeckoViewportMetrics( 1431): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
E/GeckoViewportMetrics( 1431): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/GeckoViewportMetrics( 1431): 	at java.lang.reflect.Method.invoke(Method.java:507)
E/GeckoViewportMetrics( 1431): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/GeckoViewportMetrics( 1431): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/GeckoViewportMetrics( 1431): 	at dalvik.system.NativeStart.main(Native Method)

When the above exception occurs the entire viewport turns grey, and each attempt at viewing a new page yields a grey viewport. This is a major loss of functionality.


1. www.timecube.com
2. Pinch zoom and pan

--
Samsung Nexus S (Android 2.3.6)
20111216052315
http://hg.mozilla.org/mozilla-central/rev/80ac06ad280d
Comment 1 Chris Lord [:cwiiis] 2011-12-16 07:59:07 PST
When you say 'Pinch zoom and pan', could you be more specific? Are you pinching and zooming, then releasing, then panning? Pinching an zooming, letting go of one finger, then panning? Zooming in what direction and panning in what direction? How far are you zooming?

I can't easily reproduce this, so more precise instructions would help. It may also be useful to see some of the log just before this error too.
Comment 2 Chris Lord [:cwiiis] 2011-12-16 08:00:20 PST
Also to do with precision, if you could also describe what animations are happening too, that would help us diagnose at what stage the error is occurring (where animations are any panning/zooming that occurs when your fingers are not on the screen)
Comment 3 Aaron Train [:aaronmt] 2011-12-16 08:08:12 PST
More specifically  I simply reproduced again by merely pinch zooming with my thumb and index finger three/four times after page completion: http://pastebin.com/JejVYArq, the entire viewport turns grey afterwards.
Comment 4 Chris Lord [:cwiiis] 2011-12-16 08:57:13 PST
Going to the same website and pinch-zooming in all manner of ways, I can't reproduce this. The error almost certainly originates in PanZoomController though...

Does this happen almost immediately after you lift your fingers, some time shortly after lifting your fingers, or during the gesture? Are you zooming in or out when it happens? (is it consistent in one direction?)
Comment 5 Kartikaya Gupta (email:kats@mozilla.com) 2011-12-16 09:51:46 PST
Also, in cases like this the first instance of the exception in the log is the most useful, since that indicates where the internal state got corrupted initially. Once it gets corrupted we're just going to get a billion of the exceptions all over the place which aren't too useful.
Comment 6 Aaron Train [:aaronmt] 2011-12-16 10:37:32 PST
E/GeckoLayerController( 3885): staktrace: {"zoom":0.23032048344612122,"offsetY":0,"offsetX":0,"pageHeight":37768.203125,"pageWidth":689.7726440429688,"height":680.999267578125,"width":480.0028076171875,"y":-135.07655334472656,"x":-78.1390151977539}
E/GeckoLayerController( 3885): java.lang.Exception
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.gfx.LayerController.scrollBy(LayerController.java:196)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.ui.PanZoomController.updatePosition(PanZoomController.java:574)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.ui.PanZoomController.track(PanZoomController.java:485)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.ui.PanZoomController.onTouchMove(PanZoomController.java:332)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.ui.PanZoomController.onTouchEvent(PanZoomController.java:244)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.gfx.LayerController.onTouchEvent(LayerController.java:361)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.gfx.LayerView.onTouchEvent(LayerView.java:92)
E/GeckoLayerController( 3885): 	at android.view.View.dispatchTouchEvent(View.java:3885)
E/GeckoLayerController( 3885): 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
E/GeckoLayerController( 3885): 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
E/GeckoLayerController( 3885): 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
E/GeckoLayerController( 3885): 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
E/GeckoLayerController( 3885): 	at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1691)
E/GeckoLayerController( 3885): 	at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1125)
E/GeckoLayerController( 3885): 	at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
E/GeckoLayerController( 3885): 	at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1675)
E/GeckoLayerController( 3885): 	at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2194)
E/GeckoLayerController( 3885): 	at android.view.ViewRoot.handleMessage(ViewRoot.java:1878)
E/GeckoLayerController( 3885): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/GeckoLayerController( 3885): 	at android.os.Looper.loop(Looper.java:130)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.GeckoApp$28.run(GeckoApp.java:1403)
E/GeckoLayerController( 3885): 	at android.os.Handler.handleCallback(Handler.java:587)
E/GeckoLayerController( 3885): 	at android.os.Handler.dispatchMessage(Handler.java:92)
E/GeckoLayerController( 3885): 	at android.os.Looper.loop(Looper.java:130)
E/GeckoLayerController( 3885): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
E/GeckoLayerController( 3885): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/GeckoLayerController( 3885): 	at java.lang.reflect.Method.invoke(Method.java:507)
E/GeckoLayerController( 3885): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/GeckoLayerController( 3885): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/GeckoLayerController( 3885): 	at dalvik.system.NativeStart.main(Native Method)
E/GeckoLayerController( 3885): staktrace: {"zoom":0.23032048344612122,"offsetY":0,"offsetX":0,"pageHeight":37768.203125,"pageWidth":689.7726440429688,"height":680.999267578125,"width":480.0028076171875,"y":-135.07655334472656,"x":-78.1390151977539}
E/GeckoLayerController( 3885): java.lang.Exception
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.gfx.LayerController.scrollBy(LayerController.java:196)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.ui.PanZoomController.updatePosition(PanZoomController.java:574)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.ui.PanZoomController.fling(PanZoomController.java:495)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.ui.PanZoomController.onTouchEnd(PanZoomController.java:362)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.ui.PanZoomController.onTouchEvent(PanZoomController.java:245)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.gfx.LayerController.onTouchEvent(LayerController.java:361)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.gfx.LayerView.onTouchEvent(LayerView.java:92)
E/GeckoLayerController( 3885): 	at android.view.View.dispatchTouchEvent(View.java:3885)
E/GeckoLayerController( 3885): 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
E/GeckoLayerController( 3885): 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
E/GeckoLayerController( 3885): 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
E/GeckoLayerController( 3885): 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
E/GeckoLayerController( 3885): 	at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1691)
E/GeckoLayerController( 3885): 	at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1125)
E/GeckoLayerController( 3885): 	at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
E/GeckoLayerController( 3885): 	at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1675)
E/GeckoLayerController( 3885): 	at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2194)
E/GeckoLayerController( 3885): 	at android.view.ViewRoot.handleMessage(ViewRoot.java:1878)
E/GeckoLayerController( 3885): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/GeckoLayerController( 3885): 	at android.os.Looper.loop(Looper.java:130)
E/GeckoLayerController( 3885): 	at org.mozilla.gecko.GeckoApp$28.run(GeckoApp.java:1403)
E/GeckoLayerController( 3885): 	at android.os.Handler.handleCallback(Handler.java:587)
E/GeckoLayerController( 3885): 	at android.os.Handler.dispatchMessage(Handler.java:92)
E/GeckoLayerController( 3885): 	at android.os.Looper.loop(Looper.java:130)
E/GeckoLayerController( 3885): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
E/GeckoLayerController( 3885): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/GeckoLayerController( 3885): 	at java.lang.reflect.Method.invoke(Method.java:507)
E/GeckoLayerController( 3885): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/GeckoLayerController( 3885): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/GeckoLayerController( 3885): 	at dalvik.system.NativeStart.main(Native Method)
I/GeckoSoftwareLayerClient( 3885): Adjusting viewport
I/Gecko   ( 3885): AndroidGeckoEvent: 0x40649af0 : 19
E/GeckoViewportMetrics( 3885): Error serializing viewportmetrics
E/GeckoViewportMetrics( 3885): org.json.JSONException: Forbidden numeric value: NaN
E/GeckoViewportMetrics( 3885): 	at org.json.JSON.checkDouble(JSON.java:25)
E/GeckoViewportMetrics( 3885): 	at org.json.JSONObject.numberToString(JSONObject.java:684)
E/GeckoViewportMetrics( 3885): 	at org.json.JSONStringer.value(JSONStringer.java:284)
E/GeckoViewportMetrics( 3885): 	at org.mozilla.gecko.gfx.ViewportMetrics.toJSON(ViewportMetrics.java:245)
E/GeckoViewportMetrics( 3885): 	at org.mozilla.gecko.gfx.LayerController.scrollBy(LayerController.java:196)
E/GeckoViewportMetrics( 3885): 	at org.mozilla.gecko.ui.PanZoomController.updatePosition(PanZoomController.java:574)
E/GeckoViewportMetrics( 3885): 	at org.mozilla.gecko.ui.PanZoomController.access$500(PanZoomController.java:69)
E/GeckoViewportMetrics( 3885): 	at org.mozilla.gecko.ui.PanZoomController$FlingRunnable.run(PanZoomController.java:650)
E/GeckoViewportMetrics( 3885): 	at android.os.Handler.handleCallback(Handler.java:587)
E/GeckoViewportMetrics( 3885): 	at android.os.Handler.dispatchMessage(Handler.java:92)
E/GeckoViewportMetrics( 3885): 	at android.os.Looper.loop(Looper.java:130)
E/GeckoViewportMetrics( 3885): 	at org.mozilla.gecko.GeckoApp$28.run(GeckoApp.java:1403)
E/GeckoViewportMetrics( 3885): 	at android.os.Handler.handleCallback(Handler.java:587)
E/GeckoViewportMetrics( 3885): 	at android.os.Handler.dispatchMessage(Handler.java:92)
E/GeckoViewportMetrics( 3885): 	at android.os.Looper.loop(Looper.java:130)
E/GeckoViewportMetrics( 3885): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
E/GeckoViewportMetrics( 3885): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/GeckoViewportMetrics( 3885): 	at java.lang.reflect.Method.invoke(Method.java:507)
E/GeckoViewportMetrics( 3885): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/GeckoViewportMetrics( 3885): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/GeckoViewportMetrics( 3885): 	at dalvik.system.NativeStart.main(Native Method)
Comment 7 Kartikaya Gupta (email:kats@mozilla.com) 2011-12-16 10:43:47 PST
For those missing the IRC context: The above log is from a debugging that logs the viewport and call stack every time the viewport in the LayerController is touched in any way. But it's only a small sample of the log, taken before the viewport gets corrupted.
Comment 8 Aaron Train [:aaronmt] 2011-12-16 10:57:18 PST
Ful log from startup http://people.mozilla.com/~atrain/mobile/log.log (~1.0MB)
Comment 9 Aaron Train [:aaronmt] 2011-12-16 11:02:29 PST
Created attachment 582322 [details]
full console log (~1.0MB)
Comment 10 Kartikaya Gupta (email:kats@mozilla.com) 2011-12-16 13:31:51 PST
Created attachment 582376 [details] [diff] [review]
Patch
Comment 11 Patrick Walton (:pcwalton) 2011-12-17 10:26:55 PST
Comment on attachment 582376 [details] [diff] [review]
Patch

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

r+
Comment 12 Kartikaya Gupta (email:kats@mozilla.com) 2011-12-19 06:28:46 PST
Landed on inbound:

https://hg.mozilla.org/integration/mozilla-inbound/rev/e6179f497b74
Comment 13 Matt Brubeck (:mbrubeck) 2011-12-19 11:17:29 PST
https://hg.mozilla.org/mozilla-central/rev/e6179f497b74
Comment 14 Aaron Train [:aaronmt] 2011-12-20 08:44:22 PST
Created attachment 583187 [details]
Nightly (12/20) - raw log

Still seeing this on today's builds. End result yields the same grey viewport:

See attached log --

--
Samsung Nexus S (Android 4.0.3)
Mozilla/5.0 (Android; Linux armv7l; rv:11.0a1) Gecko/20111220 Firefox/11.0a1 Fennec/11.0a1
Comment 15 Kartikaya Gupta (email:kats@mozilla.com) 2011-12-20 10:51:17 PST
Yay for logging!

D/GeckoPanZoomController( 7462): onScale in state PINCHING
D/GeckoLayerController( 7462): scrollBy: v=RectF(1.7895129E12, -2.4967287E12, 1.7895129E12, -2.4967287E12) p=(1.1843142E12,1.4329959E14) z=1.1742355E9 o=0.0,0.0
D/GeckoLayerController( 7462): scaleWithFocus: v=RectF(Infinity, -Infinity, Infinity, -Infinity) p=(Infinity,Infinity) z=Infinity o=0.0,0.0; zf=Infinity

Pretty clear the code in onScale is to blame, and it looks like this might be happening because detector.getPreviousSpan() is returning approximately zero. Patch forthcoming. I also noticed that a pinch followed by a fling without lifting one of the pinch fingers doesn't re-bounce, which allows the zoom scale to grow without bound. I'll have a patch for that as well.
Comment 16 Kartikaya Gupta (email:kats@mozilla.com) 2011-12-20 12:05:04 PST
Created attachment 583243 [details] [diff] [review]
Guard against a zero prev-span
Comment 17 Kartikaya Gupta (email:kats@mozilla.com) 2011-12-20 12:15:52 PST
> I also noticed that a pinch followed by a fling
> without lifting one of the pinch fingers doesn't re-bounce, which allows the
> zoom scale to grow without bound. I'll have a patch for that as well.

I ended up filing bug 712386 for this instead, as the issue seemed more complex than I first thought.
Comment 18 Patrick Walton (:pcwalton) 2011-12-20 14:00:51 PST
Comment on attachment 583243 [details] [diff] [review]
Guard against a zero prev-span

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

Might want to mention the bug number in the comment. r=me with that.
Comment 19 Kartikaya Gupta (email:kats@mozilla.com) 2011-12-20 14:18:31 PST
> Might want to mention the bug number in the comment.

Done in the patch I landed:

https://hg.mozilla.org/integration/mozilla-inbound/rev/f7985b04a587
Comment 20 Ed Morley [:emorley] 2011-12-21 04:30:48 PST
https://hg.mozilla.org/mozilla-central/rev/f7985b04a587
Comment 21 Aaron Train [:aaronmt] 2011-12-21 08:12:20 PST
Samsung Galaxy SII (Android 2.3.4)
20111221041234
http://hg.mozilla.org/mozilla-central/rev/d6b976e83811
Comment 22 Kartikaya Gupta (email:kats@mozilla.com) 2012-01-12 20:15:30 PST
Comment on attachment 583243 [details] [diff] [review]
Guard against a zero prev-span

This patch is missing from aurora

[Approval Request Comment]
Regression caused by (bug #): none
User impact if declined: Viewport goes grey and remains that way
Testing completed (on m-c, etc.): on m-c for a long time
Risk to taking this patch (and alternatives if risky): Very low risk.
Comment 23 Alex Keybl [:akeybl] 2012-01-12 22:24:21 PST
Comment on attachment 583243 [details] [diff] [review]
Guard against a zero prev-span

[Triage Comment]
Mobile only - approving for Aurora.
Comment 24 Mark Finkle (:mfinkle) (use needinfo?) 2012-01-16 22:55:59 PST
https://hg.mozilla.org/releases/mozilla-aurora/rev/dc4c0564e017

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