Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle executor errors #365

Merged
merged 3 commits into from
Mar 14, 2019
Merged

Handle executor errors #365

merged 3 commits into from
Mar 14, 2019

Conversation

andrlee
Copy link
Contributor

@andrlee andrlee commented Mar 14, 2019

Problem:
Ran on crash while doing pre-release testing with maps sdk test app. MapSnapshotter test chocked up the executor's queue and resulted in the its crash:

    Process: com.mapbox.mapboxsdk.testapp, PID: 11852
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mapbox.mapboxsdk.testapp/com.mapbox.mapboxsdk.testapp.activity.fragment.MultiMapActivity}: android.view.InflateException: Binary XML file line #59: Binary XML file line #59: Error inflating class fragment
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2679)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2740)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1487)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6164)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
     Caused by: android.view.InflateException: Binary XML file line #59: Binary XML file line #59: Error inflating class fragment
     Caused by: android.view.InflateException: Binary XML file line #59: Error inflating class fragment
     Caused by: java.util.concurrent.RejectedExecutionException: Task com.mapbox.android.telemetry.MapboxTelemetry$4@cb9ad20 rejected from java.util.concurrent.ThreadPoolExecutor@48ea6d9[Running, pool size = 3, active threads = 3, queued tasks = 0, completed tasks = 1]

Solution:
Use more robust and universal for this use case LinkedBlockingQueue when events need to sit in the high priority queue and wait for the immediate delivery. Handle executor's errors.

Test:
Re-tested with maps sdk test app.

@codecov
Copy link

codecov bot commented Mar 14, 2019

Codecov Report

Merging #365 into master will decrease coverage by 0.02%.
The diff coverage is 66.66%.

@@             Coverage Diff              @@
##             master     #365      +/-   ##
============================================
- Coverage        57%   56.98%   -0.03%     
  Complexity      488      488              
============================================
  Files           101      101              
  Lines          3154     3157       +3     
  Branches        215      215              
============================================
+ Hits           1798     1799       +1     
- Misses         1269     1271       +2     
  Partials         87       87

@andrlee andrlee merged commit 30deb7c into master Mar 14, 2019
@andrlee andrlee deleted the al-executor-crash branch March 28, 2019 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants