You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/11/25 08:54:06 UTC

[GitHub] [pulsar] nicoloboschi commented on a change in pull request #12973: [Functions] Fix classloader leaks

nicoloboschi commented on a change in pull request #12973:
URL: https://github.com/apache/pulsar/pull/12973#discussion_r756684661



##########
File path: pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java
##########
@@ -728,20 +729,28 @@ public SourceConfig getSourceInfo(final String tenant,
             }
         }
 
-        // if source is not builtin, attempt to extract classloader from package file if it exists
-        if (classLoader == null && sourcePackageFile != null) {
-            classLoader = getClassLoaderFromPackage(sourceConfig.getClassName(),
-                    sourcePackageFile, worker().getWorkerConfig().getNarExtractionDirectory());
-        }
+        boolean shouldCloseClassLoader = false;
+        try {
+            // if source is not builtin, attempt to extract classloader from package file if it exists
+            shouldCloseClassLoader = true;

Review comment:
       here the `ClassLoader` must be closed only if `classLoader` is null, otherwise you will close the `ClassLoader` of the `Connector` instance
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org