schemacrawler / SchemaCrawler

Free database schema discovery and comprehension tool
http://www.schemacrawler.com/
Other
1.62k stars 200 forks source link

Error during serialize: Comparison method violates its general contract! #191

Closed abstratt closed 6 years ago

abstratt commented 6 years ago

Environment

SchemaCrawler: 14.21.02 Java: 1.8.0_131 Linux Ubuntu 16.04.3 LTS Postgresql: 9.6.2

Issue

Running a "serialize" command fails with an exception:

java.lang.IllegalArgumentException: Comparison method violates its general contract!

Steps

schemacrawler.sh -command=serialize -infolevel=standard  -password=******** -user=darnlfmh -database=darnlfmh -host=stampy.db.elephantsql.com -server=postgresql -schemas="northwind" -o=my-offline-db.zip -routines= -tabletypes=table -loglevel=CONFIG

Result

SEVERE: Comparison method violates its general contract!
java.lang.IllegalArgumentException: Comparison method violates its general contract!
    at java.util.TimSort.mergeLo(TimSort.java:777)
    at java.util.TimSort.mergeAt(TimSort.java:514)
    at java.util.TimSort.mergeCollapse(TimSort.java:441)
    at java.util.TimSort.sort(TimSort.java:245)
    at java.util.Arrays.sort(Arrays.java:1512)
    at java.util.ArrayList.sort(ArrayList.java:1454)
    at java.util.Collections.sort(Collections.java:175)
    at schemacrawler.tools.integration.serialization.XmlSerializedCatalog$3.marshal(XmlSerializedCatalog.java:160)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:274)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:250)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.<init>(AbstractReflectionConverter.java:213)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:144)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:274)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:250)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.<init>(AbstractReflectionConverter.java:213)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:144)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1319)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1308)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:1281)
    at schemacrawler.tools.integration.serialization.XmlSerializedCatalog.save(XmlSerializedCatalog.java:301)
    at schemacrawler.tools.integration.serialization.SerializationExecutable.executeOn(SerializationExecutable.java:70)
    at schemacrawler.tools.executable.SchemaCrawlerExecutable.executeOn(SchemaCrawlerExecutable.java:123)
    at schemacrawler.tools.executable.BaseStagedExecutable.execute(BaseStagedExecutable.java:98)
    at schemacrawler.tools.commandline.SchemaCrawlerCommandLine.execute(SchemaCrawlerCommandLine.java:134)
    at schemacrawler.Main.main(Main.java:90)

Full log will be attached.

abstratt commented 6 years ago

sc.log

abstratt commented 6 years ago

I can no longer reproduce the issue, so it looks like an intermittent problem. I wonder if the fact that the comparison method is based on hash codes (which may lead to non-deterministic behavior) is what makes it intermittent.

sualeh commented 6 years ago

I will take a look.

sualeh commented 6 years ago

Closing. I cannot reproduce the issue.