2nd gen flexible environment "Lost connection to MySQL server at 'reading initial communication packet'"

845 views
Skip to first unread message

Vlad Miller

unread,
Jun 10, 2016, 8:13:45 AM6/10/16
to Google Cloud SQL discuss
Hello,

I am unable to connect to 2nd gen google cloud sql instance from google app engine instance. When I try to connect it simply fails with 

Lost connection to MySQL server at 'reading initial communication packet'
 
The weird thing is that I have another GAE service in the same project which successfully connects to this sql instance via socket. Here is the piece of configuration 

beta_settings:
  cloud_sql_instances
: xxxxx-test:us-central1:xxxxx-development


Socket is available

root@4badd097c0d5:/app# ls -lA /cloudsql/xxxxx-test\:us-central1\:xxxxxxx-development srwxrwxrwx 1 root root 0 Jun 10 11:51 /cloudsql/xxxxx-test:us-central1:xxxxxxxx-development

This is not related to my app's code because 

root@4badd097c0d5:/app# mysql --socket=/cloudsql/xxxxx-test\:us-central1\:xxxxxxx-development
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

Any advice how to proceed here?

Adam (Cloud Platform Support)

unread,
Jun 10, 2016, 1:56:27 PM6/10/16
to Google Cloud SQL discuss
I'd suggest the following:

- Check the CloudSQL instance logs.
- Check that all apps in the project are authorized under Access Control -> Authorization in the Cloud Console.
- Try a re-deploy of the application.

Vadim Berezniker

unread,
Jun 10, 2016, 1:58:15 PM6/10/16
to google-cloud...@googlegroups.com
For troubleshooting, you can also look at the Cloud SQL Proxy logs that may contain more information about the problem.

On the VM that is having the issue, run "docker ps", find the entry for the Cloud SQL Proxy and note down the Container ID.
Then run "docker logs <CONTAINER ID>" to see the logs from the proxy.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/1c2b3b75-9090-40ef-9b34-aa2a62143cf9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vlad Miller

unread,
Jun 10, 2016, 3:35:20 PM6/10/16
to Google Cloud SQL discuss
@Adam, there is absolutely nothing interesting in the CloudSQL logs. Also how do I check that apps have access to cloudsql? All GAE services in the same Project with CloudSQL. You mean that I can authorize individual services? 

I also tried to redeploy multiple times, no luck.

@Vadim container logs only showing my application logs, nothing from SQL Proxy.

Vadim Berezniker

unread,
Jun 10, 2016, 4:26:40 PM6/10/16
to Google Cloud SQL discuss
Hmmm, interesting. Could you grep the VM logs (around boot time) for "proxy"?
Perhaps something caused the proxy not to start successfully. 

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-d...@googlegroups.com.

Vlad Miller

unread,
Jun 10, 2016, 4:31:18 PM6/10/16
to Google Cloud SQL discuss
@Vadim which exactly logs I'm looking at? VM itself? Or Docker container? 

Vadim Berezniker

unread,
Jun 10, 2016, 5:35:36 PM6/10/16
to Google Cloud SQL discuss
Yes, the logs for the VM itself. I suspect if the proxy is not running, then something might have gone wrong at startup time and if that's the case we'd love to know what happened.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-d...@googlegroups.com.

Adam (Cloud Platform Support)

unread,
Jun 12, 2016, 1:40:26 PM6/12/16
to Google Cloud SQL discuss
The 'Authorization' section should say 'Apps in this project: All authorized' however I noticed it always says this regardless of actual permissions set, so a better place to check is under 'IAM & Admin' that the Compute Engine default service account and App Engine default service account both have at least 'Editor' role.

The VM proxy logs may be a better indication of what happened though.
Reply all
Reply to author
Forward
0 new messages