Google App Engine和Cloud SQL:在“读取初始通信包”时,与MySQL服务器的连接失败 [英] Google App Engine and Cloud SQL: Lost connection to MySQL server at 'reading initial communication packet'

查看:1389
本文介绍了Google App Engine和Cloud SQL:在“读取初始通信包”时,与MySQL服务器的连接失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Google App Engine应用程序上安装了一个Django应用程序,该程序连接到Google Cloud SQL,使用 App Engine认证

I have a Django app on Google App Engine app which is connected to a Google Cloud SQL, using the App Engine authentication.

大多数情况下,一切正常,但有时会引起以下异常:

Most of the time everything works fine, but from time to time the following exception is raised:

OperationalError: (2013, "Lost connection to MySQL server at 'reading initial communication packet', system error: 38")

根据文档,则会在以下情况下返回此错误:

According to the docs, this error is returned when:


如果Google Cloud SQL拒绝连接,例如,因为IP地址您的客户端正在连接未被授权。

If Google Cloud SQL rejects the connection, for example, because the IP address your client is connecting from is not authorized.

在我的情况下,这并不太有意义,因为认证是由App Engine服务器。

This doesn't make much sense in my case, because the authentication is done by the App Engine server.

可能会导致这些零星错误?

What might cause these sporadic errors?

推荐答案

我有一个类似的问题,最后联系Google寻求帮助。他们解释说,当他们需要重新启动或移动一个实例时会发生这种情况。如果客户端实例重新启动或被移动到另一个主机服务器(对于各种版本),IP将不匹配并抛出该错误。他们提到服务器可能重新启动修补程序,错误和减速,导致类似的行为(是同样的错误或类似的)。服务器还会尝试更接近实例以增加响应时间。如果您在移动过程中发送请求,则会丢失错误。

I had a similar issue and ended up contacting Google for help. They explained it happens when they need to restart or move an instance. If the client instance restarted or was moved to another host server (for various versions) the IP’s won’t match and throw that error. They mentioned that the servers may restart for patches, errors and slow downs causing a similar behavior (be it the same error or similar). The server also moves to try and be closer to the instances to increase response times. If you send a request during the move it will throw errors.

他们告诉我,我需要在重试卡片中进行代码,类似于处理数据存储超时。记住建立后退机制,重新启动后发送太多请求太快可能会导致崩溃。

They told me I need to code in retry catches incase that happens, similar to how you handle datastore timeouts. Keeping in mind to build in back off mechanics, sending too many request too quickly after a restart could cause a crash.

这种情况发生多久?

这篇关于Google App Engine和Cloud SQL:在“读取初始通信包”时,与MySQL服务器的连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆