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

Incorrect exception handling for VMThread in class redefinition

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • 17
    • hotspot
    • 6
    • b17

      In redefine_single_class we have:

       // Initialize the vtable and interface table after
        // methods have been rewritten
        // no exception should happen here since we explicitly
        // do not check loader constraints.
        // compare_and_normalize_class_versions has already checked:
        // - classloaders unchanged, signatures unchanged
        // - all instanceKlasses for redefined classes reused & contents updated
        the_class->vtable().initialize_vtable(false, THREAD);
        the_class->itable().initialize_itable(false, THREAD);
        assert(!HAS_PENDING_EXCEPTION || (THREAD->pending_exception()->is_a(vmClasses::ThreadDeath_klass())), "redefine exception");

      This code has been present since Java 6, where we introduced the "false" flag to not check constraints as we mustn't get an exception due to loader constraint violations. But this code is executed by the VMThread so ThreadDeath is not possible. What is possible, but not accounted for is OutOfMemoryError. But again this is the VMThread and so we should not be throwing exceptions in any case as they can never be processed.

            coleenp Coleen Phillimore
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: