FHIR Core / OpenSRP 2 is a Kotlin application for delivering offline-capable, mobile-first healthcare project implementations from local community to national and international scale using FHIR and WHO Smart Guidelines on Android.
Below is the error thrown
Work [ id=c393e90f-e6b8-46dc-a6ab-d25bf9d9ce6f, tags={ org.smartregister.fhircore.engine.sync.AppSyncWorker } ] failed because it threw an exception/error java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Detected a cycle. at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue(AbstractFuture.java:515) at androidx.work.impl.utils.futures.AbstractFuture.get(AbstractFuture.java:474) at androidx.work.impl.WorkerWrapper$2.run(WorkerWrapper.java:316) at androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012) Caused by: java.lang.IllegalStateException: Detected a cycle. at com.google.android.fhir.sync.upload.patch.PatchOrdering.createTopologicalOrderedList$dfs(PatchOrdering.kt:131) at com.google.android.fhir.sync.upload.patch.PatchOrdering.createTopologicalOrderedList$dfs(PatchOrdering.kt:133) at com.google.android.fhir.sync.upload.patch.PatchOrdering.createTopologicalOrderedList$dfs(PatchOrdering.kt:133) at com.google.android.fhir.sync.upload.patch.PatchOrdering.createTopologicalOrderedList(PatchOrdering.kt:139) at com.google.android.fhir.sync.upload.patch.PatchOrdering.orderByReferences(PatchOrdering.kt:74) at com.google.android.fhir.sync.upload.patch.PatchOrdering$orderByReferences$1.invokeSuspend(Unknown Source:15) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Expected behavior
All created resources should sync to server
Screenshots
Additional context
Sample Task resource that hasn't synced
To Reproduce Steps to reproduce the behavior:
Below is the error thrown
Work [ id=c393e90f-e6b8-46dc-a6ab-d25bf9d9ce6f, tags={ org.smartregister.fhircore.engine.sync.AppSyncWorker } ] failed because it threw an exception/error java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Detected a cycle. at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue(AbstractFuture.java:515) at androidx.work.impl.utils.futures.AbstractFuture.get(AbstractFuture.java:474) at androidx.work.impl.WorkerWrapper$2.run(WorkerWrapper.java:316) at androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012) Caused by: java.lang.IllegalStateException: Detected a cycle. at com.google.android.fhir.sync.upload.patch.PatchOrdering.createTopologicalOrderedList$dfs(PatchOrdering.kt:131) at com.google.android.fhir.sync.upload.patch.PatchOrdering.createTopologicalOrderedList$dfs(PatchOrdering.kt:133) at com.google.android.fhir.sync.upload.patch.PatchOrdering.createTopologicalOrderedList$dfs(PatchOrdering.kt:133) at com.google.android.fhir.sync.upload.patch.PatchOrdering.createTopologicalOrderedList(PatchOrdering.kt:139) at com.google.android.fhir.sync.upload.patch.PatchOrdering.orderByReferences(PatchOrdering.kt:74) at com.google.android.fhir.sync.upload.patch.PatchOrdering$orderByReferences$1.invokeSuspend(Unknown Source:15) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Expected behavior All created resources should sync to server
Screenshots![Screenshot_20240419_160445_BidanKu](https://github.com/opensrp/fhircore/assets/36365043/6d7c1e4f-328c-4999-996a-ef252fbc23c7)
Additional context Sample Task resource that hasn't synced
A sample Careplan resource that hasn't synced