Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ExtraPlugins might be loaded duplicated #12076

Closed
sperlingxx opened this issue Feb 7, 2025 · 1 comment · Fixed by #12077
Closed

[BUG] ExtraPlugins might be loaded duplicated #12076

sperlingxx opened this issue Feb 7, 2025 · 1 comment · Fixed by #12077
Assignees
Labels
? - Needs Triage Need team to review and classify bug Something isn't working

Comments

@sperlingxx
Copy link
Collaborator

Describe the bug
(https://github.com/NVIDIA/spark-rapids/blob/branch-25.02/sql-plugin/src/main/scala/com/nvidia/spark/rapids/Plugin.scala#L356)

  private def getExtraPlugins: Seq[SparkPlugin] = {
    val resourceName = "spark-rapids-extra-plugins"
    val classLoader = RapidsPluginUtils.getClass.getClassLoader
    val resourceUrls = classLoader.getResources(resourceName)
    val resourceUrlArray = resourceUrls.asScala.toArray

    if (resourceUrlArray.isEmpty) {
      logDebug(s"Could not find file $resourceName in the classpath, not loading extra plugins")
      Seq.empty
    } else {
      val plugins = scala.collection.mutable.ListBuffer[SparkPlugin]()
      for (resourceUrl <- resourceUrlArray) {
        val source = scala.io.Source.fromURL(resourceUrl)
        val pluginClasses = source.getLines().toList
        source.close()
        plugins ++= loadExtensions(classOf[SparkPlugin], pluginClasses)
      }
      plugins.toSeq
    }
  }

The resourceUrls may contain duplicated urls for the same extra plugin to be loaded. And the a lot of extra plugins will go weirdly when being loaded multiple times.

@sperlingxx sperlingxx added ? - Needs Triage Need team to review and classify bug Something isn't working labels Feb 7, 2025
@sperlingxx sperlingxx self-assigned this Feb 7, 2025
@gerashegalov
Copy link
Collaborator

When does this happen? Do you specify the jars via --jars and extraClassPath at the same time?

gerashegalov pushed a commit that referenced this issue Feb 8, 2025
Fixes #12076

The PR is about to fix the multiple loading problem which is due to the
duplicated URL paths for single extra plugin.

---------

Signed-off-by: sperlingxx <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
? - Needs Triage Need team to review and classify bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants