glassfish
  1. glassfish
  2. GLASSFISH-20927

java.lang.ArrayIndexOutOfBoundsException on modifucation of the empty HashSet serialized over corba (JDK 1.7.0_u45)

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Blocker Blocker
    • Resolution: Unresolved
    • Affects Version/s: 3.1.2, 3.1.2.2
    • Fix Version/s: None
    • Component/s: orb
    • Labels:
      None
    • Environment:

      fedora 17, Oracle JDK 1.7.0_u45

      Description

      When modifying empty HashSet that has been previously serialized over Corba, Following exception happens:

      ...
      Caused by: java.lang.ArrayIndexOutOfBoundsException: -1636631191
      at java.util.HashMap.put(HashMap.java:498)
      at java.util.HashSet.add(HashSet.java:217)
      ...

      The reason seems to be in the one of the latest changes done in the JDK 1.7.0_u45 (I compared only to JDK 1.7.0_u25, where problem doesn't occur) within the internal implementation of the HashMap.

      Namely following sections harm it:

      In the HashMap:

      public V put(K key, V value) {
      if (table == EMPTY_TABLE)

      { inflateTable(threshold); }

      ...
      so after the serialization / deserialization table is not equal to EMPTY_TABLE any more => won't ever call
      inflateTable(threshold);
      => internal field: table won't be initialized (is empty) => later modifications fail with ArrayIndexOutOfBoundsException.

      The source of the trouble seem to be optimization via introducing EMPTY_TABLE variable. However JDK expects to call readObject() on deserialization, where the reference would be fixed, corba seem to ignore it however.

      See the attached test program (Arquilian with embedded glassfish 3.1.2) for reproducing the error. Simply run:
      mvn test

      Please note that failure comes from the:
      BBean.wontWork(...)
      as corba serialization already happened.

      If modification is done prio to that => in:
      ABean.worksOK
      => set won't be empty during corba serialization time
      (commented out section)
      problem won't happen.

        Activity

        Hide
        Peter Butkovic added a comment -

        I guess I'm not allowed to attach anything Well, that's weird.

        Anyway, the test case is available on github: https://github.com/typekpb/GLASSFISH-20927

        to reproduce, go for the:
        git clone https://github.com/typekpb/GLASSFISH-20927 GLASSFISH-20927
        cd GLASSFISH-20927
        mvn test

        Just make sure to test with the Oracle JDK 1.7.0_u45

        Show
        Peter Butkovic added a comment - I guess I'm not allowed to attach anything Well, that's weird. Anyway, the test case is available on github: https://github.com/typekpb/GLASSFISH-20927 to reproduce, go for the: git clone https://github.com/typekpb/GLASSFISH-20927 GLASSFISH-20927 cd GLASSFISH-20927 mvn test Just make sure to test with the Oracle JDK 1.7.0_u45
        Hide
        mduigou added a comment -

        See also GLASSFISH-20814 which is related.

        Show
        mduigou added a comment - See also GLASSFISH-20814 which is related.
        Hide
        russgold added a comment -

        I can duplicate it using your test case. What I don't seem to be able to do is attach a debugger to server process in which the failure is happening - that could be related by lack of familiarity with Arquillian.

        Show
        russgold added a comment - I can duplicate it using your test case. What I don't seem to be able to do is attach a debugger to server process in which the failure is happening - that could be related by lack of familiarity with Arquillian.
        Hide
        Peter Butkovic added a comment -
        Show
        Peter Butkovic added a comment - would this work for you? http://arquillian.org/guides/getting_started/#debug_the_test
        Hide
        russgold added a comment -

        This is actually the same issue as GLASSFISH-20814; We will fix it in GF 4 and then look into back porting. Further comments will be found on the other bug.

        Show
        russgold added a comment - This is actually the same issue as GLASSFISH-20814 ; We will fix it in GF 4 and then look into back porting. Further comments will be found on the other bug.

          People

          • Assignee:
            russellgold
            Reporter:
            Peter Butkovic
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: