Skip to content
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

Application has crashes when using Gson library in multithreading environment on Android 3.2 (Acer a100) #403

Closed
GoogleCodeExporter opened this issue Mar 19, 2015 · 8 comments

Comments

@GoogleCodeExporter
Copy link

We use Gson library 2.0 in our application and find that it is unstable in 
multithreading environment on Acer A100 device (Android 3.2) - see test 
application, that crashed every time with different type of exceptions on A100 
if we use several threads. If we call fromJson method in one thread or use 
syncronized block on it - it's work fine. On other device and on Android 3.2 
emulator test application work fine independently on treads count.

P.S. in test app we apply fix from Issue 255 
(http://code.google.com/p/google-gson/issues/detail?id=255), but original gson 
lib have the same behaviour on Acer A100.

Original issue reported on code.google.com by effectiv...@gmail.com on 31 Jan 2012 at 8:48

Attachments:

@GoogleCodeExporter
Copy link
Author

You need to apply the fix from 255. I recommend jarjar; others have had success 
with proguard.

Original comment by limpbizkit on 31 Jan 2012 at 1:56

  • Changed state: Duplicate

@GoogleCodeExporter
Copy link
Author

we apply this fix (255), but nothing changes - the app still crashes on Acer 
A100 devices

Original comment by effectiv...@gmail.com on 1 Feb 2012 at 6:20

@GoogleCodeExporter
Copy link
Author

Can you paste a stacktrace? I don't have an A100 to test with.

Original comment by jessewil...@google.com on 2 Feb 2012 at 6:36

@GoogleCodeExporter
Copy link
Author

yes, we have several acer devices and we can test all proposed solutions or 
prepare additional information about this issue

Original comment by effectiv...@gmail.com on 2 Feb 2012 at 7:08

Attachments:

@GoogleCodeExporter
Copy link
Author

Can you still reproduce on Gson 2.1? Some classes from your stacktrace like 
ModifierBasedExclusionStrategy don't exist in Gson 2.1.

Original comment by limpbizkit on 2 Feb 2012 at 7:13

@GoogleCodeExporter
Copy link
Author

The device is broken and should be returned to the manufacturer. 
ModifierBasedExclusionStrategy.shouldSkipField doesn't even call 
ArrayList.add(). 

02-02 10:05:35.500: E/AndroidRuntime(1352): 
java.lang.ArrayIndexOutOfBoundsException: index=1081965120 length=0
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
java.util.ArrayList.add(ArrayList.java:124)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.ModifierBasedExclusionStrategy.shouldSkipField(ModifierBasedEx
clusionStrategy.java:42)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.DisjunctionExclusionStrategy.shouldSkipField(DisjunctionExclus
ionStrategy.java:38)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.Gson$1.deserializeField(Gson.java:225)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(Refl
ectiveTypeAdapterFactory.java:107)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTy
peAdapterFactory.java:65)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.internal.bind.MiniGson.getAdapter(MiniGson.java:92)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.internal.bind.ArrayTypeAdapter$1.create(ArrayTypeAdapter.java:
45)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.internal.bind.MiniGson.getAdapter(MiniGson.java:92)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(Reflective
TypeAdapterFactory.java:75)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(Re
flectiveTypeAdapterFactory.java:74)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(Refl
ectiveTypeAdapterFactory.java:112)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTy
peAdapterFactory.java:65)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.internal.bind.MiniGson.getAdapter(MiniGson.java:92)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.Gson.fromJson(Gson.java:719)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.Gson.fromJson(Gson.java:686)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.Gson.fromJson(Gson.java:636)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.google.myjson.Gson.fromJson(Gson.java:608)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
com.gson.test.JsontestActivity$ParseRunnable.run(JsontestActivity.java:86)
02-02 10:05:35.500: E/AndroidRuntime(1352):     at 
java.lang.Thread.run(Thread.java:1020)

Original comment by limpbizkit on 2 Feb 2012 at 7:20

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

unfortunately, gson-2.1 also crashed on Acer (see attached). We have several 
Acer a100 devices and all of them has the same problems with gson, all other 
application work normally - we think the manufacturer will not accept claims 
for non-working device based on one issue.

Original comment by effectiv...@gmail.com on 3 Feb 2012 at 8:22

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant