Skip to content

Allowed memory limit exceeded when unserializing cache. #104

Description

@JohntheFish

php 8.2.14, fpm-fcgi, Apache/2.4.58 (Fedora Linux) OpenSSL/3.1.1

I am getting the error:
wikimedia/less.php/lib/Less/Parser.php:612 Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)

The line in question is:

$cache = unserialize( file_get_contents( $cache_file ) );

For some reason it doesn't like unserializing some rules cached by

file_put_contents( $cache_file, serialize( $rules ) );

I have manually cleared out the cache files and tried again, resulting in the same issue. I have also updated to current (today) less.php code from GitHub.

I have not been able to track down the specific cached rules that result in the issue. I have a gut feeling it could be a cumulative memory leak rather than any specific rule, though no hard evidence to back that up.

For now, I have disabled reading the less parser cache (by hacking line 607 to 0 && file_exists) and everything works, albeit without the benefits of the cache.

The same .less source compiled under php8.1. But now results in the above under php8.2 (though there are some other environment differences, so php version may be a completely spurious clue).

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions