is there any compatiblity issue of this driver with the google cloud sql ?
https://developers.google.com/cloud-sql/
it seems that we keep getting time out after a few minutes of idle time.
do anyone in the community face the same issue?
thx
Are you able to connect using command line client?
yeap. it does.
i kinda figured out the issue, the google cloud sql will 'sleep' after 15min of inactivity - for the pay per use and 12 hours of inactivity - for the package billing.
this morning we experience high cpu usage in the server, which might cause more error than what it should with the db connection.
so will monitor again tomorrow if its still giving us the timeout error.
there r other people who face the same issue too :
http://stackoverflow.com/questions/21457437/first-connect-from-prestashop-to-google-cloud-sql-always-fails
it seems that we keep getting time out after a few minutes of idle time.
Can you post the timeout error you're getting?
@badoet I'm closing this issue for now. Please post the timeout error you're getting and I can always re-open the issue.
Hi dougwilson
I'm getting the following error when i tried to connect after some 15minutes
{"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"read","fatal":true}
Hi @lokeshwebmobi , can you post the stack trace for that error as well? The error itself is saying "Node.js tried to read from a TCP socket that was previously established, but timed out attempting to do so".
Just following up for posterity..
Referring to Cloud SQL docs: https://cloud.google.com/sql/docs/compute-engine-access
To keep long-lived unused connections alive, you can set the TCP keepalive. The following commands set the TCP keepalive value to one minute and make the configuration permanent across instance reboots.
# Display the current tcp_keepalive_time value.
$ cat /proc/sys/net/ipv4/tcp_keepalive_time
# Set tcp_keepalive_time to 60 seconds and make it permanent across reboots.
$ echo 'net.ipv4.tcp_keepalive_time = 60' | sudo tee -a /etc/sysctl.conf
# Apply the change.
$ sudo /sbin/sysctl --load=/etc/sysctl.conf
# Display the tcp_keepalive_time value to verify the change was applied.
$ cat /proc/sys/net/ipv4/tcp_keepalive_time
@tzmartin setting the keepalive values is not enough, node-mysql should enable keepalive on the socket it uses:
https://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay
You can see whether the keepalive is active with netstat -o, it will tell you in the last column called Timer.
Most helpful comment
@tzmartin setting the keepalive values is not enough, node-mysql should enable keepalive on the socket it uses:
https://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay
You can see whether the keepalive is active with
netstat -o, it will tell you in the last column calledTimer.