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

Crash: java.lang.IllegalStateException: Unsupported concurrent change during composition. A state object was modified by composition as well as being modified outside composition #2352

Closed
Caij opened this issue Jul 4, 2024 · 5 comments

Comments

@Caij
Copy link
Contributor

Caij commented Jul 4, 2024

version: 3.0.0-alpha07

when ImageLoader set interceptor Dispatcher, There may be crash issues.

demo: https://github.com/Caij/CoilDemo

Open the app, wait for the image load finish, and click hello

at androidx.compose.runtime.Recomposer.applyAndCheck(Recomposer.kt:1235)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1646)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:127)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:583)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:551)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1449)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1459)
at android.view.Choreographer.doCallbacks(Choreographer.java:1089)
at android.view.Choreographer.doFrame(Choreographer.java:998)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1431)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
@colinrtwhite
Copy link
Member

colinrtwhite commented Jul 4, 2024

Thanks for the repro project. Tracking the issue here.

@Caij
Copy link
Contributor Author

Caij commented Jul 5, 2024

@colinrtwhite Hello. The demo provided in my issue will definitely crash.
This is a new issue caused by #2205. I believe it shouldn't be in the 'not planned' status.

@Caij
Copy link
Contributor Author

Caij commented Jul 5, 2024

when ImageLoader set interceptor Dispatcher, onSuccess is dispatched in my custom dispatcher, So it might cause an issue with multi-threaded state modification.

image

@colinrtwhite
Copy link
Member

@Caij I think this should be fixed in 3.0.0-alpha08. alpha07 used Dispatchers.Unconfined, which could result in that behaviour.

@Caij
Copy link
Contributor Author

Caij commented Jul 11, 2024

thanks, I have tested using the latest version and there is no problem

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

No branches or pull requests

2 participants