0

当我发布特定的 SVG 字符串时,Apache + mod_wsgi 中出现了一个奇怪的 504 错误。后端应用程序是 Python Flask,但它似乎根本无法访问应用程序。

这是一个返回 504 错误的请求:

curl 'https://some.domain.com/api/export/png' --data 'svg=%22%3E%28style' 

这是另一个返回 200 的函数:

curl 'https://some.domain.com/api/export/png' --data 'svg=%22%3E%28styl' 

不同之处在于我只从 POST 数据中删除了一个字符

SVG 数据被缩减为可能产生错误的最小数据。原始的 SVG 字符串要大得多。

apache错误日志中出现的错误是:

[Tue Jun 09 14:27:26 2015] [error] [client X.X.X.X] (104)Connection  reset by peer: mod_wsgi (pid=19254): Unable to get bucket brigade for request., referer: https://some.domain.com/
[Tue Jun 09 14:27:26 2015] [error] [client X.X.X.X] mod_wsgi (pid=19252): Exception occurred processing WSGI script '/var/www/ade/src/interface.wsgi'.
[Tue Jun 09 14:27:26 2015] [error] [client X.X.X.X] IOError: failed to write data

有趣的是,在我发出请求之后,在发布数据上传完成之前,错误日志中就会出现错误。

以下是我们拥有的版本号:

Ubunut 12.04
Apache/2.2.22 (Ubuntu) 
mod_ssl/2.2.22 
OpenSSL/1.0.1 
mod_wsgi/3.3 
Python/2.7.3

任何线索可能导致这种情况?

更新:我们将 mod_wsgi 更新为 4.4.12,并且错误消息在 error.log 中发生了更改

[Wed Jun 10 05:48:35 2015] [error] [client X.X.X.X] mod_wsgi (pid=5019): Request data read error when proxying data to daemon process: Connection reset by peer., referer: http://devade.annalect.com/

这可能与 Web 服务器前面的 AWS 负载均衡器有关。将尝试对此进行调查。 http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/ts-elb-error-message.html#ts-elb-errorcodes-http504

4

0 回答 0