Jakub Wiśniewski
10/10/2022, 2:41 PMComposeView
within my application. I’ve dug trough all the sources and still cannot find the cause od the problem. TLDR version of it is that I have a list with error view on top of it that contains “refresh” button. Clicking it with my internet off (so that the view will appear) makes my app crash with bunch of compose related logs that do not point in any direction such as:
java.lang.ArrayIndexOutOfBoundsException: length=3; index=3 -> ViewGroup
java.lang.IllegalArgumentException: Failed requirement -> androidx.compose.ui.node.MeasureAndLayoutDelegate
java.lang.IllegalArgumentException: Failed requirement -> androidx.compose.ui.platform.AndroidComposeView.notifyLayerIsDirty
java.lang.IllegalStateException: Underflow in restore - more restores than saves
Exception Type: Unknown (SIGSEGV)
What is important to mention is that it only happens on RELEASE version of the App.
I’ve dissected my app and trying to reproduce the issue on fresh repo but I wasn’t able to, yet.
No such problems when I switch to ComponentActivity
instead of Fragment
with ComposeView
as its only view.
I don’t have unusual amount of recompositions either - around 2 for state.
Would appreciate any kind of help, guidance, ideas what might be the source of my problem.Zach Klippenstein (he/him) [MOD]
10/11/2022, 4:38 AMJakub Wiśniewski
10/11/2022, 7:11 AMcompose_ui_version = "1.3.0-beta03"
compose_lifecycle_version = "2.6.0-alpha02"
Jakub Wiśniewski
10/11/2022, 7:19 AMJakub Wiśniewski
10/11/2022, 9:23 AMComponentActivity
Zach Klippenstein (he/him) [MOD]
10/11/2022, 12:12 PMJakub Wiśniewski
10/11/2022, 12:44 PMJakub Wiśniewski
10/11/2022, 1:01 PMNoInternetException
(its a domain simplification for UnknownHostException, SocketTimeoutException, ConnectException, NoRouteToHostException) so I’ve swapped my repository implementation of list fetch to always return throw NoInternetException
on the API calls. As it turns out the app does not crash.Zach Klippenstein (he/him) [MOD]
10/11/2022, 3:50 PMNoInternetException
?Jakub Wiśniewski
10/11/2022, 5:26 PMStateFlow
connected via collectAsStateWithLifecycle
. As I’ve mentioned NoInternetException
is just a domain wrapper for some of the Exceptions thrown when offline.Jakub Wiśniewski
10/11/2022, 5:26 PMoverride suspend fun getSales(
type: String,
limit: Int,
offset: Int,
): Page<SalesProduct> =
throw NoInternetException()
Jakub Wiśniewski
10/11/2022, 5:27 PMZach Klippenstein (he/him) [MOD]
10/11/2022, 5:54 PMJakub Wiśniewski
10/11/2022, 7:10 PMclass NoInternetException : DomainException(null)
abstract class DomainException(override val message: String?) : RuntimeException()
This is parent so lowest is RuntimeExceptionJakub Wiśniewski
10/12/2022, 10:06 AMjava.lang.IllegalStateException: Recording currently in progress - missing #endRecording() call?
Zach Klippenstein (he/him) [MOD]
10/12/2022, 3:13 PMZach Klippenstein (he/him) [MOD]
10/12/2022, 3:14 PMJakub Wiśniewski
10/12/2022, 3:33 PMinline fun <R> runSuspendCatching(block: () -> R): Result<R> {
return try {
Result.success(block())
} catch (cancel: CancellationException) {
throw cancel
} catch (throwable: Throwable) {
Result.failure(throwable)
}
}
But the whole point of it is to rethrow CancellationExceptionZach Klippenstein (he/him) [MOD]
10/12/2022, 3:35 PMJakub Wiśniewski
10/12/2022, 3:36 PM.map { pageInfo ->
runSuspendCatching {
useCase()
}.getOrElse { PageResult.Error(it) }
}.onEach { .. }
Jakub Wiśniewski
10/12/2022, 3:37 PMZach Klippenstein (he/him) [MOD]
10/12/2022, 3:46 PMJakub Wiśniewski
10/12/2022, 3:47 PMZach Klippenstein (he/him) [MOD]
10/12/2022, 3:49 PMJakub Wiśniewski
10/12/2022, 3:49 PMJakub Wiśniewski
10/12/2022, 3:53 PMMutableStateSnapshot
and View.updateDisplayListIfDirty
Jakub Wiśniewski
10/14/2022, 8:10 AMZach Klippenstein (he/him) [MOD]
10/15/2022, 12:11 AMJakub Wiśniewski
10/19/2022, 11:12 AMZach Klippenstein (he/him) [MOD]
10/19/2022, 2:49 PMJakub Wiśniewski
10/19/2022, 2:50 PMromtsn
11/30/2022, 9:42 AMJakub Wiśniewski
12/05/2022, 8:23 AMadeyds
09/11/2023, 11:34 AMadeyds
09/11/2023, 11:34 AMadeyds
09/11/2023, 11:35 AMromtsn
09/11/2023, 11:35 AMJakub Wiśniewski
09/11/2023, 11:36 AMJakub Wiśniewski
09/11/2023, 11:36 AMadeyds
09/11/2023, 11:37 AM