-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to handle java.lang.IllegalStateException at RealAppSyncCall.java:383 #153
Comments
@palpatim @desokroshan any updates? |
@DeMoss15 Thanks for reporting the issue. Can you please share some specific reproduction steps such as relevant code snippet and average number of mutations you are running. Any other information that you think you think might help reproduce this issue? |
Hi @desokroshan Our app is facing the same issue. We can't reproduce it but got that crash after our app rolled out to users. Here is what I found in the AwsAppSync code: In the RealAppSyncCall.java, it has this method responseCallback() `private synchronized Optional<Callback> responseCallback() { switch (state.get()) { As you can see if the state is TERMINATED -> it will throw out an error "CallState.IllegalStateMessage.forCurrentState(state.get()).expected(ACTIVE, CANCELED));" The above method is called in 2 places: onResponse() and onFetch() callbacks in interceptorCallbackProxy() method. Because onResponse() and onFetch() didn't catch errors in responseCallback() so if somehow the state is TERMINATED, it will crash the app. @desokroshan is it possible to catch and throw it out to the user via this callback |
We're seeing this issue on a daily basis for our Android users. Unfortunately, I cannot provide a straight-forward way on how to reproduce it but we'll try to provide you with as much detail as we can. The curious detail is that the exception is thrown only across Samsung devices that run Android 11 and when the app is on background, across 100% all cases that we've collected through Firebase Crashlytics. We've seen this crash 79 times in 37 users on a beta test group of around 2k users. We're planning to roll out this app to a much larger user-base. This is a persistent issue we have had with AppSync and still see it. We've already tried switching back to several older versions, tried the new v3.1.4 as well but the problem is present on all of them. Since the problem is present on Samsung devices / Android 11 while on background, I'd recommend that you read https://dontkillmyapp.com/samsung as the cause may be that the OS is limiting the background work the app can do. If you were to explain a bit further why we would be seeing this error, I'd be able to bring more insights on why this would be happening. We use several mutations (20+?) and queries as well. |
Hello. Are there any update about this? I'm facing the same issue. |
same here |
Fatal Exception: java.lang.IllegalStateException |
Fatal Exception: java.lang.IllegalStateException: Expected: TERMINATED, but found [ACTIVE, CANCELED] |
This occurs to us too, this happens often enough during our testing.
We saw the following crash occurring intermittently: 10-22 08:10:33.485 20188 22030 E AndroidRuntime: java.lang.IllegalStateException: Expected: TERMINATED, but found [ACTIVE, CANCELED] We also observed the crash occuring more often when we set lower values of mutationQueueExecutionTimeout |
Hi @desokroshan , doing a code review of version 3.3.2, i found certain race conditions where 2 threads read from the queue and handle the same mutation in parallel. This seems to be tied to setting mutationQueueExecutionTimeout to a low number like 200ms and triggering 2 mutations per second. I am reproduce it very consistently with the above configuration. I suspect the mutationQueueExecutionTimeout doesn't cancel the previous mutation completely allowing it to continue execution and restarts the same mutation in a new thread (after reading the same mutation from the top of either the persistent or memory queue). |
@cbommas
Hello.
We've caught exception very similar to issue #65 with similar stacktrace on executing a lot of mutations but on AppSync 2.7.8:
The text was updated successfully, but these errors were encountered: