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

[Sync status] App crashes when sync status screen open and transitioning from "MEDIA_UPLOADED" to "COMPLETE" #2314

Closed
gino-m opened this issue Mar 7, 2024 · 6 comments
Labels
type: bug Something isn't working
Milestone

Comments

@gino-m
Copy link
Collaborator

gino-m commented Mar 7, 2024

After disabling Airplane mode:

From Crashlytics:

Fatal Exception: com.google.android.ground.persistence.local.LocalDataConsistencyException: Unknown jobId in submission mutation 1
       at com.google.android.ground.persistence.local.room.converter.ConverterExtKt.toModelObject(ConverterExt.kt:341)
       at com.google.android.ground.persistence.local.room.stores.RoomSubmissionStore$getAllSurveyMutationsFlow$$inlined$map$1$2.emit(Emitters.kt:224)
       at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
       at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
       at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:87)
       at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:66)
       at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
       at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
       at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(:14)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at android.os.Handler.handleCallback(Handler.java:959)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loopOnce(Looper.java:232)
       at android.os.Looper.loop(Looper.java:317)
       at android.app.ActivityThread.main(ActivityThread.java:8501)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)

Note that conversions shouldn't crash app. We should always catch all errors and return Result instead of bare values.

The data is uploaded, but the status screen then gets stuck with the following:

image

@scolsen FYI

@gino-m gino-m added the type: bug Something isn't working label Mar 7, 2024
@jcqli
Copy link
Contributor

jcqli commented Mar 8, 2024

@scolsen This is related to the sync status that you had worked on, do you have bandwidth to look into this by Wed?

@scolsen
Copy link
Contributor

scolsen commented Mar 12, 2024

We should always catch all errors and return Result instead of bare values.

Yes, definitely. I'd go so far as to say exceptions are now a code smell since we have error value types. In general, error value types will be much better for us given that we use functional streams extensively, which do not cohere well with exceptions.

In the meantime, I took a simpler route and just added a catch call. I'm not sure what the underlying cause is here. I've added some additional debugging to the error message in efforts to help repro—looking at the code, we just copy the previous mutation and only update its state, so it's not obvious to me where/why the Job ID would change if that's actually the cause of the exception here.

@jcqli
Copy link
Contributor

jcqli commented Mar 12, 2024

#2333 is a workaround for this crash, I'd like to leave this open so that we can get to the root issue (but considered "done" for the 3/13 freeze)

@jcqli
Copy link
Contributor

jcqli commented Mar 12, 2024

Based on my prev comment, going to pull this into iteration 7

@gino-m
Copy link
Collaborator Author

gino-m commented Aug 9, 2024

@scolsen I think this has already been fixed, can you kindly confirm?

@gino-m
Copy link
Collaborator Author

gino-m commented Aug 22, 2024

Closing as inactive.

@gino-m gino-m closed this as not planned Won't fix, can't repro, duplicate, stale Aug 22, 2024
@github-project-automation github-project-automation bot moved this to Done in Ground Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

3 participants