Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4529684

Possible threading issue in JDKClassLoader cache

XMLWordPrintable

    • hopper
    • generic
    • generic
    • Verified

      While this has yet to been seen in practice, I think there is a bug in JDKClassLoader due to lack of synchronization and the double checked locking failure of the memory model.

      The latestUserDefinedClassLoaderMethod is static, but not set by a static initializer. It is set by first checking for null, and then doing a privileged method to set and turn on its accessibility flag. This code is unsynchronized.

      Solutions:

      1. Always synchronize before the check/set

      2. Move the reflection method lookup/set to a static initializer if possible

      This would probably show up as one thread in a multi-threaded system not finding a stub class on the first attempt.

      ********************************************************************************
      ###@###.### 2002-04-05

      Fix verified OK by code inspection
      - with build: j2sdk-1_4_1-beta-bin-b07-solaris-sparc-02_apr_2002
      - verified files: com/sun/corba/se/internal/util/JDKClassLoader.java
      ********************************************************************************

            eandersosunw Everett Anderson (Inactive)
            eandersosunw Everett Anderson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: