awslabs / awslabs/aws-mobile-appsync-sdk-android

ConcurrentModificationException @ ApolloCacheInterceptor

Open
#357 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
106
Forks
56
PR merge metrics
No merged PRs in 30d

Description

AppSync SDK Version: 3.1.4 (latest as of Jul 7)

It's pretty straightforward. This should be all you need to fix but please let me know if you need anything.

**Stacktrace**
```
Fatal Exception: java.util.ConcurrentModificationException
at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:757)
at java.util.LinkedHashMap$LinkedValueIterator.next(LinkedHashMap.java:785)
at com.apollographql.apollo.internal.interceptor.ApolloCacheInterceptor$2.apply(ApolloCacheInterceptor.java:137)
at com.apollographql.apollo.internal.interceptor.ApolloCacheInterceptor$2.apply(ApolloCacheInterceptor.java:134)
at com.apollographql.apollo.api.internal.Present.map(Present.java:70)
at com.apollographql.apollo.internal.interceptor.ApolloCacheInterceptor.cacheResponse(ApolloCacheInterceptor.java:133)
at com.apollographql.apollo.internal.interceptor.ApolloCacheInterceptor.access$200(ApolloCacheInterceptor.java:43)
at com.apollographql.apollo.internal.interceptor.ApolloCacheInterceptor$1$1.onResponse(ApolloCacheInterceptor.java:81)
at com.apollographql.apollo.internal.interceptor.ApolloParseInterceptor$1.onResponse(ApolloParseInterceptor.java:71)
at com.apollographql.apollo.internal.interceptor.ApolloServerInterceptor$1$1.onResponse(ApolloServerInterceptor.java:100)
at okhttp3.RealCall$AsyncCall.run(RealCall.kt:140)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
```

Contributor guide

Open the contributing guide

Research direction

Start with ApolloCacheInterceptor.cacheResponse around line 137, identified in the stack trace, and inspect how the LinkedHashMap values are traversed. Reproduce the reported ConcurrentModificationException against AppSync SDK 3.1.4 if possible, then verify that the interceptor no longer throws during concurrent cache response handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, graphql, java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.