Sharing the crash logs
AWS s3 transfer utility causes crash. Have seen similar bug
https://github.com/aws-amplify/aws-sdk-android/issues/1093 in which it was suggested to remove "awss3transfertable.db"which i have not tried. But I have tried updating to the latest version but still issues are reported..
Caused by java.lang.NumberFormatException
For input string: "ANY"
sun.misc.FloatingDecimal.readJavaFormatString (FloatingDecimal.java:2043)
sun.misc.FloatingDecimal.parseDouble (FloatingDecimal.java:110)
java.lang.Double.parseDouble (Double.java:538)
com.google.gson.stream.JsonReader.nextInt (JsonReader.java:186)
com.google.gson.internal.bind.TypeAdapters$7.a (TypeAdapters.java:13)
com.google.gson.internal.bind.TypeAdapters$7.read (TypeAdapters.java)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.a (ReflectiveTypeAdapterFactory.java:2)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.a (ReflectiveTypeAdapterFactory.java:47)
com.google.gson.Gson.a (Gson.java:20)
com.google.gson.Gson.a (Gson.java:4)
com.google.gson.Gson.a (Gson.java:9)
com.google.gson.Gson.assertFullConsumption (Gson.java)
com.amazonaws.mobileconnectors.s3.transferutility.TransferRecord.a (TransferRecord.java:422)
com.amazonaws.mobileconnectors.s3.transferutility.TransferDBUtil.getTransferById (TransferDBUtil.java:16)
com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility.a (TransferUtility.java:20)
com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility.a (TransferUtility.java:2)
com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility.a (TransferUtility.java:23)
Hi @sougandhmp ,
There may be a potential issue with how GSON de/serializes TransferNetworkConnectionType in the Android SDK for S3 when the code is obfuscated. Would you be able to try modifying your proguard configuration as following?
Hi @raphkim,
Thanks for the suggestion, I have added -keepclassmembers enum * { *; } to the proguard rules. I will be checking crash is happening again for this reason.
Hi @raphkim ,
Is there something that can be done, other than adding "-keepclassmembers enum * { *; } " to pro-guard rules?.Please note the issue was not reported for fresh users. Further more, the issue seems to recur for specific users.
Any help would be appreciated.
Have you tried deleting "awss3transfertable.db"? If the issue is only recurring for some people, I think it may be possible for the database to be corrupted.
Hi @raphkim , @palpatim
I have not tried deleting "awss3transfertable.db". I have already mentioned it in the description of bug.
Since the issue was only happening for few production users i was not able to reproduce and check the issue.
I would suggest clearing the transfer database before moving forward. Once the database is corrupted, the issue will persist as long as the app continues to access it.
@sougandhmp, did you try deleting the "awss3transfertable.db"? any updates on your end?
@raphkim. I'm having the same issue and I'm not using obfuscation. Here's the stacktrace:
Caused by java.lang.NumberFormatException: Invalid double: "ANY"
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.initialParse(StringToReal.java:164)
at java.lang.StringToReal.parseDouble(StringToReal.java:282)
at java.lang.Double.parseDouble(Double.java:301)
at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1201)
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:226)
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:218)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.Gson.fromJson(Gson.java:927)
at com.google.gson.Gson.fromJson(Gson.java:892)
at com.google.gson.Gson.fromJson(Gson.java:841)
at com.google.gson.Gson.fromJson(Gson.java:813)
at com.amazonaws.mobileconnectors.s3.transferutility.TransferRecord.updateFromDB(TransferRecord.java:159)
at com.amazonaws.mobileconnectors.s3.transferutility.TransferDBUtil.getTransferById(TransferDBUtil.java:865)
at com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility.submitTransferJob(TransferUtility.java:901)
at com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility.pause(TransferUtility.java:772)
at com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility.pauseAllWithType(TransferUtility.java:787)
SDK Version: 2.16.5
Noticed that happens mostly on Samsung devices with Android 10
Since I can't reproduce either, do you have some idea how this can be reproducible? Furthermore, about deleting the "awss3transfertable.db":
Thanks
Hi @svanegas,
No I couldn't verify the solution since I was not able to reproduce the crash.
@TrekSoft, @desokroshan, @palpatim, @raphkim. Guys, I'm still facing this issue and it's becoming now a big deal in production. Could anyone please assign to corresponding person and reopen this ticket?
Stack trace is above, and as I mentioned, occurs mostly on Samsung devices with Android 10.
Could you please explain me how could I implement a workaround or solve this issue?
Thanks
Hi @svanegas ,
I apologize for pre-maturely closing the issue. It seems to me that most people that have experienced this issue were able to resolve their issue by deleting their in-memory transfer data "awss3transfertable.db". This is the database that stores all of the ongoing transfers in the app so that the information is not lost upon closing the app.
This database can be deleted by using Context#deleteDatabase(String) method and using "awss3transfertable.db" as the argument. However, I would advise against using this regularly inside the app outside of the context of explicitly clearing data.
I will further investigate the issue to see what we can do to mitigate the corruption of database.
@svanegas would you be able to check if you have minifyEnabled set to true inside your build.gradle file?
@raphkim. Thank you for reply.
Yes, minifyEnabled is true.
I was getting ready to release soon a prod version that uses deleteDatabase("awss3transfertable.db") in the onCreate() of the Application class as a temporary workaround. But then I saw that you advise against using it this way.
Do you think the deletion of the database every time app is opened would affect something else? What do you think could be done better?
For future reference, minifyEnabled = true will obfuscate your code ;)
Deleting the database in the onCreate() method would remove the transfer information every time the app is exited, which defeats the purpose of keeping a persistent record of the ongoing transfers. This issue should ideally be resolved once the corrupted table is deleted once (outside of the app's lifecycle), and should not require it to be deleted thereafter.
For future reference,
minifyEnabled = truewill obfuscate your code ;)Deleting the database in the
onCreate()method would remove the transfer information every time the app is exited, which defeats the purpose of keeping a persistent record of the ongoing transfers. This issue should ideally be resolved once the corrupted table is deleted once (outside of the app's lifecycle), and should not require it to be deleted thereafter.
@raphkim. Okay, so do you think a good strategy would be: Catch this exception, when this happens, delete database. It might be enough, right?
There may be a potential issue with how GSON de/serializes
TransferNetworkConnectionTypein the Android SDK for S3 when the code is obfuscated. Would you be able to try modifying your proguard configuration as following?
While deleting database upon gson failure would be a good temporary workaround, I suggest that you verify the above solution first for a more permanent solution. With the temporary solution you've provided, a user experiencing this issue will inexplicably lose data on all of the ongoing/past transfers
Thanks @raphkim.
I already had this config, actually:
-keepnames class com.amazonaws.**
-keepnames class com.amazon.**
We will see how it behaves with database deletion workaround!
Here is the full config that you should use when enabling proguard:
https://github.com/aws-amplify/aws-sdk-android/blob/master/Proguard.md
Also -keepclassmembers enum * { *; } would be the required config to resolve this particular issue.
Most helpful comment
Here is the full config that you should use when enabling proguard:
https://github.com/aws-amplify/aws-sdk-android/blob/master/Proguard.md
Also
-keepclassmembers enum * { *; }would be the required config to resolve this particular issue.