-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pool cluster no response on WRITER #2421
Comments
Have a look at You can also listen the pool events to get an idea what the problem could be. I'm not into the AWS stuff, but in the end you have to debug why your queries take that long. BTW: You don't release the connection in case of an error. I think you can move connection.query(q, (error, results) => {
connection.release()
if (error) {
console.log(new Date(), "[ query2 ] failed to query on", connection.threadId)
reject(error)
} else {
// ....
}
} |
Much appreciate for the hint Regards, |
For debugging purposes you could output the size/length of these arrays: https://github.com/mysqljs/mysql/blob/master/lib/Pool.js#L15 (maybe in an interval). |
Hi,
I have set up an AWS Aurora MySQL (v5.7) with WRITER/READER and tried to connect from my nodejs (v8.5.0) using mysql version 2.14.1.
query2
has been working fine for a week, until recently, it stops responding with all INSERT/UPDATE query, such as:await query2("INSERT INTO ...")
This causes all commands after this
await
hangs up, not executing!Please note that when this happened, event loop still worked as my nodejs program still received commands from client and ran
SELECT
query successfully.I have some questions:
connectionLimit: 5
was too few? I increase it to10
in the meantime my issue is responded.const type = q.search(/^[^\w]*\(?SELECT/) == 0 ? "READER" : "WRITER"
in myquery2
? As I read from this link, the author suggests regex should be avoided. But as I have noted, when this happened, the event loop still worked, and SELECT queries still ran well.Anyway, I still change it to
const type = q.startsWith("SELECT") || q.startsWith("(SELECT") ? "READER" : "WRITER"
Looking forward to your reply.
The text was updated successfully, but these errors were encountered: