【问题标题】:Google App Engine 500 Error, but why?Google App Engine 500 错误,但为什么?
【发布时间】:2010-09-20 18:21:59
【问题描述】:

部署后,我在 App Engine 中收到以下错误。有人知道原因吗?它有时会导致错误页面。看来simplejson是原因...

根据http://code.google.com/status/appengine/,一切都应该相应地工作。

  09-20 11:03AM 56.027 / 500 55902ms 240cpu_ms 0kb Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; nl-nl) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5,gzip(gfe)
 - - [20/Sep/2010:11:04:51 -0700] "GET / HTTP/1.1" 500 0 - "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; nl-nl) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5,gzip(gfe)" "" ms=55903 cpu_ms=240 api_cpu_ms=0 cpm_usd=0.006723 loading_request=1 pending_ms=1266
E 09-20 11:04AM 51.915
<class 'google.appengine.runtime.DeadlineExceededError'>: 
Traceback (most recent call last):
  File "/base/data/home/apps//7.344918194765199957/main.py", line 11, in <module>
    from logic import home, program, image, searchhandler, twitter, sitemap, feed
  File "/base/data/home/apps/7.344918194765199957/logic/home.py", line 14, in <module>
    from django.utils import simplejson
  File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/__init__.py", line 95, in <module>
    from django.utils.simplejson.decoder import JSONDecoder
  File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/decoder.py", line 6, in <module>
    from django.utils.simplejson.scanner import Scanner, pattern
  File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/scanner.py", line 3, in <module>
    """
I 09-20 11:04AM 51.924
This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.

这是页面将显示的错误:

Error: Server Error
The server encountered an error and could not complete your request.

If the problem persists, please report your problem and mention this error message and the query that caused it.

看来这不是导致 500 错误的唯一错误。因为大多数时候这似乎是原因:

09-20 11:37AM 18.229 /ohohcherso.html 500 11007ms 0cpu_ms 0kb Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3,gzip(gfe),gzip(gfe)
94.209.194.233 - sammiestoel [20/Sep/2010:11:37:29 -0700] "GET /ohohcherso.html HTTP/1.1" 500 0 "http://www.tweetstream.nl/index.html" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3,gzip(gfe),gzip(gfe)" "www.tweetstream.nl" ms=11008 cpu_ms=0 api_cpu_ms=0 cpm_usd=0.000148
W 09-20 11:37AM 29.237
Request was aborted after waiting too long to attempt to service your request. This may happen sporadically when the App Engine serving cluster is under unexpectedly high or uneven load. If you see this message frequently, please contact the App Engine team.

【问题讨论】:

  • 真正的错误似乎不见了。 File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/scanner.py", line 3, in &lt;module&gt; 之后应该有 2 行真正的错误。或者Traceback上方的一行
  • 用完整的错误代码编辑了问题。对不起..

标签: google-app-engine


【解决方案1】:

这是你的问题:

<class 'google.appengine.runtime.DeadlineExceededError'>

您的页面太慢,应该在 30 秒内加载。否则 App Engine 会杀死它。

http://code.google.com/appengine/docs/python/runtime.html#The_Request_Timer

【讨论】:

  • 谢谢你的链接,我不知道。但是你能检查一下我的最后一个错误吗?现在一直在导致该错误..
  • @Sam S:根据我的经验,在发布您的应用程序后,这是一个很常见的错误。应用程序可能需要几分钟才能完全运行,因此第一次您只需稍等片刻即可。
  • 好的,我也会研究优化。我应该能够通过优化来修复 DeadlineExceededError 吗?感谢您的回答,如果没有更好的答案,将其标记为已接受;)
  • @Sam S:是的,完全有可能在这段时间内运行页面。我可以建议您尝试使用 Kay 框架吗?它基于 Django,并带有一些特定于 App Engine 的修复:code.google.com/p/kay-framework
  • 我目前也在经历这个问题...我使用后台线程 ssh 到 ec2: cmd = "ssh -o 'StrictHostKeyChecking no' -i {0} ubuntu@{1} \"pwd\"".format(keyfile, ip) 成功 = os.system(cmd)。由于完成连接需要一些时间,所以它会在一段时间后因“GET /_ah/background HTTP/1.1”500 错误而被终止。但是我真的需要做ssh.....我该如何解决这个问题?
【解决方案2】:

看来真正的问题是文件中有一个“”作为一些 cmets,这会产生 500 错误。该应用程序现在运行顺利。我很高兴终于找到它。

因此,如果您收到此错误,请先检查您是否以错误的方式制作了 cmets!

【讨论】:

    猜你喜欢
    • 2013-06-03
    • 2020-02-20
    • 1970-01-01
    • 2012-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多