From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-php/pecl-parallel/, dev-php/pecl-parallel/files/
Date: Wed, 23 Jul 2025 17:45:11 +0000 (UTC) [thread overview]
Message-ID: <1753292674.58e552cfa7592cac2a37bb63e1fac4b0121fb2af.sam@gentoo> (raw)
commit: 58e552cfa7592cac2a37bb63e1fac4b0121fb2af
Author: Jaco Kroon <jaco <AT> uls <DOT> co <DOT> za>
AuthorDate: Wed Jul 23 14:28:52 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jul 23 17:44:34 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=58e552cf
dev-php/pecl-parallel: add 1.2.7-r1
See also:
https://github.com/krakjoe/parallel/issues/345
https://github.com/krakjoe/parallel/pull/347
Closes: https://bugs.gentoo.org/957101
Signed-off-by: Jaco Kroon <jaco <AT> uls.co.za>
Part-of: https://github.com/gentoo/gentoo/pull/43125
Signed-off-by: Sam James <sam <AT> gentoo.org>
...llel-1.2.7-bug933981-crash-due-to-memleak.patch | 58 ++++++++++++++++++++++
.../pecl-parallel/pecl-parallel-1.2.7-r1.ebuild | 23 +++++++++
2 files changed, 81 insertions(+)
diff --git a/dev-php/pecl-parallel/files/pecl-parallel-1.2.7-bug933981-crash-due-to-memleak.patch b/dev-php/pecl-parallel/files/pecl-parallel-1.2.7-bug933981-crash-due-to-memleak.patch
new file mode 100644
index 000000000000..c08f8fab3889
--- /dev/null
+++ b/dev-php/pecl-parallel/files/pecl-parallel-1.2.7-bug933981-crash-due-to-memleak.patch
@@ -0,0 +1,58 @@
+https://bugs.gentoo.org/957101
+https://github.com/krakjoe/parallel/issues/345
+https://github.com/krakjoe/parallel/pull/347
+
+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.
+
+From d4fa9a8a490dbdd3caac5f9a0ef384838c078a6f Mon Sep 17 00:00:00 2001
+From: Florian Engelhardt <flo@dotbox.org>
+Date: Wed, 23 Jul 2025 16:19:48 +0200
+Subject: [PATCH] fix cache overflow
+
+---
+ src/cache.c | 5 ++++-
+ src/scheduler.c | 5 ++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/cache.c b/src/cache.c
+index afbfb6d..ed90cc0 100644
+--- a/src/cache.c
++++ b/src/cache.c
+@@ -394,7 +394,10 @@ zend_function* php_parallel_cache_closure(const zend_function *source, zend_func
+ #if PHP_VERSION_ID >= 80100
+ if (source->op_array.num_dynamic_func_defs) {
+ uint32_t it = 0;
+- closure->op_array.dynamic_func_defs = php_parallel_cache_copy_mem(
++ /* Use regular persistent memory for dynamic_func_defs array, not cache pool */
++ closure->op_array.dynamic_func_defs = pemalloc(
++ sizeof(zend_op_array*) * source->op_array.num_dynamic_func_defs, 1);
++ memcpy(closure->op_array.dynamic_func_defs,
+ source->op_array.dynamic_func_defs,
+ sizeof(zend_op_array*) * source->op_array.num_dynamic_func_defs);
+ while (it < source->op_array.num_dynamic_func_defs) {
+diff --git a/src/scheduler.c b/src/scheduler.c
+index 1f92bfa..8820e96 100644
+--- a/src/scheduler.c
++++ b/src/scheduler.c
+@@ -258,9 +258,12 @@ static void php_parallel_scheduler_clean(zend_function *function) {
+ while (it < function->op_array.num_dynamic_func_defs) {
+ php_parallel_scheduler_clean(
+ (zend_function*) function->op_array.dynamic_func_defs[it]);
+- pefree(function->op_array.dynamic_func_defs[it],1);
++ pefree(function->op_array.dynamic_func_defs[it], 1);
+ it++;
+ }
++ /* Free the dynamic_func_defs array itself */
++ pefree(function->op_array.dynamic_func_defs, 1);
++ function->op_array.dynamic_func_defs = NULL;
+ }
+ #endif
+ }
diff --git a/dev-php/pecl-parallel/pecl-parallel-1.2.7-r1.ebuild b/dev-php/pecl-parallel/pecl-parallel-1.2.7-r1.ebuild
new file mode 100644
index 000000000000..d1ce4a21c82e
--- /dev/null
+++ b/dev-php/pecl-parallel/pecl-parallel-1.2.7-r1.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="8"
+
+PHP_EXT_INI="yes"
+PHP_EXT_NAME="parallel"
+PHP_EXT_NEEDED_USE="threads"
+PHP_EXT_ZENDEXT="no"
+USE_PHP="php8-2 php8-3"
+
+inherit php-ext-pecl-r3
+
+DESCRIPTION="A succint parallel concurrency API for PHP"
+SRC_URI="${SRC_URI} -> ${P}.tgz"
+
+PATCHES=(
+ "${FILESDIR}/pecl-parallel-1.2.7-bug933981-crash-due-to-memleak.patch"
+)
+
+LICENSE="PHP-3.01"
+SLOT="8"
+KEYWORDS="~amd64 ~x86"
reply other threads:[~2025-07-23 17:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1753292674.58e552cfa7592cac2a37bb63e1fac4b0121fb2af.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox