Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

FlushTheEventsTask borked #5470

Closed
Closed

Description

@ivovandongen

The latest 4.1.0-SNAPSHOT logs the following message:

06-24 18:38:39.462 21952-26026/co.human.android E/MapboxEventManager: FlushTheEventsTask borked: org.json.JSONException: Forbidden numeric value: NaN
06-24 18:38:39.463 21952-26026/co.human.android W/System.err: org.json.JSONException: Forbidden numeric value: NaN
06-24 18:38:39.505 21952-26026/co.human.android W/System.err:     at org.json.JSON.checkDouble(JSON.java:25)
06-24 18:38:39.506 21952-26026/co.human.android W/System.err:     at org.json.JSONObject.put(JSONObject.java:262)
06-24 18:38:39.507 21952-26026/co.human.android W/System.err:     at org.json.JSONObject.putOpt(JSONObject.java:276)
06-24 18:38:39.507 21952-26026/co.human.android W/System.err:     at com.mapbox.mapboxsdk.telemetry.MapboxEventManager$FlushTheEventsTask.doInBackground(MapboxEventManager.java:621)
06-24 18:38:39.507 21952-26026/co.human.android W/System.err:     at com.mapbox.mapboxsdk.telemetry.MapboxEventManager$FlushTheEventsTask.doInBackground(MapboxEventManager.java:585)
06-24 18:38:39.508 21952-26026/co.human.android W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:295)
06-24 18:38:39.508 21952-26026/co.human.android W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
06-24 18:38:39.509 21952-26026/co.human.android W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
06-24 18:38:39.509 21952-26026/co.human.android W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
06-24 18:38:39.509 21952-26026/co.human.android W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-24 18:38:39.511 21952-26026/co.human.android W/System.err:     at java.lang.Thread.run(Thread.java:818)

No crashes though.

Activity

  1. added
    Android
    on Jun 24, 2016
  2. ivovandongen commented on Jun 24, 2016

    @ivovandongen
    ContributorAuthor
  3. zugaldia commented on Jun 27, 2016

    @zugaldia
    Member

    /cc: @bleege

  4. bleege commented on Jun 27, 2016

    @bleege
    Contributor

    Thanks for spotting this @ivovandongen. This is a blocker to 4.1.0 Final. I'll pick it up.

  5. added this to the android-v4.1.0 milestone on Jun 27, 2016
  6. self-assigned this
    on Jun 27, 2016
  7. bleege commented on Jun 27, 2016

    @bleege
    Contributor

    The code that matches up with the stacktrace points to MapboxEventManager.java:621 is related to sending the event's latitude information in to the server (see code block below). This data is generated from the stock Android Location.getLatitude(). According to the documentation if the Location is generated by the stock LocationManager there will always be "valid latitude".

    The next step is to learn more about how the App in question is generating Location data as well as adding an explicit NaN check to Latitude and Longitude to keep the SDK from trying to send data like this. The good news is that SDK behaved exactly as required in this situation in that it handled the error but did not crash the app.

    // Line 621
    jsonObject.putOpt(MapboxEvent.KEY_LATITUDE, evt.get(MapboxEvent.KEY_LATITUDE));

    screen shot 2016-06-27 at 12 26 48 pm

  8. added a commit that references this issue on Jun 27, 2016
  9. bleege commented on Jun 27, 2016

    @bleege
    Contributor

    I found out from @ivovandongen that the App generates Location data using the stock Android Location API, Google Play Services Location API, and Google Fit. This means that the data sources are going to be pretty reliable / consistent in terms of what is presented. Since the crash itself actually occurred at the JSONObject level I added checks for NaN and Infinite values for latitude, longitude, and altitude during the Location Event processing to make the whole process more efficient. The result is if any of those 3 values are NaN or Infinite then the Location event is ignored and not processed, thus keeping the JSONObject from having troubles per it's documentation.

  10. bleege commented on Jun 27, 2016

    @bleege
    Contributor

    I just merged this into the release-android-v4.1.0 branch and will now kick off a new SNAPSHOT so that we can make use of it sooner.

    screen shot 2016-06-27 at 2 11 39 pm

  11. ivovandongen commented on Jul 15, 2016

    @ivovandongen
    ContributorAuthor

    @bleege Just had another one. Is this merged back in master correctly?

    07-15 18:07:09.770 18827-22372/com.mapbox.mapboxsdk.testapp E/MapboxEventManager: FlushTheEventsTask borked: org.json.JSONException: Forbidden numeric value: NaN
    07-15 18:07:09.771 18827-22372/com.mapbox.mapboxsdk.testapp W/System.err: org.json.JSONException: Forbidden numeric value: NaN
    07-15 18:07:09.771 18827-22372/com.mapbox.mapboxsdk.testapp W/System.err:     at org.json.JSON.checkDouble(JSON.java:25)
    07-15 18:07:09.772 18827-22372/com.mapbox.mapboxsdk.testapp W/System.err:     at org.json.JSONObject.put(JSONObject.java:262)
    07-15 18:07:09.772 18827-22372/com.mapbox.mapboxsdk.testapp W/System.err:     at org.json.JSONObject.putOpt(JSONObject.java:276)
    07-15 18:07:09.772 18827-22372/com.mapbox.mapboxsdk.testapp W/System.err:     at com.mapbox.mapboxsdk.telemetry.MapboxEventManager$FlushTheEventsTask.doInBackground(MapboxEventManager.java:631)
    07-15 18:07:09.773 18827-22372/com.mapbox.mapboxsdk.testapp W/System.err:     at com.mapbox.mapboxsdk.telemetry.MapboxEventManager$FlushTheEventsTask.doInBackground(MapboxEventManager.java:595)
    07-15 18:07:09.774 18827-22372/com.mapbox.mapboxsdk.testapp W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:295)
    07-15 18:07:09.775 18827-22372/com.mapbox.mapboxsdk.testapp W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    07-15 18:07:09.775 18827-22372/com.mapbox.mapboxsdk.testapp W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
    07-15 18:07:09.780 18827-22372/com.mapbox.mapboxsdk.testapp W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    07-15 18:07:09.781 18827-22372/com.mapbox.mapboxsdk.testapp W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    07-15 18:07:09.781 18827-22372/com.mapbox.mapboxsdk.testapp W/System.err:     at java.lang.Thread.run(Thread.java:818)
    
  12. bleege commented on Jul 19, 2016

    @bleege
    Contributor

    @ivovandongen Which version of the SDK are you seeing this on?

  13. bleege commented on Jul 19, 2016

    @bleege
    Contributor

    Also #5682 found some extra NaN issues related to Gestures and is now in master.

  14. ivovandongen commented on Jul 21, 2016

    @ivovandongen
    ContributorAuthor

    @bleege This was on master.

  15. bleege commented on Jul 25, 2016

    @bleege
    Contributor

    @ivovandongen Are you still experiencing this on master or have things smoothed out since #5682 was introduced?

  16. ivovandongen commented on Jul 26, 2016

    @ivovandongen
    ContributorAuthor

    @bleege Haven't been on master recently or actively running the test-app. Will need to do that soon anyway to work on examples, I'll let you know.

  17. zugaldia commented on Sep 22, 2016

    @zugaldia
    Member

    We haven't seen this recently, closing. Feel free to reopen if the problem resurfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Androidbug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions