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

Maximum call stack size exceeded in compose multiplatform application #2041

Open
Tooto opened this issue Oct 30, 2024 · 4 comments
Open

Maximum call stack size exceeded in compose multiplatform application #2041

Tooto opened this issue Oct 30, 2024 · 4 comments

Comments

@Tooto
Copy link

Tooto commented Oct 30, 2024

Describe the bug
I have crash only in wasm part of project. Same code works well on android and desktop.
Log:
Maximum call stack size exceeded RangeError: Maximum call stack size exceeded at <AppKardaz:composeApp>.kotlin.CharArray.<init> (http://localhost:8080/composeApp.wasm:wasm-function[11100]:0x2c6d40) at <AppKardaz:composeApp>.kotlin.collections.copyOfUninitializedElements (http://localhost:8080/composeApp.wasm:wasm-function[15715]:0x2e4b69) at <AppKardaz:composeApp>.kotlin.collections.copyOfUninitializedElements (http://localhost:8080/composeApp.wasm:wasm-function[15714]:0x2e4b08) at <AppKardaz:composeApp>.kotlin.collections.copyOf (http://localhost:8080/composeApp.wasm:wasm-function[15713]:0x2e4afb) at <AppKardaz:composeApp>.kotlin.text.StringBuilder.ensureCapacityInternal (http://localhost:8080/composeApp.wasm:wasm-function[6370]:0x288c7d) at <AppKardaz:composeApp>.kotlin.text.StringBuilder.ensureExtraCapacity (http://localhost:8080/composeApp.wasm:wasm-function[6369]:0x288c36) at <AppKardaz:composeApp>.kotlin.text.StringBuilder.append (http://localhost:8080/composeApp.wasm:wasm-function[6335]:0x2880fc) at <AppKardaz:composeApp>.org.koin.core.definition.BeanDefinition.toString (http://localhost:8080/composeApp.wasm:wasm-function[52006]:0x619ecb) at <AppKardaz:composeApp>.kotlin.toString (http://localhost:8080/composeApp.wasm:wasm-function[11244]:0x2c83f4) at <AppKardaz:composeApp>.kotlin.text.StringBuilder.append (http://localhost:8080/composeApp.wasm:wasm-function[6326]:0x287fe5)

To Reproduce
I have this code:

fun appModule() = module {
    single<ProjectRepository> { DefaultProjectRepository() }
    single<SignInComponent.Factory> {
        DefaultSignInComponent.Factory()
    }
    single<RootComponent.Factory> {
        DefaultRootComponent.Factory(
            signInComponentFactory = get(),
        )
    }
}

And its crashed only in wasm part.
When i change
signInComponentFactory = get(),
to
signInComponentFactory = DefaultSignInComponent,
everething works well.

Code of DefaultSignInComponent:

class DefaultSignInComponent(
    componentContext: ComponentContext,
    private val onShowProjects: () -> Unit,
) : SignInComponent, ComponentContext by componentContext {
    override fun onShowProjectsClicked() {
        onShowProjects()
    }
    class Factory(
    ) : SignInComponent.Factory {
        override fun invoke(
            componentContext: ComponentContext,
            onShowProjects: () -> Unit
        ): SignInComponent {
            return DefaultSignInComponent(
                componentContext = componentContext,
                onShowProjects = onShowProjects
            )
        }
    }
}

Koin module and version:
koin-core:4.0.0
koin-compose:4.0.0 (but without koin compose everything is the same)

@arnaudgiuliani arnaudgiuliani added the question Usage question label Nov 15, 2024
@arnaudgiuliani
Copy link
Member

I don't see link to Koin library here 🤔 Do you have more details on stack trace?

@Tooto
Copy link
Author

Tooto commented Nov 28, 2024

I don't see link to Koin library here 🤔 Do you have more details on stack trace?

Its all log.

part with koin in log:
at <AppKardaz:composeApp>.org.koin.core.definition.BeanDefinition.toString

@liuhongjian0316
Copy link

koin-bug

@arnaudgiuliani arnaudgiuliani added type:issue wasm/js and removed question Usage question labels Jan 16, 2025
@arnaudgiuliani
Copy link
Member

Do you have a sample project to help run that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants