All Products
Search
Document Center

Function Compute:What do I do if "Could not get a resource from the pool" is reported when I use JedisPool?

Last Updated:Aug 20, 2025

This topic describes the causes and solutions for the "Could not get a resource from the pool" error.

Problem description

Could not get a resource from the pool is reported when JedisPool is used in a Java runtime.

Possible cause

  • The whitelist of the Tair (Redis OSS-compatible) instance is incorrectly configured.

  • An error of another type occurred.

Solution

Find the log that start with Caused by: in the Cause Exception log. Troubleshoot the error based on the content of the log. The following sample code provides an example log:

redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
  ....
Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR client ip is not in whitelist xxx:xxx
Note

If you cannot print logs started with Caused by: by using getStackTrace(), you can directly output the exception or use the getCause() method to print the logs.

ERR client ip is not in whitelist xxx:xxx

The whitelist of the ApsaraDB for Redis instance is incorrectly configured. You must reconfigure the whitelist. For more information, see Configure an IP address whitelist for the database.

Important

If the error occasionally occurs, check whether a security group is used to access the database. If a security group is used, connections to functions are unstable and services are affected. We recommend that you use an IP address-based whitelist.

Other errors

If other errors, such as Timeout waiting for idle object and Pool exhausted, are reported, see the following topics of Tair (Redis OSS-compatible) to troubleshoot: