Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANR when startingKoin with lazyModules #2072

Open
shabinder-singh opened this issue Dec 12, 2024 · 1 comment
Open

ANR when startingKoin with lazyModules #2072

shabinder-singh opened this issue Dec 12, 2024 · 1 comment
Labels
coroutines question Usage question status:cant_reproduce Can't reproduce the case status:wait_feedback Need more details or follow-up
Milestone

Comments

@shabinder-singh
Copy link
Contributor

Describe the bug
Encountering an ANR when starting koin with lazyModules.

Expected behavior

  • No ANR

Koin module and version:

  • koin-core:4.0.0

Snippet or Sample project to help reproduce
Add a snippet or even a small sample project to hel reproduce your case.

startKoin {
      androidLogger()
      androidContext(this@App)
      lazyModules(sharedModules, vmModule, localModule, dispatcher = ioDispatcher)
      modules(addOtherModule())
      fragmentFactory()
      workManagerFactory()
}

StackTrace:

main (runnable):tid=1 systid=19489 
       at kotlinx.coroutines.scheduling.DefaultIoScheduler.toString(Dispatcher.kt:94)
       at java.lang.String.valueOf(String.java:2924)
       at java.lang.StringBuilder.append(StringBuilder.java:132)
       at org.koin.core.coroutine.KoinCoroutinesEngine.onRegister(KoinCoroutinesEngine.java:47)
       at org.koin.core.extension.ExtensionManager.registerExtension(ExtensionManager.java:40)
       at org.koin.core.extension.KoinCoroutinesExtensionKt.coroutinesEngine(KoinCoroutinesExtension.kt:36)
       at org.koin.core.KoinApplicationLazyExtKt.lazyModules(KoinApplicationLazyExt.kt:39)
       at com.org.myapp.App.onCreate$lambda$0(App.java:53)
@arnaudgiuliani arnaudgiuliani added this to the 4.0.1 milestone Dec 12, 2024
@arnaudgiuliani arnaudgiuliani added type:issue coroutines status:checking currently in analysis - discussion or need more detailed specs labels Dec 12, 2024
@arnaudgiuliani
Copy link
Member

arnaudgiuliani commented Dec 17, 2024

Couldn't reproduce that on our sample apps. This is pointing to Dispatchers.IO string builder. Do you have more details or can you share your code?

StrictMode.setThreadPolicy(
            StrictMode.ThreadPolicy.Builder()
                .detectDiskReads()
                .detectDiskWrites()
                .detectAll() // or .detectAll() for all detectable problems
                .penaltyLog()
                .build()
        )
        StrictMode.setVmPolicy(
            StrictMode.VmPolicy.Builder()
                .detectLeakedSqlLiteObjects()
                .detectLeakedClosableObjects()
                .penaltyLog()
                .penaltyDeath()
                .build()
        )

@arnaudgiuliani arnaudgiuliani added question Usage question status:wait_feedback Need more details or follow-up status:cant_reproduce Can't reproduce the case and removed type:issue status:checking currently in analysis - discussion or need more detailed specs labels Dec 17, 2024
@arnaudgiuliani arnaudgiuliani modified the milestones: 4.0.1, 4.1.0 Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coroutines question Usage question status:cant_reproduce Can't reproduce the case status:wait_feedback Need more details or follow-up
Projects
None yet
Development

No branches or pull requests

2 participants