Skip to content

Conversation

@unreal4u
Copy link

Description

While exporting tables using compression, we would sometimes get invalid files. We turned out to be hitting PHP maximum memory limit.
This commit will add a small non-obstrusive hint about that.

Screenshot_2025-04-22_15-14-01

Fixes # -> (no issue made for it)

Before submitting pull request, please review the following checklist:

  • Make sure you have read our CONTRIBUTING.md document.
  • Make sure you are making a pull request against the correct branch. For example, for bug fixes in a released version use the corresponding QA branch and for new features use the master branch. If you have a doubt, you can ask as a comment in the bug report or on the mailing list.
  • Every commit has proper Signed-off-by line as described in our DCO. This ensures that the work you're submitting is your own creation.
  • Every commit has a descriptive commit message.
  • Every commit is needed on its own, if you have just minor fixes to previous commits, you can squash them.
  • Any new functionality is covered by tests.

I did not create a test for this, since the change is purely cosmetic and doesn't fix anything.

@unreal4u unreal4u force-pushed the show-note-on-compression-export-options branch from d9bbda4 to ac89949 Compare April 22, 2025 13:19
@kamil-tekiela
Copy link
Contributor

How does max_upload_size affect that?

@unreal4u
Copy link
Author

unreal4u commented Apr 22, 2025

How does max_upload_size affect that?

If you happen to compress a table that surpasses the size, it would end up downloading a small 191 byte file which -when opened with a hex editor- would simply state:

<br />
<b>Fatal error</b>:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 334069912 bytes) in <b>/var/www/html/libraries/classes/Export.php</b> on line <b>135</b><br />

@kamil-tekiela
Copy link
Contributor

Yes, so the error talks about memory_limit and not about max_upload_size

@unreal4u
Copy link
Author

oh doh you're absolutely right hahaha

I did previously look into the upload limit so totally forgot we had memory limit as well :) my bad!

Shows up a small hint dialog explaining that compression
uses PHP memory which can produce invalid files

Signed-off-by: camilo <camilo@jouwweb.nl>
@unreal4u unreal4u force-pushed the show-note-on-compression-export-options branch from ac89949 to 758c8cd Compare April 22, 2025 14:01
@unreal4u unreal4u marked this pull request as draft April 23, 2025 09:20
<label for="compression" class="col-form-label">{{ t('Compression:') }}</label>
<label for="compression" class="col-form-label">
{{ t('Compression:') }}
{{ show_hint('Compressing big tables requires PHP memory. Be aware that this might produce invalid files %s'|format(get_formatted_maximum_upload_size(export_memory_limit))) }}
Copy link
Member

@williamdes williamdes Apr 28, 2025

Choose a reason for hiding this comment

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

Can you post a screenshot?
the sentence seems incomplete

Also, we could find a way to to figure out out of memory and abort the export

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{{ show_hint('Compressing big tables requires PHP memory. Be aware that this might produce invalid files %s'|format(get_formatted_maximum_upload_size(export_memory_limit))) }}
{{ show_hint('Compressing big tables requires PHP memory. Be aware that this might produce invalid files. Current memory limit: %s'|format(get_formatted_maximum_upload_size(export_memory_limit))) }}

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.

4 participants