Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-15162

Reflective plugin scanning misses plugins which are in parent classloaders but not classpath

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.6.0
    • connect
    • None

    Description

      When the Plugins class is instantiated with a parent classloader other than the system classloader, as in these tests: https://github.com/apache/kafka/blob/fd5b300b573dc41b94c710a791f9ee6f568992d4/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/PluginsTest.java#L493-L501

      Plugins which are present in that parent classloader but not in the app classloader are not visible. This is because the classes and resources become visible, but the set of URLs used for reflective scanning only includes the classpath jars: https://github.com/apache/kafka/blob/fd5b300b573dc41b94c710a791f9ee6f568992d4/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginUtils.java#L353 

      This causes a discrepancy between the Reflection and ServiceLoading scanners, because the Reflection scanner relies on these URLs but the ServiceLoader relies on the classes and resources instead.

      Either the tests should be rewritten to accommodate this difference in behavior, or the PluginUtils.pluginSources should be amended to make a best-effort evaluation of the parent classloader URLs.

      Attachments

        Issue Links

          Activity

            People

              gharris1727 Greg Harris
              gharris1727 Greg Harris
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: