Skip to content

Troubleshooting

Overview of common issues.

Request Gets Timeout But Response Is Returned

Problem: Sometimes an HTTP request gets java.net.SocketTimeoutException on the app after sending it, despite mobile services sending back the response correctly. Thus the error is not shown in mobile services logs or network traces.

Workaround: The reason for the timeout exception is, when there are many parallel HTTP requests sent to mobile services, the server may not be able to handle them in time. To solve this, the client code needs to set a large timeout value for read and write operations. See OkHttpClient for additional information on timeouts.

OkHttpClient okHttpClient = new OkHttpClient.Builder()
        .addInterceptor(...)
        .connectTimeout(60, TimeUnit.SECONDS)
        .readTimeout(60, TimeUnit.SECONDS)
        .writeTimeout(60, TimeUnit.SECONDS)
        .build();
ClientProvider.set(okHttpClient);

Last update: October 30, 2020