Skip to content
Tickwise
WarningDatabasesSIG-DB-012

Database connection leak (HikariCP: Apparent connection leak detected)

Platforms
Paper · Purpur · Velocity · single server
Verified
Verified
Confidence
Confidence 85%

What it looks like in the log

Any one of these lines is enough. The agent matches them locally, on your server.

logs/latest.log
  • [WARN] Connection leak detection triggered for
  • [WARN] Apparent connection leak detectedin the stack trace

Symptoms

  • HikariCP reports that a connection was taken from the pool and not returned for longer than leakDetectionThreshold
  • Over time the pool runs dry (see SIG-DB-002)

Cause

A plugin took a connection from the HikariCP pool and did not close (return) it within the leakDetectionThreshold: a connection leak or a very long database operation.

Possible causes

  • The plugin does not close Connection/Statement/ResultSet (no try-with-resources) — a genuine leak
  • A query or transaction runs longer than the threshold (threshold too low, slow database) — a false alarm, after which HikariCP logs “… was returned to the pool (unleaked)”
  • A plugin thread hung while holding a connection

How to fixLow risk

  1. In the stack trace under Apparent connection leak detected, find the first frame belonging to the plugin — that is where the connection was taken and not returned.
  2. If the log is followed by “Previously reported leaked connection … was returned to the pool (unleaked)”, it is a long operation, not a leak: increase leakDetectionThreshold or look for the slow query.
  3. Update the plugin; if it recurs on the latest version, report it to the author with the stack trace (without configs containing passwords).
  4. Until it is fixed, keep some headroom in maximum-pool-size and keep an eye on SIG-DB-002.

Translated from the Russian original; log lines are quoted verbatim.

Sources