awslabs / aws-mobile-appsync-sdk-android

Android SDK for AWS AppSync.
https://docs.amplify.aws/sdk/api/graphql/q/platform/android/
Apache License 2.0
105 stars 58 forks source link

fix: ApolloServerInterceptor httpCall is now cloned to prevent "Illeg… #386

Open reguez opened 2 years ago

reguez commented 2 years ago

fix: ApolloServerInterceptor HTTP call is now cloned to prevent "IllegalStateException: Already executed"

Issue #, if available: IllegalStateException is raised when a Call is used multiple times

Description of changes: use call.clone().enqueue(..) for Asynchronous and call.clone().execute() for Synchronous respectively to ensure that you have a fresh, unexecuted Call for each request.

Screen Shot 2022-03-23 at 1 41 43 PM
gpanshu commented 2 years ago

@reguez can you please identify how you trigger the issue so that we can test your solution out? Specifically what you are trying to do, how do you call the api (in what context) and please add some sample code if you can.

reguez commented 2 years ago

@gpanshu Sadly I wasn't able to reproduce the issue myself but one of the users did. I was able to extract the log from crashlytics Fatal Exception: java.lang.IllegalStateException: Already Executed at okhttp3.internal.connection.RealCall.enqueue(RealCall.kt:161) at com.apollographql.apollo.internal.interceptor.ApolloServerInterceptor$1.run(ApolloServerInterceptor.java:91) 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:920)

 Other than that I couldn't pinpoint the source origin from my code base
oussama-reguez commented 2 years ago

@gpanshu when can we expect an update? Multiple clients are experiencing this issue.

poojamat commented 2 years ago

@oussama-reguez could you please provide steps for reproduction?

oussama-reguez commented 2 years ago

@poojamat as explained here I couldn't reproduce the issue but from crashlytics, I see multiple crash logs