RuedigerMoeller / fast-serialization

FST: fast java serialization drop in-replacement
Apache License 2.0
1.59k stars 247 forks source link

Stackoverflow error when handling a JPDL template. #170

Open supertoy opened 7 years ago

supertoy commented 7 years ago

As the previous suggestion, i register a timestamp handling, but still get error when the template is big. Any suggestion ? There are 300 nodes in the templates object. when i run 100 times in one iteration with a thread sleep, , i found the first 3% will generate this error, but the remains are ok.

() - errors in serializing template objects to byte arrays, template id is 26: java.lang.StackOverflowError at org.nustaq.serialization.util.FSTInt2ObjectMap.putHash(FSTInt2ObjectMap.java:76) at org.nustaq.serialization.util.FSTInt2ObjectMap.put(FSTInt2ObjectMap.java:47) at org.nustaq.serialization.util.FSTInt2ObjectMap.resize(FSTInt2ObjectMap.java:126) at org.nustaq.serialization.util.FSTInt2ObjectMap.putHash(FSTInt2ObjectMap.java:54) at org.nustaq.serialization.util.FSTInt2ObjectMap.putNext(FSTInt2ObjectMap.java:85) at org.nustaq.serialization.util.FSTInt2ObjectMap.putHash(FSTInt2ObjectMap.java:76) at org.nustaq.serialization.util.FSTInt2ObjectMap.putNext(FSTInt2ObjectMap.java:85) at org.nustaq.serialization.util.FSTInt2ObjectMap.putHash(FSTInt2ObjectMap.java:76) at org.nustaq.serialization.util.FSTInt2ObjectMap.putNext(FSTInt2ObjectMap.java:85) at org.nustaq.serialization.util.FSTInt2ObjectMap.putHash(FSTInt2ObjectMap.java:76) at org.nustaq.serialization.util.FSTInt2ObjectMap.putNext(FSTInt2ObjectMap.java:85) at org.nustaq.serialization.util.FSTInt2ObjectMap.putHash(FSTInt2ObjectMap.java:76) at org.nustaq.serialization.util.FSTInt2ObjectMap.put(FSTInt2ObjectMap.java:47) at org.nustaq.serialization.util.FSTInt2ObjectMap.resize(FSTInt2ObjectMap.java:126) at org.nustaq.serialization.util.FSTInt2ObjectMap.putHash(FSTInt2ObjectMap.java:54) at org.nustaq.serialization.util.FSTInt2ObjectMap.put(FSTInt2ObjectMap.java:47) at org.nustaq.serialization.FSTObjectRegistry.registerObjectForRead(FSTObjectRegistry.java:123) at org.nustaq.serialization.FSTObjectInput.registerObject(FSTObjectInput.java:928) at org.nustaq.serialization.serializers.FSTArrayListSerializer.instantiate(FSTArrayListSerializer.java:61) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadWithSer(FSTObjectInput.java:497) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:366) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectInternal(FSTObjectInput.java:327) at org.nustaq.serialization.serializers.FSTMapSerializer.instantiate(FSTMapSerializer.java:78) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadWithSer(FSTObjectInput.java:497) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:366) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectInternal(FSTObjectInput.java:327) at org.nustaq.serialization.serializers.FSTArrayListSerializer.instantiate(FSTArrayListSerializer.java:63) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadWithSer(FSTObjectInput.java:497) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:366) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectInternal(FSTObjectInput.java:327) at org.nustaq.serialization.serializers.FSTArrayListSerializer.instantiate(FSTArrayListSerializer.java:63) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadWithSer(FSTObjectInput.java:497) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:366) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectInternal(FSTObjectInput.java:327) at org.nustaq.serialization.serializers.FSTArrayListSerializer.instantiate(FSTArrayListSerializer.java:63) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadWithSer(FSTObjectInput.java:497) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:366) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectInternal(FSTObjectInput.java:327) at org.nustaq.serialization.serializers.FSTArrayListSerializer.instantiate(FSTArrayListSerializer.java:63) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadWithSer(FSTObjectInput.java:497) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:366) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectInternal(FSTObjectInput.java:327) at org.nustaq.serialization.serializers.FSTArrayListSerializer.instantiate(FSTArrayListSerializer.java:63) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadWithSer(FSTObjectInput.java:497) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:366) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectFields(FSTObjectInput.java:708) at org.nustaq.serialization.FSTObjectInput.instantiateAndReadNoSer(FSTObjectInput.java:562) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:370) at org.nustaq.serialization.FSTObjectInput.readObjectInternal(FSTObjectInput.java:327) at org.nustaq.serialization.serializers.FSTArrayListSerializer.instantiate(FSTArrayListSerializer.java:63)

RuedigerMoeller commented 7 years ago

Hm .. strange. Deeply nested structures might run into Stackoverflow. However its strange this does not happen reliably.

possible reasons:

My HashMap implementation works recursive in case of hash-key collisions, so maybe bad hash keys can lead to heav< stack usage.

supertoy commented 7 years ago

hello, when can i get the enhancement?