"Lost connection to MySQL server during query" in Google Cloud SQL -



"Lost connection to MySQL server during query" in Google Cloud SQL -

i having weird, recurring not constant, error "2013, 'lost connection mysql server during query'". these premises:

a python app runs around 15-20minutes every hr , stops (hourly scheduled cron)

the app on gce n1-highcpu-2 instance, db on d1 per bundle pricing plan , next mysql flags

max_allowed_packet 1073741824 slow_query_log on log_output table log_queries_not_using_indexes on

the database accessed app , app usage same, around 20 consecutive minutes per hr , nil @ other 40 minutes

the first query

select users.user_id, users.access_token, users.access_token_secret, users.screen_name, metadata.last_id users left outer bring together metadata on users.user_id = metadata.user_id users.enabled = 1

the above query joins 2 tables each around 700 lines longs , not have indexes

after query (which takes 0.2 seconds when runs without problems) app starts without issues

looking @ logs see each time error presents interval between start of query , error 15 minutes.

i've enabled slow query log , query registered this:

start_time: 2014-10-27 13:19:04 query_time: 00:00:00 lock_time: 00:00:00 rows_sent: 760 rows_examined: 1514 db: foobar last_insert_id: 0 insert_id: 0 server_id: 1234567 sql_text: ...

any ideas?

if connection idle 15 min gap seeing gce disconnect idle tcp connection, described @ https://cloud.google.com/compute/docs/troubleshooting#communicatewithinternet. seek workaround page suggests:

sudo /sbin/sysctl -w net.ipv4.tcp_keepalive_time=60 net.ipv4.tcp_keepalive_intvl=60 net.ipv4.tcp_keepalive_probes=5

(you may need set configuration /etc/sysctl.conf create permanent)

google-cloud-sql

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -