ExpediaGroup / graphql-kotlin

Libraries for running GraphQL in Kotlin

Home Page:https://opensource.expediagroup.com/graphql-kotlin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ConcurrentModificationException in KotlinDataLoaderRegistry.getCurrentFutures

Syer10 opened this issue · comments

Library Version
6.5.3

Describe the bug
I have a websocket in my GraphQL application that can send thousands of items per second, users don;t usually get this high, but one of my users reported and issue where sometimes they get an error where the path is null when the scheme says it is not null

{
  "type": "error",
  "id": "b26a4edf-f5c3-4bc0-881d-3d96390ae69e",
  "payload": [
    {
      "message": "The field at path '/downloadChanged' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value.  The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is 'DownloadStatus' within parent type 'Subscription'"
    }
  ]
}

I asked them to send me the debug logs and I found there were a few stacktraces, the field doesn't seem to matter, as it errors with different ones, but its always the same stacktrace.

To Reproduce
Steps to reproduce the behavior. Please provide:

Expected behavior
It sends data according to the scheme

2023-08-05 17:46:52.094117+00:0018:46:52.091 [DefaultDispatcher-worker-13] WARN notprivacysafe.graphql.execution.SimpleDataFetcherExceptionHandler -- Exception while fetching data (/downloadChanged/queue[1849]/manga/__typename) : null
2023-08-05 17:46:52.094128+00:00java.util.ConcurrentModificationException: null
2023-08-05 17:46:52.094139+00:00at java.base/java.util.HashMap$HashIterator.nextNode(Unknown Source)
2023-08-05 17:46:52.094149+00:00at java.base/java.util.HashMap$ValueIterator.next(Unknown Source)
2023-08-05 17:46:52.094161+00:00at java.base/java.util.AbstractCollection.toArray(Unknown Source)
2023-08-05 17:46:52.094171+00:00at java.base/java.util.ArrayList.addAll(Unknown Source)
2023-08-05 17:46:52.094182+00:00at kotlin.collections.CollectionsKt__MutableCollectionsKt.addAll(MutableCollections.kt:114)
2023-08-05 17:46:52.094193+00:00at kotlin.collections.CollectionsKt__IterablesKt.flatten(Iterables.kt:49)
2023-08-05 17:46:52.094204+00:00at com.expediagroup.graphql.dataloader.KotlinDataLoaderRegistry.getCurrentFutures(KotlinDataLoaderRegistry.kt:64)
2023-08-05 17:46:52.094215+00:00at com.expediagroup.graphql.dataloader.KotlinDataLoaderRegistry.dispatchAll(KotlinDataLoaderRegistry.kt:73)
2023-08-05 17:46:52.094226+00:00at graphql.execution.instrumentation.dataloader.FieldLevelTrackingApproach.dispatch(FieldLevelTrackingApproach.java:242)
2023-08-05 17:46:52.094237+00:00at graphql.execution.instrumentation.dataloader.DataLoaderDispatcherInstrumentation.immediatelyDispatch(DataLoaderDispatcherInstrumentation.java:97)
2023-08-05 17:46:52.094247+00:00at graphql.execution.instrumentation.dataloader.DataLoaderDispatcherInstrumentation.lambda$instrumentDataFetcher$0(DataLoaderDispatcherInstrumentation.java:91)
2023-08-05 17:46:52.094259+00:00at graphql.execution.ExecutionStrategy.invokeDataFetcher(ExecutionStrategy.java:309)
2023-08-05 17:46:52.094269+00:00at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:286)
2023-08-05 17:46:52.094281+00:00at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:212)
2023-08-05 17:46:52.094291+00:00at graphql.execution.AsyncExecutionStrategy.execute(AsyncExecutionStrategy.java:55)
2023-08-05 17:46:52.094302+00:00at graphql.execution.ExecutionStrategy.completeValueForObject(ExecutionStrategy.java:692)
2023-08-05 17:46:52.094312+00:00at graphql.execution.ExecutionStrategy.completeValue(ExecutionStrategy.java:471)
2023-08-05 17:46:52.094323+00:00at graphql.execution.ExecutionStrategy.completeField(ExecutionStrategy.java:422)
2023-08-05 17:46:52.094333+00:00at graphql.execution.ExecutionStrategy.lambda$resolveFieldWithInfo$1(ExecutionStrategy.java:214)
2023-08-05 17:46:52.094345+00:00at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
2023-08-05 17:46:52.094355+00:00at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
2023-08-05 17:46:52.094367+00:00at java.base/java.util.concurrent.CompletableFuture.complete(Unknown Source)
2023-08-05 17:46:52.094382+00:00at org.dataloader.DataLoaderHelper.lambda$dispatchQueueBatch$2(DataLoaderHelper.java:259)
2023-08-05 17:46:52.094393+00:00at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
2023-08-05 17:46:52.094418+00:00at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
2023-08-05 17:46:52.094437+00:00at java.base/java.util.concurrent.CompletableFuture.complete(Unknown Source)
2023-08-05 17:46:52.094449+00:00at kotlinx.coroutines.future.CompletableFutureCoroutine.onCompleted(Future.kt:57)
2023-08-05 17:46:52.094460+00:00at kotlinx.coroutines.AbstractCoroutine.onCompletionInternal(AbstractCoroutine.kt:93)
2023-08-05 17:46:52.094471+00:00at kotlinx.coroutines.JobSupport.tryFinalizeSimpleState(JobSupport.kt:296)
2023-08-05 17:46:52.094481+00:00at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:860)
2023-08-05 17:46:52.094492+00:00at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:832)
2023-08-05 17:46:52.094502+00:00at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:100)
2023-08-05 17:46:52.094513+00:00at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
2023-08-05 17:46:52.094524+00:00at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
2023-08-05 17:46:52.094536+00:00at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
2023-08-05 17:46:52.094546+00:00at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
2023-08-05 17:46:52.094557+00:00at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
2023-08-05 17:46:52.094568+00:00at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
2023-08-05 17:46:52.094579+00:00at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
2023-08-05 17:46:52.094590+00:00at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)