Cloud SQL cluster failed with error: no such file or directory

I have a Django app on App Engine that connects to a Cloud Sql server.

Lately, some of the requests started raising the following error from MySQLdb


OperationalError: (2062, 'Cloud SQL socket open failed with error: No such file or directory')


The error occurs sporadically and is therefore difficult to debug.


source to share

1 answer

Found the answer here .

Bylaw from GAE 1.9.5, the number of concurrent db requests per instance is limited to 12 . The solution was to limit the number of concurrent requests per instance to 12 by changing app.yaml


  max_concurrent_requests: 12


For those not using GAE or Automatic Scaling modules, the solution might be to disable concurrent requests completely by setting threadsafe: false

. Please note that this can significantly increase the number of copies.

Another solution is to use a kind of connection pool with a limited number of simultaneous connections. I haven't tried it myself.



All Articles