rcsb / symmetry

:ferris_wheel: Detect, analyze, and visualize protein symmetry
GNU Lesser General Public License v2.1
26 stars 16 forks source link

CeSymm.align method produces java.lang.IndexOutOfBoundsException #46

Closed lafita closed 6 years ago

lafita commented 9 years ago

Using the following:

Description: when calling the align method with the recursive calls active (multiple alignments doing a blankout of the previous to find all the subunits of symmetry), the method throws an index out of bounds exception. The cause might be a desynchronization in the "traceFragmentMatrix" method of the CECalculator class (line 744).

Reproducibility: to reproduce the error run the CEsymmSubunitGUI class with one of the susceptible PDB examples proposed below. Alternatively, CEsymmColorGUI also produces the error for some PDB examples.

Solution: the problem can be solved by using Java open JDK 1.6 or by inserting a printing statement in line 745 of the CECalculator script, below the doIter0 call. Running the code with the debugger also solves the problem, presumably because it slows down the code. The bug is unknown at the moment.

Some susceptible PDB examples: 1G61.A, 1JTD.B.

sbliven commented 9 years ago

Note that this is probably a biojava problem (e.g. some race condition in CECalculator). It occasionally crops up when running biojava-structure tests from the maven command line, but in a non-reproducible fashion. This is the first reproducible example.

josemduarte commented 9 years ago

I've tried to do some research together with Spencer and the conclusion is that this is a low level issue in the compiler.

The problem is in CECalculator.traceFragmentMatrix(). I reproduce it by running OptimalCECPMainTest, actually just two of the tests one after the other, like this:

        OptimalCECPMainTest t = new OptimalCECPMainTest();
        System.out.println("Test 1");
        t.testPermuteOptAlnUnpermuted();
        System.out.println("Test 2");
        t.testOptimalAlignmentConsistency();

The Exception happens in testOptimalAlignmentConsistencty but only if run after testPermuteOptAlnUnpermuted. Importantly this only happens if compiled with eclipse. In fact if I go back to maven on the command line and recompile, then it all works. After that I can re-reproduce it by recompiling (in eclipse) CECalculator only. Thus the issue is that the compiler is not liking the nested loops and loop labels in CECalculator.traceFragmentMatrix() or that it does some aggressive optimisation that goes wrong at some point.

This also explains why I got the problem when running mvn install after some time working with eclipse but it would go away after a mvn clean.

My versions are:

java -version

java version "1.7.0_75"
OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-1~utopic1)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)

javac -version

javac 1.8.0_40-internal

I'm not sure what mvn in the command line uses.

josemduarte commented 9 years ago

Another important note: the issue seems to happen when compiling with eclipse compiler and running with jdk-8, but not if running with jdk-7

andreasprlic commented 8 years ago

Du you also get this when NOT using the GUI?

lafita commented 8 years ago

Both errors occur without using the GUI. This one is related to the CECalculator and the compiler (but was avoided) and #87 is related to the multithreading.

Should we close this issue? We don't know how to solve the bug, but we know how to avoid it.