Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-17748

"Call Home" function causes database thread leak

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Cannot Reproduce
    • Affects Version/s: 6.0.3
    • Fix Version/s: 6.5.0
    • Component/s: None
    • Labels:
      None

      Description

      Symptoms: There is a slight uptick in database threads every day.

      Steps to reproduce:

      1. Use the following User Plugin in Artifactory 6.0.3. The plugin will trigger the Call Home function every two seconds:

      import org.artifactory.api.context.ContextHelper
      import org.artifactory.post.services.CallHomeService;

      jobs {
      createCallHomeJob(cron: "0/2 * * * * ?")

      { CallHomeService callHomeService = ContextHelper.get().beanForType(CallHomeService.class) log.debug "Starting custom CallHomeJob" callHomeService.callHome() log.debug "custom CallHomeJob ended" }

      }

      2. Add this logger to the logback.xml to track the number of calls made:

      <logger name="triggerCallHome">
      <level value="debug" />
      </logger>

       3. Attempt to load something in the Artifactory UI after a period of time. Observe that the Artifactory runs out of connection threads to its database:

      2018-10-31 21:14:40,018 [art-exec-55] [WARN ] (o.a.p.s.CallHomeService:202) - Can not retrieve database and driver name / version
      org.artifactory.storage.StorageException: org.apache.tomcat.jdbc.pool.PoolExhaustedException: [art-exec-55] Timeout: Pool empty. Unable to fetch a connection in 120 seconds, none available[size:98; busy:98; idle:0; lastwait:120000].
      at org.artifactory.storage.db.DbServiceImpl.getDbMetaData(DbServiceImpl.java:191)
      at sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
      at com.sun.proxy.$Proxy146.getDbMetaData(Unknown Source)
      at org.artifactory.post.services.CallHomeService.setDbInfo(CallHomeService.java:198)
      at org.artifactory.post.services.CallHomeService.addInstanceAndEnvInfo(CallHomeService.java:193)
      at org.artifactory.post.services.CallHomeService.callHomeEntity(CallHomeService.java:134)
      at org.artifactory.post.services.CallHomeService.callHome(CallHomeService.java:102)
      at org.artifactory.post.services.CallHomeService$$FastClassBySpringCGLIB$$a9165062.invoke(<generated>)
      at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
      at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      at org.artifactory.schedule.aop.TraceableMethodInvocation.proceed(TraceableMethodInvocation.java:58)
      at org.artifactory.schedule.aop.AsyncAdvice.doInvoke(AsyncAdvice.java:333)
      at org.artifactory.schedule.aop.AsyncAdvice.lambda$submit$2(AsyncAdvice.java:285)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at org.artifactory.concurrent.ArtifactoryRunnable.run(ArtifactoryRunnable.java:30)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:748)
      Caused by: org.apache.tomcat.jdbc.pool.PoolExhaustedException: [art-exec-55] Timeout: Pool empty. Unable to fetch a connection in 120 seconds, none available[size:98; busy:98; idle:0; lastwait:120000].
      at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:684)
      at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:187)
      at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127)
      at org.artifactory.storage.db.DbServiceImpl.getDbMetaData(DbServiceImpl.java:188)
      ... 22 common frames omitted

       

      Workarounds: 

      • This behavior does not look to occur in Artifactory 6.5.0 and up
      • Use the following setting in the $ARTIFACTORY_HOME/etc/artifactory.system.properties:

      artifactory.version.query.enabled=false

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              patrickr Patrick Russell
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: