Search code examples
xstreamoptaplanner

optaplanner stack overflow exception when saving planing result


when I try to save planing vehicle routing result for 665 customers (using "Save as.. " button) I get stack-overflow exception :

Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError: null
    at com.thoughtworks.xstream.mapper.MapperWrapper.isImmutableValueType(MapperWrapper.java:42)
    at com.thoughtworks.xstream.mapper.MapperWrapper.isImmutableValueType(MapperWrapper.java:42)
    at com.thoughtworks.xstream.mapper.MapperWrapper.isImmutableValueType(MapperWrapper.java:42)
    at com.thoughtworks.xstream.mapper.MapperWrapper.isImmutableValueType(MapperWrapper.java:42)
    at com.thoughtworks.xstream.mapper.MapperWrapper.isImmutableValueType(MapperWrapper.java:42)
    at com.thoughtworks.xstream.mapper.MapperWrapper.isImmutableValueType(MapperWrapper.java:42)
    at com.thoughtworks.xstream.mapper.MapperWrapper.isImmutableValueType(MapperWrapper.java:42)
    at com.thoughtworks.xstream.mapper.MapperWrapper.isImmutableValueType(MapperWrapper.java:42)
    at com.thoughtworks.xstream.mapper.MapperWrapper.isImmutableValueType(MapperWrapper.java:42)

with 10 (or more) customers less (655 or less) it is working properly. Any ideas what is wrong

the exception looks different in different casees, at first I tought it is some wierd character (which drives xml serialization crazy - as it was xml serialization methods on call stack), so I replaced all adresses with ids. than I tought that it is maybe if the adresses in nodes area do not have uniqe name - but that was not the case. I also tried 32 and 64 bit java but that did not help eather.

complete stack of last attempt is here https://dl.dropboxusercontent.com/u/10874009/stack-overflow-exception.txt and this is zip of my vrp file, exception is 100% repordoucable with thid data set https://dl.dropboxusercontent.com/u/10874009/generated-n666-k36.zip

I am using binaries from : optaplanner-distribution-6.4.0.Final thanks in advance


Solution

  • Once the VRP dataset becomes a certain size, the linked list structure triggers a stackoverflow in XStream. At that size the XML format becomes very verbose too: for example 10k customers in XML format can take GB's of disk space... Best to export as a txt format when persisting big cases to disk (or store them in a database). See VehicleRoutingSolutionFileIO.