brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
19.63k stars 2.9k forks source link

The connection adder thread pool is permanently blocked #2186

Open x2zh opened 4 months ago

x2zh commented 4 months ago

The connection adder thread pool size is 1. If an error occurs in the jdbc driver and is permanently blocked in creating a connection, then the entire connection pool creation of new connections will be blocked. Even if the subsequent abnormality is recovered, the connection pool cannot return to normal.

      this.addConnectionExecutor = createThreadPoolExecutor(addConnectionQueue, poolName + " connection adder", threadFactory, new ThreadPoolExecutor.DiscardPolicy());
public static ThreadPoolExecutor createThreadPoolExecutor(final BlockingQueue<Runnable> queue, final String threadName, ThreadFactory threadFactory, final RejectedExecutionHandler policy)
   {
      if (threadFactory == null) {
         threadFactory = new DefaultThreadFactory(threadName, true);
      }

      ThreadPoolExecutor executor = new ThreadPoolExecutor(1 /*core*/, 1 /*max*/, 5 /*keepalive*/, SECONDS, queue, threadFactory, policy);
      executor.allowCoreThreadTimeOut(true);
      return executor;
   }

https://github.com/kohlschutter/junixsocket/issues/154