Google App Engine + Google Drive API 导致错误:root:php 失败 (255)


Google App Engine + Google Drive API causes ERROR:root:php failure (255)

在我的设置中,我使用的是PHP(Zend Framework 2)。一切正常,异常在我的应用程序中也正常工作。问题是,当我调用Google Drive API(通过Google PHP库)时,我的应用程序冻结了大约60秒,然后服务器日志打印出来:

ERROR:root:php failure (255) with:
stdout:
X-Powered-By: PHP/5.5.26
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html

此外,它开始输出如此多的纯PHP代码,以至于PHPStorm抱怨:

too much output to process

输出不会停止,它只是继续。它似乎在日志中输出整个代码库,并使本地 GAE 服务器崩溃。但重要的是,输出的第一个对象实际上是 Google 服务异常:

object(Google_Service_Exception)#453 (8) {
  ["errors":protected]=>
  array(1) {
    [0]=>
    array(5) {
      ["domain"]=>
      string(6) "global"
      ["reason"]=>
      string(8) "notFound"
      ["message"]=>
      string(60) "File not found: xxxxxxx"
      ["locationType"]=>
      string(5) "other"
      ["location"]=>
      string(4) "file"
    }
  }
  ["message":protected]=>
  string(320) "{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "notFound",
    "message": "File not found: xxxxxxx",
    "locationType": "other",
    "location": "file"
   }
  ],
  "code": 404,
  "message": "File not found: xxxxxxx"
 }
}

我的问题是到底发生了什么?为什么当Google云端硬盘客户端出现异常或错误时,每次都会发生这种情况。否则它工作得很好。它不应该只是抛出异常吗?我迷路了。

解决了这个问题。问题是Zend Framework 2配置在发生错误时转储了整个错误数据。出于某种原因,这不是其他异常的问题,但是对于Google PHP库,转储量很大,从而导致服务器崩溃。