Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Error serializing ObjectMapper - StackOverflowError #4

Closed
barbeau opened this issue Nov 30, 2012 · 1 comment
Closed

Error serializing ObjectMapper - StackOverflowError #4

barbeau opened this issue Nov 30, 2012 · 1 comment
Labels

Comments

@barbeau
Copy link
Member

barbeau commented Nov 30, 2012

For some reason ObjectMapper serialization to a cache file on Android isn't working, even though it works fine on J2SE.

Here's the error:
11-30 14:15:48.308: I/dalvikvm(30482): threadid=20: stack overflow on call to Ljava/io/SerializationHandleMap;.findIndex:ILL
11-30 14:15:48.308: I/dalvikvm(30482): method requires 28+20+12=60 bytes, fp is 0x59106338 (56 left)
11-30 14:15:48.308: I/dalvikvm(30482): expanding stack end (0x59106300 to 0x59106000)
11-30 14:15:48.308: I/dalvikvm(30482): Shrank stack (to 0x59106300, curFrame is 0x591064c8)
11-30 14:15:48.308: W/dalvikvm(30482): threadid=20: thread exiting with uncaught exception (group=0x415b6438)
11-30 14:15:48.348: E/AndroidRuntime(30482): FATAL EXCEPTION: Thread-6998
11-30 14:15:48.348: E/AndroidRuntime(30482): java.lang.StackOverflowError
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.SerializationHandleMap.get(SerializationHandleMap.java:63)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.dumpCycle(ObjectOutputStream.java:425)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1566)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1612)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeNewArray(ObjectOutputStream.java:1205)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1662)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
11-30 14:15:48.348: E/AndroidRuntime(30482): at java.io.ObjectOutputStream.writeFiel

Code triggering the problem, which is executed by the SiriRestClientUI app via this library:
https://github.com/CUTR-at-USF/SiriRestClient/blob/master/src/edu/usf/cutr/siri/android/client/config/SiriJacksonConfig.java#L407

Comparable code on J2SE that works fine is:
https://github.com/CUTR-at-USF/SiriParserJacksonExample/blob/master/src/edu/usf/cutr/siri/util/SiriUtils.java#L718

@barbeau
Copy link
Member Author

barbeau commented Nov 30, 2012

This commit is a workaround, which is essentially increasing the stack size for the thread that the serialization for the ObjectMapper is happening in, using this Thread constructor:
http://developer.android.com/reference/java/lang/Thread.html#Thread(java.lang.ThreadGroup,
java.lang.Runnable, java.lang.String, long)

Apparently this stacksize parameter is implementation-dependent, though, so there is no guarantee that this will fix the issue on all Android devices:
http://stackoverflow.com/questions/7453336/setting-stack-size-to-thread-seems-to-make-no-difference-in-android

We're going to run with this for now, but it may need to be changed in
the future if there is an underlying issue with (de)serialization.

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

No branches or pull requests

1 participant