-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Bug
Currently, the database connection logic in various components raises an exception immediately when the database server rejects a connection due to connection limits. This can cause cascading failures when the database is temporarily overloaded.
-
Python Components (
clp-package-utils, scripts):- Target:
components/clp-py-utils/clp_py_utils/sql_adapter.py - Logic: Wrap
_create_mariadb_connectionand_create_mysql_connectionwith a retry loop catchingmariadb.Error/mysql.connector.Error(specifically for "Too many connections").
- Target:
-
Core (C++):
- Target:
components/core/src/clp/MySQLDB.cpp - Logic: In the
openor connection establishment method, check for MySQL error codes (e.g.,CR_CONNECTION_ERROR,ER_CON_COUNT_ERROR) and retry with backoff.
- Target:
-
WebUI (Node.js/TypeScript):
- Target:
components/webui/server(uses@fastify/mysql). - Logic: Configure the connection pool to retry, or wrap the initial connection logic.
@fastify/mysqlmight expose the underlying pool events or require a custom connection factory wrapper to handle retries during startup or pool acquisition.
- Target:
-
MCP Server (Python):
- Target:
components/clp-mcp-server(usesaiomysql). - Logic: Implement an async retry wrapper around the
aiomysql.connector pool creation calls.
- Target:
-
API Server (Rust):
- Target:
components/api-server(usessqlx). - Logic:
sqlxoften has built-in connection pool features (max_connections,acquire_timeout), but explicit retries on "Too many connections" during initial pool creation or individual acquisition might need explicit handling (e.g., usingConnectOptionsor a retry crate likebackoff).
- Target:
CLP version
Environment
Ubuntu 22.04
Reproduction steps
MariaDB/MySQL ships with mysqlslap, which can spawn many connections concurrently.
Example: 200 connections
mysqlslap \
--user=youruser \
--password=yourpassword \
--host=127.0.0.1 \
--concurrency=200 \
--iterations=1 \
--create-schema=test \
--query="SELECT 1;"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working