open-contracting / cove-ocds

OCDS Data Review Tool

Home Page:https://ocds-data-review-tool.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

503 error when submitting JSON data using paste input

duncandewhurst opened this issue · comments

The DRT returns a 503 error when I submit the following data using paste input: (https://gist.github.com/duncandewhurst/b15299d96b97304c87cb16a8b201c3e6

image

I was able to submit the data using file upload without any problems: https://standard.open-contracting.org/review/data/59a0ea23-43f5-4cce-bccc-1b4fddaec2c5

The paste data is 2MB – not sure if the error is related to the size. We aren't using any Apache directives like LimitRequestBody (which should yield a 4xx error instead, anyway), and I don't think the defaults prevent 2MB POST data. I don't see anything in the uWSGI configuration related to the size (e.g. no use of limit-post).

Aha. In /var/log/uwsgi/cove.log:

ERROR 2021-10-12 15:35:03,949 exception 32374 139950347654592 Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
WARNING 2021-10-12 15:35:04,263 log 32374 139950347654592 Bad Request: /review/
{address space usage: 462708736 bytes/441MB} {rss usage: 85929984 bytes/81MB} [pid: 32374|app: 0|req: 45611/257386] 174.93.38.91 () {72 vars in 1637 bytes} [Tue Oct 12 15:35:03 2021] POST /review/ => generated 143 bytes in 318 msecs (HTTP/1.1 400) 7 headers in 213 bytes (1 switches on core 0)

So we need to set https://docs.djangoproject.com/en/3.2/ref/settings/#data-upload-max-memory-size in Django's settings.py.


I also checked:

/var/log/apache2/error.log:

[Tue Oct 12 15:35:04.304859 2021] [:error] [pid 4891:tid 140667359524608] (32)Broken pipe: [client 174.93.38.91:0] AH10098: sending data to httpd-UDS:0 failed, referer: https://standard.open-contracting.org/review/

/var/log/apache2/other_vhosts_access.log

cove.live3.cove.opencontracting.uk0.bigv.io:443 174.93.38.91 - - [12/Oct/2021:15:35:03 +0000] "POST /review/ HTTP/1.1" 503 5410 "https://standard.open-contracting.org/review/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15"

Deployed. It works now.

Thanks!