Endless loops in computation code (1.6.0_22).

Dawid Weiss dawid.weiss at gmail.com
Thu Mar 3 04:39:44 PST 2011


Hi. We see an infrequent, but very annoying VM hangups in purely
computational code, as in here:

http://builds.carrot2.org/build/result/viewBuildResultsFailedTests.action?buildKey=JSA-JSAHEAD-JOB1&buildNumber=8

The loop in question is like this:

            for (c0 = ALPHABET_SIZE - 2, j = m; 0 < j; --c0)
            {
                for (c1 = ALPHABET_SIZE - 1; c0 < c1; j = i, --c1)
                {
                    i = bucket_B[(c0) * ALPHABET_SIZE + (c1)];
                    if (1 < (j - i))
                    {
                        ssSort(PAb, i, j, buf, bufsize, 2, n, SA[i] == (m - 1));
                    }
                }
            }

Unfortunately I cannot provide an always-halting example, but the bug
seems to be JVM-related because:

1) once the VM hangs in debugging mode, breaking out to the debugger
and stepping through the code terminates normally (so a deopt. I
assume),

2) the freeze is non-deterministic, while the test is (regardless of
the 'randomness', it always starts from the same seed),

3) we could reproduce this occasionally under different VMs and
different OSs (64-bit linux, 64-bit Windows).

Has there been any bug in the JIT that might be causing this? Thanks
for pointers if you recognize an evil code pattern above.

Dawid

P.S. The above code is a translation from another person's C snippet,
so I can't easily explain why the loop is built this way or why c0 is
passed between the inner and outer loop :).


More information about the hotspot-compiler-dev mailing list