javasqlmariadbhikaricpbungeecord

HikariPool-1 - Interrupted during connection acquisition


So I'm trying to get a connection and it doesn't work and gives me this nice exception (which I don't semm to understand):

11:17:07 [SEVERE] java.sql.SQLException: HikariPool-1 - Interrupted during connection acquisition
> 11:17:07 [SEVERE] at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:200)
> 11:17:07 [SEVERE] at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:161)
> 11:17:07 [SEVERE] at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:100)
> 11:17:07 [SEVERE] at net.bungeencoin.mcn.sql.DatabaseConnecter.getConnection(DatabaseConnecter.java:48)
> 11:17:07 [SEVERE] at net.bungeencoin.mcn.sql.Database.getCoins(Database.java:31)
> 11:17:07 [SEVERE] at net.bungeencoin.mcn.listeners.CacheListener.lambda$onJoin$0(CacheListener.java:27)
> 11:17:07 [SEVERE] at net.md_5.bungee.scheduler.BungeeTask.run(BungeeTask.java:63)
> 11:17:07 [SEVERE] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> 11:17:07 [SEVERE] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> 11:17:07 [SEVERE] at java.lang.Thread.run(Thread.java:748)
> 11:17:07 [SEVERE] Caused by: java.lang.InterruptedException
> 11:17:07 [SEVERE] at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:944)
> 11:17:07 [SEVERE] at com.zaxxer.hikari.util.ConcurrentBag.borrow(ConcurrentBag.java:157)
> 11:17:07 [SEVERE] at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:179)
> 11:17:07 [SEVERE] ... 9 more

Any idea why?


Solution

  • This error means that you had one or more long-running SQL statements that were holding onto all the connections in your Hikari connection pool, and during that period something else called "Interrupt" on your application, calling all blocking threads to throw an interrupt exception at the point where they were blocking.

    Hikari CP uses blocking constructs for thread safety, hence this stack trace occurred.

    Relevant GitHub issue https://github.com/brettwooldridge/HikariCP/issues/976

    Here is a classic blog post on the subject if InterruptedException: https://www.ibm.com/developerworks/library/j-jtp05236/index.html