Files
bun.sh/test/regression/issue
Claude Bot 653c7de613 fix(sql): resolve MySQL connection pool hang with pool size > 1
When a prepared statement completes, the code was calling queue.advance()
to process pending queries, but the data written to the buffer was not
being flushed. This caused a hang because:

1. The auto-flusher was registered in onData's defer block
2. But event_loop.exit() ran BEFORE registerAutoFlusher()
3. So the deferred task queue was drained before the auto-flusher was registered
4. The new data written by queue.advance() would never be flushed

The fix replaces queue.advance() with flushQueue() in several places:
- checkIfPreparedStatementIsDone() - main fix for the hang
- handleAuth() OK case - for consistency
- handleAuth() success auth case - for consistency
- handlePreparedStatement() ERROR case - for consistency

flushQueue() calls flushData() after queue.advance() to ensure any
data written by newly executed queries is actually sent to the server.

This is a follow-up to #26030, which fixed the same pattern for pool
size = 1. The issue persisted for pool size > 1 because the auto-flusher
timing is different when multiple connections are involved.

Fixes #26235

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 06:16:29 +00:00
..
2025-08-06 06:44:46 -07:00
2025-01-28 17:23:57 -08:00
2025-06-03 13:23:12 -07:00
2025-06-03 23:41:37 -07:00
2025-01-17 22:08:07 -08:00
2024-06-14 01:50:36 -07:00
2025-03-03 21:38:05 -08:00
2025-05-26 21:18:22 -07:00
2025-07-03 01:06:22 -07:00
2025-07-23 22:31:42 -07:00
2025-10-20 14:07:31 -07:00
2025-11-05 22:04:14 -08:00
2025-11-05 22:04:14 -08:00
2025-11-19 21:17:51 -08:00
2026-01-13 22:38:31 -08:00
2025-07-20 23:02:10 -07:00