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

App Sync SDK Crashing with java.lang.IllegalStateException

Open
#363 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
106
Forks
56
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
There is a crash in the interceptor for App Sync SDK in the class AppSyncSigV4SignerInterceptor.java line number 173
The chain request needs to be closed before it can be proceeded.

To Reproduce
Steps to reproduce the behavior:
The crash is random and happens generally when there is a retry request in place

Expected behavior
The SDK should not crash while trying to do a retry request.

Screenshots
Not applicable

Environment(please complete the following information):

  • AppSync SDK Version: 3.1.1

Device Information (please complete the following information):

  • Device: All
  • Android Version: All
  • Specific to simulators: No

Additional context
This came in because OKHttp used by AppSyncSDK for Networking request had a update. Details can be found here
https://github.com/square/okhttp/issues/4986

Crash log with details.
Fatal Exception: java.lang.IllegalStateException: cannot make a new request because the previous response is still open: please call response.close()
at okhttp3.internal.connection.Transmitter.newExchange$okhttp(Transmitter.java:157)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:35)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:112)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:87)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:82)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:112)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:87)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:84)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:112)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:71)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:112)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:87)
at com.amazonaws.mobileconnectors.appsync.sigv4.AppSyncSigV4SignerInterceptor.intercept(AppSyncSigV4SignerInterceptor.java:173)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in AppSyncSigV4SignerInterceptor.java at line 173 and review the retry path alongside the crash log and referenced OkHttp issue. Check how the previous response is handled before proceeding with a retry. Done means retry requests complete without the IllegalStateException on the supported AppSync SDK version.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.