json - 服务器响应在中途被切断

我有一个返回 json 响应的 REST API。有时(而且似乎是完全随机的),json 响应在中途被切断。所以返回的 json 字符串看起来像:

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

我很确定这不是编码问题,因为截止点不断改变位置,具体取决于返回的 json 字符串。我也没有找到会发生截断的特定响应大小(我见过 65kb 没有被截断,而 40kb 会截断)。

在中断发生时查看响应 header :

{
    "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 备份。我检查了日志,发现:

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 授予适当的权限。

已修复!

非常感谢samvermette,您的问答让我走上了正轨。

https://stackoverflow.com/questions/10557927/