Closed Bug 711453 Opened 12 years ago Closed 12 years ago

Error serializing viewportmetrics org.json.JSONException: Forbidden numeric value: NaN @ org.json.JSON.checkDouble(JSON.java:25)

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Android
defect
Not set
major

Tracking

(firefox11 fixed, firefox12 fixed, fennec11+)

VERIFIED FIXED
Firefox 12
Tracking Status
firefox11 --- fixed
firefox12 --- fixed
fennec 11+ ---

People

(Reporter: aaronmt, Assigned: kats)

References

()

Details

(Keywords: regression, reproducible)

Attachments

(4 files)

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
Whiteboard: [QA^]
Summary: Error serializing viewportmetrics @ org.json.JSONException: Forbidden numeric value: NaN → Error serializing viewportmetrics org.json.JSONException: Forbidden numeric value: NaN @ org.json.JSON.checkDouble(JSON.java:25)
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.
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)
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.
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?)
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.
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)
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.
Ful log from startup http://people.mozilla.com/~atrain/mobile/log.log (~1.0MB)
Attached patch PatchSplinter Review
Assignee: nobody → bugmail.mozilla
Status: NEW → ASSIGNED
Attachment #582376 - Flags: review?(pwalton)
Comment on attachment 582376 [details] [diff] [review]
Patch

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

r+
Attachment #582376 - Flags: review?(pwalton) → review+
https://hg.mozilla.org/mozilla-central/rev/e6179f497b74
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
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
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
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.
> 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 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.
Attachment #583243 - Flags: review?(pwalton) → review+
> 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
https://hg.mozilla.org/mozilla-central/rev/f7985b04a587
Status: REOPENED → RESOLVED
Closed: 12 years ago12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 12
Samsung Galaxy SII (Android 2.3.4)
20111221041234
http://hg.mozilla.org/mozilla-central/rev/d6b976e83811
Status: RESOLVED → VERIFIED
Whiteboard: [QA^]
tracking-fennec: --- → ?
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.
Attachment #583243 - Flags: approval-mozilla-aurora?
Comment on attachment 583243 [details] [diff] [review]
Guard against a zero prev-span

[Triage Comment]
Mobile only - approving for Aurora.
Attachment #583243 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.