Skip to content

fix: add memory_limit and LimitRequestBody for big file upload support#472

Draft
DeepDiver1975 wants to merge 6 commits into
masterfrom
fix/memory-limit-and-limit-request-body
Draft

fix: add memory_limit and LimitRequestBody for big file upload support#472
DeepDiver1975 wants to merge 6 commits into
masterfrom
fix/memory-limit-and-limit-request-body

Conversation

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Summary

Two related gaps in big file upload support surfaced by owncloud/core#41611:

  • memory_limit not set in Docker: owncloud.ini.tmpl sets upload_max_filesize and post_max_size via OWNCLOUD_MAX_UPLOAD, but memory_limit was absent. For v24.04 (PHP 8.3 + mod_php8), the .htaccess <IfModule mod_php7.c> block doesn't fire, so PHP falls back to its compiled-in default of 128M instead of the intended 512M. For v22.04 (PHP 7.4), the .htaccess block does fire, but having it in the ini is more explicit and Docker-idiomatic.

  • LimitRequestBody not explicit: apache.conf.tmpl had no LimitRequestBody directive. Apache 2.4's default is 0 (unlimited) for regular files, but some Ubuntu builds/configs cap it at 1 GiB. Setting it explicitly to 0 ensures unlimited request body size regardless of distro defaults.

Changes

File Change
v22.04/overlay/etc/templates/owncloud.ini.tmpl Add memory_limit = "{{ .Env.OWNCLOUD_MEMORY_LIMIT }}"
v24.04/overlay/etc/templates/owncloud.ini.tmpl Same
v22.04/overlay/etc/templates/apache.conf.tmpl Add LimitRequestBody 0 inside <Directory> block
v24.04/overlay/etc/templates/apache.conf.tmpl Same
v22.04/overlay/etc/entrypoint.d/10-base.sh Add OWNCLOUD_MEMORY_LIMIT default 512M
v24.04/overlay/etc/entrypoint.d/10-base.sh Same

Note: OWNCLOUD_MEMORY_LIMIT is not yet documented in ENVIRONMENT.md — that can be addressed in a follow-up.

@DeepDiver1975 DeepDiver1975 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds OWNCLOUD_MEMORY_LIMIT (default 512M) to both v22.04 and v24.04 images, sets it in the PHP ini template, and adds LimitRequestBody 0 to the Apache vhost config. Changes are applied symmetrically across both version directories.

The fix is correct and well-targeted. A few notes:

LimitRequestBody 0: Setting this to 0 (unlimited) in the <Directory> block is the right approach for an ownCloud upload-focused image. Just be aware this applies to the entire document root — if any application code is served under the same vhost that should have request size limits, this would remove them. For a dedicated ownCloud container this is a non-issue.

memory_limit in ini vs .htaccess: The Docker-idiomatic approach (PHP ini) is correct here and avoids the mod_php8 module-name dependency. The companion owncloud/core#41612 adds the .htaccess block for non-Docker Apache installs.

ENVIRONMENT.md gap: The PR description notes OWNCLOUD_MEMORY_LIMIT is not yet documented. Worth a follow-up PR or adding it here — undocumented env vars in Docker images tend to stay undiscovered.

Symmetric v22.04/v24.04 changes: Both versions are updated identically, which is correct.

Safe to merge once CI passes.

@DeepDiver1975

Copy link
Copy Markdown
Contributor Author

I need to review this first if this is needed ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants