yuqi1129 opened a new issue, #13592:
URL: https://github.com/apache/gravitino/issues/13592

   ## Version
   
   main branch, `8e9ca0009d68dbf9edb5e313d3d51688b9c4cff1`; MySQL 8.0.35, 
mysql-connector-j 8.0.33, Java 17.
   
   ## Describe what's wrong
   
   With the documented form `jdbc:mysql://host:port/` (no default database), a 
sequential borrow/setCatalog/close loop through the production 
`DataSourceUtils` creates a connection on every iteration despite using DBCP2. 
Selecting an otherwise unused default database restores reuse.
   
   For 100 sequential iterations, server Connections increased by 102 without a 
default database and by 3 with one. Each window includes one observer 
connection, so the application created 101 versus 2. Both pools report one idle 
connection; idle count alone misses the failed reuse.
   
   ## Error message and/or stacktrace
   
   Table API pressure with the no-database URL produced HTTP 500 with 
`java.net.BindException: Can't assign requested address` in MySQL connection 
establishment. The catalog SQL digest also recorded failing `USE` statements. 
The eventual address exhaustion is host dependent; the sequential connection 
churn does not require saturation.
   
   ## How to reproduce
   
   1. Create two disposable databases, e.g. `perf_tables` and `perf_bootstrap`.
   2. Create a datasource with `DataSourceUtils.createDataSource`, driver 
`com.mysql.cj.jdbc.Driver`, normal credentials and URL 
`jdbc:mysql://host:port/?useSSL=false`.
   3. Repeat 100 times: borrow a connection, `setCatalog("perf_tables")`, then 
close it. Observe MySQL Connections before/after.
   4. Repeat with `jdbc:mysql://host:port/perf_bootstrap?useSSL=false`. 
Connection creation drops to pool initialization only.
   
   ## Additional context
   
   This concerns the catalog datasource and default-database handling. It is 
distinct from #13582, which concerns metadata-store `maxIdle=10` under 
concurrent load. A raw prepared-statement probe confirms the validation 
interaction: prepare SELECT 1 before switching catalogs, then switch to 
perf_tables and execute it. An empty original catalog fails with SQLState 3D000 
/ error 1046 (No database selected); the perf_bootstrap original catalog 
succeeds. DBCP caches its validation statement and rejects the reused 
connection after catalog switching. A default database is a benchmark 
workaround, not a proposed general fix. Raw probe counts, source, and 
default-URL pilot JFR are retained locally in 
`dev/performance/main-auth-table-20260929/`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to