mapbox / mapbox/mapbox-maps-android

Crash java.lang.Error in MapboxHttpClient.request

Open
#2,698 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :beetle:
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

Environment

  • Android OS version: 7.0, 7.1.1, 8.1.0, 9.0, 11, 12
  • Devices affected: Motorola moto e6 play, moto e6s, Samsung Galaxy Tab A 9.7 (SM-T550) and others
  • Maps SDK Version: 11.16.6

Observed behavior and steps to reproduce

We noticed a crash started to happen after we updated the Maps SDK from 11.12.2 to 11.16.6.
We see it in our crash reporting system.
We were not able to reproduce it locally.

Stacktrace:

java.lang.Error: thread constructor failed: Try again
        at com.mapbox.common.SchedulerFactory.createSequenced(SchedulerFactory.java:-2)
        at com.mapbox.common.module.cronet.CronetClientDetail.buildRequestWithEngine(CronetClientDetail.kt:48)
        at com.mapbox.common.module.cronet.CronetClientDetail.buildRequest(CronetClientDetail.kt:33)
        at com.mapbox.common.module.MapboxHttpClient.request(MapboxHttpClient.kt:241)

Threads:

Thread 2 - main - (RUNNABLE)
        at com.mapbox.common.SchedulerFactory.createSequenced(SchedulerFactory.java:-2)
        at com.mapbox.common.module.cronet.CronetClientDetail.buildRequestWithEngine(CronetClientDetail.kt:48)
        at com.mapbox.common.module.cronet.CronetClientDetail.buildRequest(CronetClientDetail.kt:33)
        at com.mapbox.common.module.MapboxHttpClient.request(MapboxHttpClient.kt:241)

Thread null - [67 threads omitted as the maxReportedThreads limit (200) was exceeded] - (UNKNOWN)
        at (-)
...

Expected behavior

Crash shouldn't happen

Notes / preliminary analysis

As we can see from the stacktrace - this issue is related to the tread creation process. Apparently the maximum number of threads is exceeded.
Presumably there has to be the Throwable caught instead of an Exception.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with MapboxHttpClient.kt:241 and follow the request path through CronetClientDetail.kt:33 and :48 to SchedulerFactory.createSequenced, using the supplied stack trace as the failure path. Investigate how thread-creation failures are handled and verify that the reported crash no longer occurs under the excessive-thread condition.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.