Skip to content

[CRITICAL ISSUE] setIdentity became blocking since 5.20.0 #1338

@andriishpek-sigma

Description

@andriishpek-sigma

Describe the bug

Starting with 5.20.0 setIdentity method started using requestQueue_ + handleNewRequest which internally blocks caller's non-main thread. In my specific case it causes app startup to freeze for ~15 seconds.

Latest 5.20.3 has the same issue.

Steps to reproduce

  1. Call Branch.getAutoInstance(context).setIdentity(userId) from a background thread
  2. Thread is blocked until setIdentity completes

Expected behavior

Thread is not blocked; Branch uses different internal thread pool to execute tasks

SDK Version

5.20.3

Make and Model

Emulator Pixel 9 Pro

OS

16.0

Additional Information/Context

Tested with this code:

Timber.tag("TestTest").d("Getting instance ${LocalTime.now()}")
val instance = Branch.getAutoInstance(context)
Timber.tag("TestTest").d("Setting identity ${LocalTime.now()}")
instance.setIdentity(it)
Timber.tag("TestTest").d("Identity set ${LocalTime.now()}")

5.20.0 - 5.20.3:

Getting instance 12:59:53.960
Setting identity 12:59:53.960
Identity set 13:00:09.463

5.19.0:

Getting instance 13:00:39.611
Setting identity 13:00:39.611
Identity set 13:00:39.611

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions