Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot allocate memory with tracing JIT on 8.4.4 #17868

Open
jbcollings opened this issue Feb 20, 2025 · 1 comment · May be fixed by #17869
Open

Cannot allocate memory with tracing JIT on 8.4.4 #17868

jbcollings opened this issue Feb 20, 2025 · 1 comment · May be fixed by #17869

Comments

@jbcollings
Copy link

Description

The following errors occur approximately 30% to 40% of the time on PHP 8.4.4 when JIT is enabled with CRTO trigger set to 5 (tracing) and an optimization level greater than or equal to 2. This issue occurs only on 8.4.4 and is not reproducible on 8.4.3 with any JIT configuration. The issue does not occur on 8.4.4 when tracing JIT is disabled.

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 5325709312 bytes) (tried to allocate 884818088 bytes)
Error: Allowed memory size of 6442450944 bytes exhausted (tried to allocate 18446744072005976232 bytes)

It will also simply terminate with the message Killed and no further details (rarely).

Steps to reproduce:

Run the following command using any standard Symfony application with debug=false. The issue does not appear to occur when debug=true.

php bin/console cache:clear --env=prod

PHP Version

8.4.4

Operating System

Rocky Linux 8/9

@nielsdos
Copy link
Member

nielsdos commented Feb 20, 2025

(tried to allocate 18446744072005976232 bytes)

This seems similar to an error found in #17866, coincidentally, also uses a symfony component and the issue also appeared in 8.4.4...
I'll try to have a look.
EDIT: op_array->cache_size looks like a garbage value...
EDIT 2: bisect points to 28b448a but that doesn't seem like the root cause, I think it only revealed this bug and this bug is older.

@nielsdos nielsdos self-assigned this Feb 20, 2025
nielsdos added a commit to nielsdos/php-src that referenced this issue Feb 20, 2025
The generated code tries to initialize the run time cache for even
internal closures, but it should only initialize the run time cache for
user closures. We fix this by adding a check for the function type.
If `func` is known, then we can check the type at code generation time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants