服务器响应被切断一半 [英] Server response gets cut off half way through

查看:70
本文介绍了服务器响应被切断一半的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个REST API,可返回json响应.有时(似乎是完全随机的),json响应会在中途中断.因此,返回的json字符串如下所示:

I have a REST API that returns json responses. Sometimes (and what seems to be at completely random), the json response gets cut off half-way through. So the returned json string looks like:

...route_short_name":"135","route_long_name":"Secte // end of response

我很确定这不是编码问题,因为截止点会根据返回的json字符串不断变化位置.我也没有找到截断发生的特定响应大小(我发现65kb不会截断,而40kbs会截断).

I'm pretty sure it's not an encoding issue because the cut off point keeps changing position, depending on the json string that's returned. I haven't found a particular response size either for which the cut off happens (I've seen 65kb not get cut off, whereas 40kbs would).

在发生中断时查看响应标头:

Looking at the response header when the cut off does happen:

{
    "Cache-Control" = "must-revalidate, private, max-age=0";
    Connection = "keep-alive";
    "Content-Type" = "application/json; charset=utf-8";
    Date = "Fri, 11 May 2012 19:58:36 GMT";
    Etag = "\"f36e55529c131f9c043b01e965e5f291\"";
    Server = "nginx/1.0.14";
    "Transfer-Encoding" = Identity;
    "X-Rack-Cache" = miss;
    "X-Runtime" = "0.739158";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

也不打铃.有人吗?

推荐答案

我遇到了同样的问题:

Nginx切断了FastCGI后端的一些响应.例如,我无法从PhpMyAdmin生成正确的SQL备份.我检查了日志,发现了这一点:

Nginx cut off some responses from the FastCGI backend. For example, I couldn't generate a proper SQL backup from PhpMyAdmin. I checked the logs and found this:

2012/10/15 02:28:14 [crit] 16443#0:* 14534527 open() "/usr/local/nginx/fastcgi_temp/4/81/0000004814"失败(13:权限 拒绝),同时读取上游,客户端: *,服务器: ,请求: "POST/ HTTP/1.1",上游:"fastcgi://127.0.0.1:9000",主机: " ",引荐来源网址:"http:// */server_export.php?token = ** "

2012/10/15 02:28:14 [crit] 16443#0: *14534527 open() "/usr/local/nginx/fastcgi_temp/4/81/0000004814" failed (13: Permission denied) while reading upstream, client: *, server: , request: "POST / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "", referrer: "http://*/server_export.php?token=**"

我要做的所有修复工作是为/usr/local/nginx/fastcgi_temp文件夹以及client_body_temp赋予适当的权限.

All I had to do to fix it was to give proper permissions to the /usr/local/nginx/fastcgi_temp folder, as well as client_body_temp.

已修复!

非常感谢 samvermette ,您的问题与解答;答案使我走上了正轨.

Thanks a lot samvermette, your Question & Answer put me on the right track.

这篇关于服务器响应被切断一半的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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