inveniosoftware / cookiecutter-invenio-rdm

Cookiecutter template for a new InvenioRDM instance.
MIT License
4 stars 33 forks source link

uwsgi: disable file wrapper causing issues #248

Closed fenekku closed 1 year ago

fenekku commented 1 year ago

The uWSGI UI application server is in charge of serving files. Without this setting serving large files was failing for us, ergo it might be useful for others. The option is already used in the uWSGI API application server. See https://uwsgi-docs.readthedocs.io/en/latest/ThingsToKnow.html?highlight=wsgi-disable-file-wrapper#things-to-know-best-practices-and-issues-read-it for more details.

ntarocco commented 1 year ago

@fenekku thanks a lot for this PR! Question: is this needed because you have some specific code in your instance that triggers the error, or in general for any RDM instance? I checked various uswgi config that we have, also in prod, but we are not using this setting.

fenekku commented 1 year ago

We don't have specific code in our instance, but as @slint pointed out on Discord: CERN uses an nginx+uWSGI configuration with X-Sendfile that allows files to be served by nginx (if I understood correctly) which is why you probably don't encounter it on your side.

We don't use this approach yet. When I get to it, I will also use this nginx+uWSGI configuration. The issue we were having was a really cryptic OSError: write error in our logs and that setting fixed it.

So yeah, it's probably useful for others who are using the InvenioRDM defaults, but at the same time it's probably solved better by using this other approach of serving files... I don't think there is anything wrong with adding the config given that, but if there is (e.g., maybe it messes with the X-Sendfile approach) feel free to close the PR.

ntarocco commented 1 year ago

Thanks for the explanations! :) @slint any comment? Ok to merge?

slint commented 1 year ago

If this solves the issue for some people, then fine with me to merge as well :)