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.

SSL handshake time out when loading style results in black screen #4090

Closed

Description

@Trinea

Sometimes map is black when initing about Android SDK, logs are:
The first case log is:

mbgl: {Map}[Setup]: loading style failed: failed to connect to api.mapbox.com/54.230.156.179 (port 443) after 10000ms

The second case log is:

mbgl: {Map}[Setup]: loading style failed: SSL handshake timed out

The third case log is:

mbgl: {Map}[Setup]: loading style failed: timeout

bug screenshot:

Activity

  1. added
    Android
    on Feb 24, 2016
  2. tobrun commented on Feb 25, 2016

    @tobrun
    Member

    Removing android tag, since this is something related to core and will have also have impact on iOS.

  3. changed the title [-]map is black when failed to connect to api.mapbox.com about Android SDK[/-] [+]SSL handshake time out when loading style results in black screen[/+] on Feb 25, 2016
  4. removed
    Android
    on Feb 25, 2016
  5. Trinea commented on Feb 25, 2016

    @Trinea
    Author

    Hi, @tobrun , Does this bug will be resolved in 4.0.0?

  6. tobrun commented on Feb 25, 2016

    @tobrun
    Member

    @Trinea I have never seen this bug locally here or haven't seen any reports by other users. Since the message indicates a timeout, this has something to do with a bad internet connection and should not occur during normal usage.

    • How often do you see this?
  7. Trinea commented on Feb 26, 2016

    @Trinea
    Author

    Hi, @tobrun I am in China, so there may be a little delay of network.

    But it's ok most of the time, it occurs our morning 10:00-11:00 about and 3:00-4:00 pm often, Is your server tuning this time. Our timezone twelve hours faster than you.

  8. Trinea commented on Mar 1, 2016

    @Trinea
    Author

    @tobrun Whether you tuning server of api.mapbox.com sometimes, so cannot connect to api.mapbox.com then.

    I thought you can tested when api.mapbox.com is not connected, then the map will black.

  9. Trinea commented on Mar 8, 2016

    @Trinea
    Author

    @tobrun

    E/mbgl: {Map}[Style]: Failed to load source composite: failed to connect to api.mapbox.com/54.230.127.31 (port 443) after 10000ms
    

    Map is black again, log is above, network is ok

  10. tobrun commented on Mar 8, 2016

    @tobrun
    Member

    Been looking into the issue and what we do in cases of timeouts.

    When such a connection problem occurs we pass a CONNECTION_ERROR down to mbgl:

     @Override
        public void onFailure(Call call, IOException e) {
            Log.w(LOG_TAG, String.format("[HTTP] Request could not be executed: %s", e.getMessage()));
    
            int type = PERMANENT_ERROR;
            if ((e instanceof UnknownHostException) || (e instanceof SocketException) || (e instanceof ProtocolException) || (e instanceof SSLException)) {
                type = CONNECTION_ERROR;
            } else if ((e instanceof InterruptedIOException)) {
                type = TEMPORARY_ERROR;
            }
    
            String errorMessage = e.getMessage() != null ? e.getMessage() : "Error processing the request";
    
            mLock.lock();
            if (mNativePtr != 0) {
                nativeOnFailure(type, errorMessage);
            }
            mLock.unlock();
        }

    In case of such an error we are retrying the request up to 3 times with an exponential back off.
    This will result in retrying in 1s, 2s, 4s and 16s. This is following the general standards related to timeouts and there is actually not much we can do in this case and circumvent this error would be a security risk because it means the other end cannot be trusted and the data could be intercepted by 3rd parties.

    There is off course the possibility to build a version of mbgl yourself that ignores this error but this is something we highly encourage you not to do due to security reasons mentioned above.

  11. zugaldia commented on Mar 11, 2016

    @zugaldia
    Member

    Hey @Trinea I'd love to gather more information on this issue. Is this timeout something that you're observing on a particular network?

    Also, we're releasing offline maps functionality soon, this could help mitigate the issue. You can find more information on the current functionality here: https://www.mapbox.com/help/mobile-offline/

  12. tobrun commented on Mar 14, 2016

    @tobrun
    Member

    @ianshward
    Could we have your 👀 on this?
    From SDK point of view we are doing the appropriate thing here.

  13. Trinea commented on Mar 14, 2016

    @Trinea
    Author

    @zugaldia it's ok most of the time, it occurs our morning 10:00-11:00 about and 3:00-4:00 pm often. Our timezone twelve hours faster than you.

    This may due to China's firewall

  14. added
    Android
    on Jun 6, 2016
  15. deleted a comment from lsc183183 on Mar 30, 2018
  16. leobut commented on Nov 5, 2019

    @leobut

    I also had this issue today at 13:27 UTC, Iceland - Android 9.

    Dependency: com.mapbox.mapboxsdk:mapbox-android-sdk:5.4.1

  17. zugaldia commented on Nov 12, 2019

    @zugaldia
    Member

    Thank you @ControlTheBit for the report. Considering the age of this ticket, could you open a new ticket including any information that could be useful to reproduce the issue on our end? Thanks!

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

    Androidsupport

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions