简体   繁体   English

关于在Google App Engine中上传图片的503和400

[英]503 and 400 on uploading images in Google App Engine

Recently I experienced two problems in uploading files to my Java gae app. 最近我在将文件上传到我的Java gae应用程序时遇到了两个问题。 I'm using the tecnique described in the blobstore doc . 我正在使用blobstore doc中描述的tecnique

  1. With regular files, occasionally (let's say 15% of times) the client receives a "503 Service Unavailable". 对于常规文件,偶尔(比如15%的时间)客户端会收到“503 Service Unavailable”。
  2. With high resolution images (example 7000x10000) the client always receives a "400 Bad Request". 对于高分辨率图像(例如7000x10000),客户端始终收到“400 Bad Request”。

On both cases on the server there are no error messages logged, the blobs are written correctly, but the successPath url (the callback of createUploadUrl ) is never called. 在服务器上的两种情况下都没有记录错误消息,blob被正确写入,但是从不调用successPath url( createUploadUrl的回调)。 It seems that the GAE endpoint handling the upload crashes for some reasons. 似乎处理上传的GAE端点由于某些原因而崩溃。

My client is a js XMLHttpRequest, wrapped in GWT: 我的客户端是一个js XMLHttpRequest,包含在GWT中:

public native void uploadWithXMLHttpRequest(UploadForm uploadForm) /*-{
    var fd = new FormData();
    var files = uploadForm.@mypackage.UploadForm::getFiles()();  
    for (var i = 0; i < files.length; i++) {
        fd.append("uploadFile"+i, files[i]);
    }
    var xhr = new XMLHttpRequest();
    //xhr.upload.addEventListeners... omitted
    xhr.open("POST", uploadForm.@mypackage.UploadForm::getUploadUrl()());
    xhr.send(fd);
}

Any ideas for possible causes and solutions/workarounds? 有关可能原因和解决方案/解决方法的任何想法? Thx. 谢谢。

此问题正在由另一位遇到相同问题的用户打开的GAE票证中讨论: https//code.google.com/p/googleappengine/issues/detail? id = 7619(顺便说一下,错误跟踪系统有一个“开始” “功能,允许您为票证投票并接收通知”

Possible reason: 可能的原因:

1 You uploading large file (> 1MB) and writing it all. 1您上传大文件(> 1MB)并将其全部写入。 You should write it portinal: 1 write = 1MB. 你应该把它写成portinal:1 write = 1MB。

2 Your request takes longer than 30 sec - use backend. 2您的请求时间超过30秒 - 使用后端。

In this case the 503 is caused by errors when we write the upload info into your datastore. 在这种情况下,当我们将上传信息写入您的数据存储区时,503是由错误引起的。 As you are using M/S datastore then transient errors are expected from time to time. 在使用M / S数据存储区时,预计会不时出现瞬态错误。 I suggest you convert your app to HRD to minimize the chances of there being errors related to writing the upload information to your datastore. 我建议您将应用转换为HRD,以尽量减少将上传信息写入数据存储区时出现错误的可能性。

The 400 error was generated by your app & is in your application logs. 400错误是由您的应用生成的,并且在您的应用程序日志中。

Try to use Google Cloud Storage, since the blob store service has lot of problem, so google is trying to migrate uses from Blob to GCS support 尝试使用Google云端存储,因为blob商店服务存在很多问题,因此Google正在尝试将用户从Blob迁移到GCS支持

I guess the image resolution can't exceed 8000 in the app engine blob store that is the reason it caused. 我猜应用引擎blob商店中的图像分辨率不能超过8000,这是它造成的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM