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

IllegalArgumentException on starting mmj2 #71

Open
avekens opened this issue Sep 17, 2023 · 7 comments
Open

IllegalArgumentException on starting mmj2 #71

avekens opened this issue Sep 17, 2023 · 7 comments

Comments

@avekens
Copy link

avekens commented Sep 17, 2023

Since recently, an IllegalArgumentException is thrown on starting mmj2. The start of the application is aborted afterwards:

Here is the stack trace from the cmd console:

I-UT-0015 **** Processing RunParmFile Command #20 = RunProofAsstGUI
I-PA-0412 Excluded these assertions from Unification search list as requested on input RunParm: [dummylink]
Comparison method violates its general contract!
java.lang.IllegalArgumentException: Comparison method violates its general contract!
        at java.util.ComparableTimSort.mergeHi(Unknown Source)
        at java.util.ComparableTimSort.mergeAt(Unknown Source)
        at java.util.ComparableTimSort.mergeCollapse(Unknown Source)
        at java.util.ComparableTimSort.sort(Unknown Source)
        at java.util.Arrays.sort(Unknown Source)
        at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)
        at sun.awt.shell.ShellFolder.get(Unknown Source)
        at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.addItem(Unknown Source)
        at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.access$800(Unknown Source)
        at javax.swing.plaf.metal.MetalFileChooserUI.doDirectoryChanged(Unknown Source)
        at javax.swing.plaf.metal.MetalFileChooserUI.access$1100(Unknown Source)
        at javax.swing.plaf.metal.MetalFileChooserUI$5.propertyChange(Unknown Source)
        at java.beans.PropertyChangeSupport.fire(Unknown Source)
        at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
        at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
        at java.awt.Component.firePropertyChange(Unknown Source)
        at javax.swing.JFileChooser.setCurrentDirectory(Unknown Source)
        at javax.swing.JFileChooser.setSelectedFile(Unknown Source)
        at mmj.pa.ProofAsstGUI.buildMMTFolderChooser(ProofAsstGUI.java:538)
        at mmj.pa.ProofAsstGUI.<init>(ProofAsstGUI.java:257)
        at mmj.pa.ProofAsst.doGUI(ProofAsst.java:200)
        at mmj.util.ProofAsstBoss.doRunProofAsstGUI(ProofAsstBoss.java:1031)
        at mmj.util.Boss.lambda$putCommand$0(Boss.java:107)
        at mmj.util.Boss.doRunParmCommand(Boss.java:121)
        at mmj.util.BatchFramework.executeRunParmCommand(BatchFramework.java:281)
        at mmj.util.BatchFramework.runIt(BatchFramework.java:223)
        at mmj.util.BatchMMJ2.main(BatchMMJ2.java:53)
Comparison method violates its general contract!

I still use mmj2 v2.4.1 as of 26-Jan-2016, currently with Java version 1.8.0_371 (there was an update on 15-Sep-2023!). Is it possible that the Java update causes this problem? Or did any change within my file system caused it (root cause for the exception within mmj2 is at mmj.pa.ProofAsstGUI.buildMMTFolderChooser(ProofAsstGUI.java:538)).

There are many hints on stackoverflow (https://stackoverflow.com/questions/11441666/java-error-comparison-method-violates-its-general-contract), even remarks on Java versions.

@avekens
Copy link
Author

avekens commented Sep 17, 2023

Updating java again to version 1.8.0_381 and cleaning the directory myproofs did not help...

@avekens
Copy link
Author

avekens commented Sep 17, 2023

I have copied everything to another computer with Java version 1.8.0_311, and here everything works fine. Therefore, I assume it's the Java version which causes the problem.

@avekens
Copy link
Author

avekens commented Oct 21, 2023

Yesterday, another Java update was performed (java version 1.8.0_391), and now mmj2 is working again. Maybe there was something wrong with versions 1.8.0_371 and 1.8.0_381...

@avekens avekens closed this as completed Oct 21, 2023
@avekens
Copy link
Author

avekens commented Oct 21, 2023

I was too quick to close this issue. Unfortunately, the problem is still existing, even with java version 1.8.0_391

@avekens avekens reopened this Oct 21, 2023
@tirix
Copy link

tirix commented Oct 23, 2023

Googling the issue, here is the issue tracked in JDK:
https://bugs.openjdk.org/browse/JDK-8305072
Until it is fixed, it looks like there is a workaround:

System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");

I'd say we try that!

@avekens
Copy link
Author

avekens commented Oct 23, 2023

@tirix thank you very much for this hint. I added the corresponding JVM parameter (-Djava.util.Arrays.useLegacyMergeSort=true), and now it works (again):

java -Xincgc -Xms512M -Xmx1024M -Djava.util.Arrays.useLegacyMergeSort=true -jar mmj2.jar RunParms.txt Y "" c:\Users\Alexander\Documents\metamath ""

@tirix
Copy link

tirix commented Oct 23, 2023

That's great!
Ideally this should be added to the repository's mmj2\mmj2jar\mmj2.bat file.
I suggest keeping this PR opened until done.

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

2 participants