Apache and mod_wsgi returning 504 error when posting specific SVG string

1k views Asked by At

I have a wierd 504 error occuring in Apache + mod_wsgi when I post a specific SVG string. The backend application is Python Flask, but it does not seem to get to the application at all.

Here is one request that returns a 504 error:

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

And here is another one that returns with 200:

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

The difrrerence is that I only removed one character from the POST data

The SVG data is cut down to the smallest one that could produce an error. The original SVG string is much larger.

The error that appears in the apache error log is:

[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

It is interestig that the the error appears in the error log imidietly after I make the request, before the post data upload finishes.

Here are the version numbers we have:

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

Any clues what might be causing this?

UPDATE: We updated mod_wsgi to 4.4.12 and the error message changed in the 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/

This might be related to AWS load balancers in front of the web server. Will try to investigate on that end. http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/ts-elb-error-message.html#ts-elb-errorcodes-http504

0

There are 0 answers