Confluence have Hikari Connection leak

Illés Ákos
Contributor
January 13, 2025

I tried to use the Confluence that comes with the Atlassian Plugin SDK for testing and every time I try to Enable ScriptRunner or any other third party app I get a countdown, when Confluence tries to enable the plugin, but after a number of tries it throws an Apparent connection leak detected error. I tried to clean and install the data again, remove the dependencies connected to Confluence itself, but with no success. Also I tried installing more versions of confluence to see if that is the source of the problem. I tried with Confluence version 8.9.1, 9.0.1, 9.1.1, 9.2. Why does this happen is there a way to resolve the issue?

Here are the logs:

[INFO] [talledLocalContainer] 11:12:41,412 WARN [HikariPool-1 housekeeper] [hikari.pool.ProxyLeakTask] run Connection leak detection triggered for conn56: url=jdbc:h2:tcp://localhost:9092/PATHTOMYPLUGIN\\target\\confluence\\home\\database\\h2db user=SA on thread http-nio-1990-exec-3, stack trace follows [INFO] [talledLocalContainer] java.lang.Exception: Apparent connection leak detected [INFO] [talledLocalContainer] at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:100) [INFO] [talledLocalContainer] at org.hibernate.hikaricp.internal.HikariCPConnectionProvider.getConnection(HikariCPConnectionProvider.java:77) [INFO] [talledLocalContainer] at jdk.internal.reflect.GeneratedMethodAccessor157.invoke(Unknown Source) [INFO] [talledLocalContainer] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [INFO] [talledLocalContainer] at java.base/java.lang.reflect.Method.invoke(Method.java:568) [INFO] [talledLocalContainer] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) [INFO] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) [INFO] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [INFO] [talledLocalContainer] at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:58) [INFO] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [INFO] [talledLocalContainer] at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:113) [INFO] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [INFO] [talledLocalContainer] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:241) [INFO] [talledLocalContainer] at jdk.proxy3/jdk.proxy3.$Proxy89.getConnection(Unknown Source) [INFO] [talledLocalContainer] at org.hibernate.internal.NonContextualJdbcConnectionAccess.obtainConnection(NonContextualJdbcConnectionAccess.java:38)

And here is my pom.xml:

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.test</groupId>
<artifactId>test-instance</artifactId>
<version>1.0.0-SNAPSHOT</version>

<organization>
<name>Example Company</name>
<url>http://www.example.com/</url>
</organization>

<name>test-instance</name>
<description>This is the com.aimotive.test:test-instance plugin for Atlassian Confluence.</description>
<packaging>atlassian-plugin</packaging>
<repositories>
<repository>
<id>central</id>
<name>Maven Central</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<id>atlassian2</id>
<name>Atlassian2 Repository</name>
<url>https://maven.artifacts.atlassian.com/</url>
</repository>

</repositories>
<pluginRepositories>
<pluginRepository>
<id>atlassian2</id>
<name>Atlassian2 Repository</name>
<url>https://maven.artifacts.atlassian.com/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>central</id>
<name>Maven Central</name>
<url>https://repo.maven.apache.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
<version>${confluence.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-javaconfig</artifactId>
<version>${osgi.javaconfig.version}</version>
</dependency>
<!-- OSGi Java Config dependencies -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>

<!-- WIRED TEST RUNNER DEPENDENCIES -->
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>${plugin.testrunner.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>confluence-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${confluence.version}</productVersion>
<productDataVersion>${confluence.data.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>

<!-- See here for an explanation of default instructions: -->
<!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

<!-- Add package to export here -->
<Export-Package>
com.aimotive.api,
</Export-Package>

<!-- Add package import here -->
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
com.atlassian.confluence.*;resolution:="optional",
*
</Import-Package>

<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<!-- process-classes seems to be skipped if you are using scala
so perhaps use prepare-package -->
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<!-- Enable this to get build-time logging of annotations atlassian-spring-scanner-maven-plugin has noticed -->
<verbose>true</verbose>

<!-- EXAMPLE EXAMPLE EXAMPLE :)
Demonstrates excluding packages from scanning, and scanning an example dependency jar.
Please see the docs below. -->

<includeExclude>+com.atlassian.jira.plugins.issue.create.*</includeExclude>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-test-example-external-jar</artifactId>
</dependency>
</scannedDependencies>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<confluence.version>8.9.1</confluence.version>
<confluence.data.version>${confluence.version}</confluence.data.version>
<amps.version>8.10.1</amps.version>
<plugin.testrunner.version>2.0.2</plugin.testrunner.version>
<osgi.javaconfig.version>0.5.2</osgi.javaconfig.version>
<spring.version>5.3.1</spring.version>
<atlassian.spring.scanner.version> 2.1.7 </atlassian.spring.scanner.version>
<!-- This property ensures consistency between the key in atlassian-plugin.xml and the OSGi bundle's key. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

</project>

Also worth to mention, that I use Java 17 and one dependency I downloaded from the internet, because I couldn't find it in the repository:  jta-1.0.1B.jar.

Any help or input would be much appreciated!

2 answers

1 accepted

0 votes
Answer accepted
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2025

@Illés Ákos I can see from the log, that your Confluence is configured with H2DB. Please note that this DB implementation is a "toy", not recommended for "serious use".

I'd reckon that ScriptRunner (a rather heavy-weight app) is just not compatible with it.

Therefore:

  1. If your use case doesn't require SR, uninstall it and see if it resolves the problem.
  2. If your use case requires SR, switch Confluence to a "real" database. (Postgres would be my personal recommendation.)
Illés Ákos
Contributor
January 14, 2025

Thank you @Aron Gombas _Midori_ for the response! I use H2DB, because it comes by default with the Atlassian Plugin SDK. I don't plan for "serious use", only development. I'll see if I can migrate the database.

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2025

BTW you can also run an "official" non-SDK Confluence in JVM debug mode and connect to that using remote debug. It can be another approach you can try.

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 13, 2025

Hi @Illés Ákos 

You might want to go ahead and submit a ticket to Atlassian Support:

https://support.atlassian.com/contact/#/

Illés Ákos
Contributor
January 14, 2025

Thank you for the response. Since I use the Confluence which comes with the Atlassian Plugin SDK, I don't think I can submit a Support ticket.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events