Skip to content

Memory Limit for Updates #90

Description

@danielmarschall

The giant update to OIDplus version 2.0.3.0 is stored in this patch file:
https://oidplus.com/updates/v3/changescript_2.0.3.0.txt

On a server with 128MB RAM it fails with:
AH01071: Got error 'PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2097152 bytes) in /...httpdocs/public/.../update_YOEDmcL9bq.tmp.php on line 8016', referer: ....

It turns out that the PHP file ITSELF (the opcodes, the string literals etc) takes the space, and there does not seem to be a memory-leak.

For some reason, though, the script seems to crash during execution and not at the beginning. On this server system, PHP might compile while it executes the file.

On my Windows machine with a standalone PHP interpreter, the following lines show approx 200 MB memory usage, at the very first line. It does not increase very much during execution.

echo memory_get_usage(true), "\n";
echo memory_get_peak_usage(true), "\n";

Things to consider:

  1. Should the patch-file-generator try to estimate the required memory and show an error message if the system cannot ensure this memory? This would avoid that a system is bricked if half of the files are updated and half are old.
  2. Can or should we set set_memory_limit(), or will this make problems if the system does not support the amount and/or due to security restrictions?
  3. On this system, can we somehow enforce that the script will be fully compiled (and the error happens) before the update begins to change files?
  4. Should the patch-file-generator try to split giant updates into smaller files?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions