[Flask] File upload breaks for files with size >64kb on ARM based apache wsgi servers

Michael Bayer lists at mjbayer.de
Wed Oct 3 09:41:58 EDT 2018


Am 02.10.2018 um 23:39 schrieb Geert Stappers:
> On Tue, Oct 02, 2018 at 05:05:47PM +0200, Michael Bayer wrote:
>> Hi everyone,
>>
>> I discovered a funny behavior of my flask app, when running on ARM
>> based apache wsgi servers. Could you please give me some hints to
>> debug this?
>>
>> I have a flask application, that supports file upload.
>> It runs on an ARM based debian stable server with apache wsgi.
>> If I upload small files, everything is fine. The problem appears,
>> when I upload files with a file size >64kb. The famous "Bad request
>> - The browser (or proxy) sent a request that this server could not
>> understand." pops up.
>>
>> Things I tried out so far:
>> - Deploying my flask app to my productive ARM based webserver (debian
>>    stable): Here I discovered the issue.
>> - Running in flask's development wsgi server on my Development PC:
>>     No problem, I can upload files with any size I want.
>> - Clean debian stable installation in a virtualbox on my Development
>>    PC (AMD64) same packages as my productive server, but AMD64 instead
>>    of armhf (apache, mod_wsgi): Again no problems at all.
>> - Clean installation of raspian on a spare ARM Raspberry Pi (based on
>>    debian 9) with apache, mod_wsgi: Here comes the problem again!
>> - Increase apache LogLevel to debug -> no error logged
>> - Activate FileLogging inside my flask app -> no error logged
>>
>> Have you seen anything like this?
> No.
>
> Thing that intriges me, is that 64K   is a 16-bit limit.
> ARMHF versus AMD64  is 32-bit vs 64-bit ...
Thanks for your answer!
Yes, this is strange. I also don't have an explanation
>
>> I unfortunately do not have much experience with web servers/development
>> so I'm stuck with my debugging approaches :/
>>
>> What could I do besides that?
> Consider it a none flask problem, it will allow you to look at Apache,
> uWSGI, Python and other links in the chain. Is a webproxy involved??

There is no proxy in the network.


>> What information do you need from my side?
>> I can provide any code/configuration you need.
> That will help reproducing the problem.
I created a minimal example to reproduce the error:
https://github.com/mjbayer/flask-upload-issue-arm

This repo contains code, configuration and example files that can be 
used for upload.

Here is a demo Raspberry Pi (just for that purpose) to try it out:
http://rgb.mjbayer.de/trackdb/
(I could also give ssh access to the Raspi if required)

If you run the code in flasks development wsgi server or apache mod_wsgi 
on AMD64, you will not see the issue.


Michael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20181003/34110a93/attachment.html>


More information about the Flask mailing list