JDK-6921610 : 1.6 update 17 and 18 throw java.lang.IndexOutOfBoundsException
  • Type: Bug
  • Component: core-libs
  • Sub-Component: javax.naming
  • Affected Version: 6u18
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2010-02-01
  • Updated: 2011-02-16
  • Resolved: 2010-03-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u21 b02Fixed 7Fixed
Description
FULL PRODUCT VERSION :
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Linux build01.lab.zimbra.com 2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:54:53 EST 2006 i686 i686 i386 GNU/Linux (RHEL4)
Linux build10.lab.zimbra.com 2.6.18-92.1.1.el5 #1 SMP Thu May 22 09:01:29 EDT 2008 i686 athlon i386 GNU/Linux (RHEL5)
Linux build11.lab.zimbra.com 2.6.18-92.1.1.el5 #1 SMP Thu May 22 09:01:47 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux (RHEL5_64)


A DESCRIPTION OF THE PROBLEM :
After upgrading the java version we use from JDK1.6 U16 to JDK1.6 U17 or JDK16U18, we find that java routinely fails, throwing the following error at random in our automated test suite:

Automation occasionally reports java.lang.IndexOutOfBoundsException exception
in upgrades (so far 6 occurrences, 5.0.[19-21]->6.0.4. So far I haven't found a
way to reproduce it consistently.
Here are some of the failures:

1) [] INFO: Enabling Zimlet com_zimbra_cert_manager
Exception in thread "Thread-4" java.lang.IndexOutOfBoundsException
        at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
        at com.sun.jndi.ldap.Connection.run(Connection.java:836)
        at java.lang.Thread.run(Thread.java:619)

2) Running as zimbra user: /opt/zimbra/bin/zmprov -m -l grr global grp
###@###.### +listAccount
Exception in thread "Thread-3" java.lang.IndexOutOfBoundsException
        at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
        at com.sun.jndi.ldap.Connection.run(Connection.java:836)
        at java.lang.Thread.run(Thread.java:619)

3) Running as zimbra user: /opt/zimbra/bin/zmprov -m -l mcf
+zimbraInstalledSkin 'lavender'
Exception in thread "Thread-2" java.lang.IndexOutOfBoundsException
        at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
        at com.sun.jndi.ldap.Connection.run(Connection.java:836)
        at java.lang.Thread.run(Thread.java:619)

4) Running as zimbra user: /opt/zimbra/bin/zmprov -m -l mcf zimbraSkinLogoURL
'http://www.zimbra.com'
Exception in thread "Thread-2" java.lang.IndexOutOfBoundsException
        at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
        at com.sun.jndi.ldap.Connection.run(Connection.java:836)
        at java.lang.Thread.run(Thread.java:619)


Reverting back to 1.6U16 makes the problem go away.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Replace the version of Java shipped with Zimbra Collaboration Suite 6.0.x with the latest JDK and run commands until they fail

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The command was successful without throwing an error
ACTUAL -
The commands randomly throw the indexoutofbounds exception

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Downgrade to JDK 1.6 U16

Release Regression From : 6u16
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION Change the initial size for the header to 129, which can contains a type byte, a length prefix, and 127 bytes for the real length.
15-03-2010