rudderlabs / rudder-sdk-android

Android SDK for RudderStack - the Customer Data Platform for Developers.
https://www.rudderstack.com
Other
18 stars 29 forks source link

BUG : Serialisation happening on the main thread in EventRepository #395

Closed georgi-mirchev closed 4 months ago

georgi-mirchev commented 6 months ago

Describe the bug

Bug

Before - 1.21.0

Whenever our app started, we noticed a significant slowdown due to the Rudder SDK serialising objects on the main thread. This was explicitly visible in version 1.21.0 in the EventRepository where it used to have the onActivityStarted method.

Now - 1.21.3

GSON serialisation and specifically "application opened" tracking continues to happen in the main thread as can be seen in the link below:

https://github.com/rudderlabs/rudder-sdk-android/blob/develop/core/src/main/java/com/rudderstack/android/sdk/core/EventRepository.java#L356

If you check the trackApplicationOpened method in the lifecycle manager here -> https://github.com/rudderlabs/rudder-sdk-android/blob/67410eecf31b67542fa338a8f2b018b44c15f335/core/src/main/java/com/rudderstack/android/sdk/core/ApplicationLifeCycleManager.java#L93

you will see that upon application start, everything continues to happen in the main thread.

Proposed solution

Please move the GSON serialisation to happen in a separate thread.

georgi-mirchev commented 6 months ago

@itsdebs it is a serious issue. I am not sure why it takes 2 weeks to take a look at it.

desusai7 commented 6 months ago

Hi @georgi-mirchev,

Apologies for the delayed response on this, we will take a look at this right away and get back to you.

1abhishekpandey commented 5 months ago

Hey @georgi-mirchev, We have released a fix in the latest version 1.22.0. Could you please upgrade to this version and let us know if it resolves your issue?

1abhishekpandey commented 5 months ago

Hey @georgi-mirchev, Could you please inform us whether you are able to attempt the aforementioned solution and whether it resolves your issue or not?

1abhishekpandey commented 4 months ago

We are closing this. If the issue persists, please feel free to reopen it.