Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@realFlowControl
Copy link
Collaborator

@realFlowControl realFlowControl commented Jul 23, 2025

This PR fixes a memory leak that caused the cache to exhaust when running closures with nested functions (dynamic function definitions).

When scheduling closures containing nested functions, php_parallel_cache_closure() was allocating memory from the cache pool for the dynamic_func_defs array. This memory was never properly freed, causing the cache to fill up and eventually trigger a realloc() that could lead to segfaults in case the OS decided to move the entire allocation to a different address.

fixes #345

Copy link

@jkroonza jkroonza left a comment

Choose a reason for hiding this comment

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

Looks good, can confirm this fixes the problem we're seeing!

jkroonza added a commit to jkroonza/gentoo that referenced this pull request Jul 23, 2025
@realFlowControl realFlowControl merged commit 67ee942 into develop Jul 23, 2025
61 of 66 checks passed
jkroonza added a commit to jkroonza/gentoo that referenced this pull request Jul 23, 2025
gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Jul 23, 2025
@realFlowControl realFlowControl deleted the florian/fix-cache-overflow branch July 24, 2025 10:13
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.

segfault crashes with php >=8.2

3 participants