Instabug-Android icon indicating copy to clipboard operation
Instabug-Android copied to clipboard

Instabug spawns and keeps threads even when not initialized or disabled

Open gpunto opened this issue 1 year ago • 2 comments

Steps to Reproduce the Problem

  1. Add Instabug as a dependency to a project without adding any initialization code
  2. Launch the app
  3. Check the existing threads, e.g. by debugging or by printing their names to the console

Expected Behavior

No Instabug thread exists if Instabug is not enabled.

Actual Behavior

Multiple Instabug threads exist. For example:

IBG-API-executor-0
IBG-SharedPrefs-0
IBG-core-io-executor-0
IBG-core-io-executor-1
IBG-v3-session-0

Instabug integration code

None. Adding an explicit call to Instabug.disable() yields the same behavior.

SDK Version

12.2.0

Android Version

Any.

Device Model

Any.

Project That Reproduces the Issue

I can upload a project if needed, but it would only contain these changes:

In the build script:

implementation("com.instabug.library:instabug:12.2.0")

In the Activity:

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        
        Instabug.disable()

        setContent {
            IBThreadsTheme {
                Button(onClick = {
                    Thread.getAllStackTraces().map { it.key.name }.sorted().forEach {
                        Log.i("hjkl", it)
                    }
                }) {
                    Text("Click")
                }
            }
        }
    }
}

gpunto avatar Oct 25 '23 11:10 gpunto

Hey @gpunto, Thanks for reporting this. Even if you didn't intialized Instabug yet I can see that you have been called the Instabug.disable() API which it's reasnoable to create some threads. However we will invistage more in the number of the created threads and get back to you soon.

MohamedHefny avatar Oct 25 '23 12:10 MohamedHefny

Hey @MohamedHefny, thanks for the response!

Please note that even without any references to Instabug code (so even without the call to Instabug.disable()) the behavior is the same. I'm guessing the threads are spawned by a content provider when the app is created and are never terminated.

In any case, thanks again, let me know if you need any other info!

gpunto avatar Oct 25 '23 13:10 gpunto