Replies: 2 comments
-
Do you do it to a different connection? If you are still waiting for stored procedure response the connection that started it would be busy in a "waiting for reply" state |
Beta Was this translation helpful? Give feedback.
0 replies
-
That makes more sense. It turns out what I saw getting timed out was a read-only connection established as part of another query shortly before this proc call accessed a read/write connection. Thanks for knocking some sense into me! Should enableKeepAlive = true hold that other RO connection open? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We've noticed that if a stored proc call takes longer to execute than the server's wait_timeout, our connection is idle timing out with code PROTOCOL_CONNECTION_LOST, and it hasn't mattered so far what we set in pool options for maxIdle, idleTimeout, or enableKeepAlive. Our current pool option setup (pool event handling and logging omitted here for brevity):
function createPool(/** @type {mysql2.PoolOptions} */ options) { const pool = mysql2.createPool({ supportBigNumbers: true, decimalNumbers: true, maxIdle: 1, idleTimeout: 240000, // removeNodeErrorCount, ...options });
Our server's wait_timeout is set to 250 seconds. Things I have tried:
I feel like I'm missing something obvious. One thing we did try was a manual interval keep alive running SELECT 1 every 230000ms, and that is sufficiently maintaining the connection. It would be ideal if the timeout could be overridden by the pool, or at least if a connection gets idled out for the pool to handle that event and reconnect it (we see "Can't add new command when connection is in closed state" on the next attempted proc call after the timeout). Have read through a few similar threads and am continuing searching but appreciate any suggestions!
Beta Was this translation helpful? Give feedback.
All reactions