DataDog / dd-sdk-android-gradle-plugin

The Datadog Gradle Plugin for Android
Apache License 2.0
14 stars 9 forks source link

uploadMappingRelease sometimes leaks http connection & task ends up failing with timeout error #206

Open jamesbluecrow opened 1 year ago

jamesbluecrow commented 1 year ago

Describe what happened I often see errors when running uploadMappingRelease about a http connection being leaked. When that happens the task ends up failing after 5-8 minutes running with the log below:

A connection to https://sourcemap-intake.datadoghq.com/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);

> Task :app:uploadMappingRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:uploadMappingRelease'.
> Unable to upload mapping file with tags `service:"android-client-app"`, `version:4.2.22`, `variant:` because of a request timeout; check your network connection

Steps to reproduce the issue: No clear repro steps, it happens more often when I'm out and the internet connection is less reliable but it also happens sometimes at home with fast internet.

Describe what you expected: I think that either the task should succeed or the task should fail faster if the connection fails but there should not be a leaked connection.

Additional context

-keepnames class implements android.os.Parcelable -keepnames class implements java.io.Serializable

0xnm commented 1 year ago

Hello @jamesbluecrow! Thanks for reporting it. Can you please also share the full exception you have? You can run the task with --stacktrace flag to see it.

jamesbluecrow commented 1 year ago

@0xnm I've been trying to reproduce the error but no luck. I do see though the leaked connection message even now that the task is succeeding but there is no exception.

A connection to https://sourcemap-intake.datadoghq.com/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);

> Task :app:uploadMappingRelease
Mapping file upload successful with tags `service:"client-app"`, `version:version_name`, `variant:`. 
Make sure the SDK is initialized with the same values to ensure proper deobfuscation. Mapping files will be processed and ready within the next five minutes.

BUILD SUCCESSFUL in 2m