Repository navigation
Closed as duplicate
Closed as duplicate
Copy link
Labels
kind/bugA reported bug.
Description
Bug description
Environment
- Prisma: 7.3.0-dev.16
- @prisma/adapter-mariadb: 7.3.0-dev.16
- mariadb driver: 3.4.0
- Node.js: 20.x
- Database: MariaDB 10.11
- Platform: Ubuntu 24.04, PM2 cluster (2 instances)
Configuration
const adapter = new PrismaMariaDb({
host: config.host,
port: config.port,
user: config.user,
password: config.password,
database: config.database,
connectionLimit: 30,
connectTimeout: 10000,
idleTimeout: 10, // 10 seconds
minimumIdle: 2,
});
Expected behavior
Idle connections should be cleaned up ~10-15 seconds after becoming idle.
Actual behavior
Idle connections are cleaned up after 30-50 seconds (3-4x delay).
Proof that mariadb driver works correctly
Direct test with mariadb driver (WITHOUT Prisma):
const pool = mariadb.createPool({
host: '...',
connectionLimit: 5,
idleTimeout: 10,
minimumIdle: 1,
});
// Result:
// +5s: idle=2
// +10s: idle=2
// +15s: idle=1 ✅ Cleanup worked!
Proof of delay through Prisma adapter
Same config through PrismaMariaDb adapter:
+2s after burst: 4 idle connections
+27s: 4 idle connections (no cleanup!)
+47s: 2 idle connections (cleanup finally happened)
The cleanup happened at ~40-45s instead of ~10-15s.
Impact
- Connections stay idle longer than expected
- Server wait_timeout (60s) can interfere with pool management
- Requires external cron job as workaround to kill stale connections
Workaround
We run a cron job every 30 seconds that kills connections idle > 35 seconds:
mysql -e "SELECT CONCAT('KILL ', ID) FROM information_schema.PROCESSLIST
WHERE COMMAND='Sleep' AND USER='app_user' AND TIME > 35;" | mysql
Additional context
This is NOT related to issue #19215 (mobc idle cleanup) since we're using driver adapters which bypass mobc entirely.
The mariadb driver handles idleTimeout correctly - the delay appears to be introduced by the Prisma adapter layer.
### Severity
🔹 Minor: Unexpected behavior, but does not block development
### Reproduction
- Prisma: 7.3.0-dev.16
- @prisma/adapter-mariadb: 7.3.0-dev.16
- mariadb driver: 3.4.0
- Node.js: 20.x
- Database: MariaDB 10.11
- Platform: Ubuntu 24.04, PM2 cluster (2 instances)
### Configuration
```typescript
const adapter = new PrismaMariaDb({
host: config.host,
port: config.port,
user: config.user,
password: config.password,
database: config.database,
connectionLimit: 30,
connectTimeout: 10000,
idleTimeout: 10, // 10 seconds
minimumIdle: 2,
});
### Expected vs. Actual Behavior
Idle connections should be cleaned up ~10-15 seconds after becoming idle.
Actual behavior
Idle connections are cleaned up after 30-50 seconds (3-4x delay).
Proof that mariadb driver works correctly
Direct test with mariadb driver (WITHOUT Prisma):
const pool = mariadb.createPool({
host: '...',
connectionLimit: 5,
idleTimeout: 10,
minimumIdle: 1,
});
// Result:
// +5s: idle=2
// +10s: idle=2
// +15s: idle=1 ✅ Cleanup worked!
Proof of delay through Prisma adapter
Same config through PrismaMariaDb adapter:
+2s after burst: 4 idle connections
+27s: 4 idle connections (no cleanup!)
+47s: 2 idle connections (cleanup finally happened)
The cleanup happened at ~40-45s instead of ~10-15s.
Impact
- Connections stay idle longer than expected
- Server wait_timeout (60s) can interfere with pool management
- Requires external cron job as workaround to kill stale connections
Workaround
We run a cron job every 30 seconds that kills connections idle > 35 seconds:
mysql -e "SELECT CONCAT('KILL ', ID) FROM information_schema.PROCESSLIST
WHERE COMMAND='Sleep' AND USER='app_user' AND TIME > 35;" | mysql
### Frequency
Consistently reproducible
### Does this occur in development or production?
Both development and production
### Is this a regression?
Yes, last worked in Prisma 5.2.0 and broke in Prisma 7.
### Workaround
We run a cron job every 30 seconds that kills connections idle > 35 seconds:
mysql -e "SELECT CONCAT('KILL ', ID) FROM information_schema.PROCESSLIST
WHERE COMMAND='Sleep' AND USER='app_user' AND TIME > 35;" | mysql
### Prisma Schema & Queries
```prisma
// Add relevant schema.prisma snippet// Add relevant Prisma Client queryPrisma Config
// Add your `prisma.config.ts`Logs & Debug Info
// Debug logs here
Environment & Setup
- Prisma: 7.3.0-dev.16
- @prisma/adapter-mariadb: 7.3.0-dev.16
- mariadb driver: 3.4.0
- Node.js: 20.x
- Database: MariaDB 10.11
- Platform: Ubuntu 24.04, PM2 cluster (2 instances)
Prisma Version
- Prisma: 7.3.0-dev.16
Metadata
Metadata
Assignees
Labels
kind/bugA reported bug.
Activity
jacek-prisma commentedon Feb 4, 2026
I think this discussion should move to the existing issue, because it looks like it's the same underlying problem