Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2800

Fileleak in "org.jboss.weld.util.ServiceLoader.loadServiceFile"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • 6.0.0.Beta5, 5.1.4.Final
    • 5.1.3.Final
    • None
    • None

      Sorry, this is a hard to reproduce issue, and I don't have an easy reproducer.

      The https://github.com/arquillian/arquillian-extension-warp deploys as part of the test suite some war files to a WildFly/TomEE/Glassfish server. With Glassfish, undeploy fails to delete two jar files in "WEB-INF\lib" on windows, resulting in a delay of 20 seconds for each test until file deletion times out.
      This happens with Glassfish 7.0.18, which bundles "weld-osgi-bundle.jar" 5.1.2.Final.

      Using https://github.com/jenkinsci/lib-file-leak-detector/, I could track it down to two stacktraces that leave a file handle open. This tool prints at shutdown of Glassfish for each unclosed file the stack trace that opened it.
      One is coming from JBoss Weld, the other one might be caused by glassfish: https://github.com/eclipse-ee4j/glassfish/issues/25193

      Here is the stack trace from Weld that opens the file:

       

      Opened C:\Temp\glassfish7\glassfish\domains\domain1\applications\test\WEB-INF\lib\arquillian-testenricher-cdi-jakarta.jar by thread:admin-listener(2) on Fri Oct 25 20:06:51 CEST 2024
          at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:187)
          at java.base/java.util.jar.JarFile.<init>(JarFile.java:348)
          at java.base/sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:103)
          at java.base/sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:72)
          at java.base/sun.net.www.protocol.jar.JarFileFactory.getOrCreate(JarFileFactory.java:106)
          at java.base/sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:132)
          at java.base/sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:175)
          at java.base/java.net.URL.openStream(URL.java:1165)
          at org.jboss.weld.util.ServiceLoader.loadServiceFile(ServiceLoader.java:176)
          at org.jboss.weld.util.ServiceLoader.reload(ServiceLoader.java:164)
          at org.jboss.weld.util.ServiceLoader.iterator(ServiceLoader.java:288)
          at org.glassfish.weld.DeploymentImpl.getExtensions(DeploymentImpl.java:295)
          at org.glassfish.weld.WeldDeployer.doBootstrapStartup(WeldDeployer.java:486)
          at org.glassfish.weld.WeldDeployer.enable(WeldDeployer.java:420)
          at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:362)
          at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:115)
          at org.glassfish.internal.data.ModuleInfo.sendEvent(ModuleInfo.java:95)
          at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:324)
          at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:529)
          at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:257)
          at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:471)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:574)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:570)
          at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
          at java.base/javax.security.auth.Subject.doAs(Subject.java:361)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:569)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:600)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:592)
          at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
          at java.base/javax.security.auth.Subject.doAs(Subject.java:361)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:591)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1484)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1862)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1738)
          at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:233)
          at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:213)
          at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:253)
          at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:305)
          at org.glassfish.admin.rest.resources.TemplateListOfResource.post(TemplateListOfResource.java:142)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.base/java.lang.reflect.Method.invoke(Method.java:566)
          at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
          at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:146)
          at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:189)
          at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
          at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:93)
          at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478)
          at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400)
          at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81)
          at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:274)
          at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
          at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
          at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
          at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
          at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
          at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:266)
          at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:253)
          at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:696)
          at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:367)
          at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:291)
          at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:159)
          at org.glassfish.admin.rest.adapter.RestManagementAdapter.service(RestManagementAdapter.java:42)
          at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:429)
          at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:143)
          at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:174)
          at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:153)
          at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:196)
          at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:88)
          at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:246)
          at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178)
          at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:118)
          at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:96)
          at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:51)
          at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:510)
          at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:82)
          at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:83)
          at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:101)
          at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:535)
          at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:515)
          at java.base/java.lang.Thread.run(Thread.java:834)

       

      I fixed something similar in arquillian-core some time ago, so the details can be found here: https://github.com/arquillian/arquillian-extension-warp/issues/131#issuecomment-1734278071

      I think I can apply the same workaround (disable jar cache) here. Wait for a pull request .

       

            Unassigned Unassigned
            wolfgangknauf Wolfgang Knauf
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: