tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

php-apcu file descriptor leak



Hello

It came to my attention that php-apcu leaks two file descriptors each
time apache gets a SIGHUP or SIGUSR1. The offending code is about
locks, which by default use fcntl. It can also use pthread_rwlock,
pthread_mutex, and on x86, spinlocks. The cleanup code in apc_cache.c
and apc_sma.c is unsable to free locks because it does not keep track
of what process use it.

That code should be fixed, but in the meantime spinlocks seem desirable 
because they are faster, and the destroy operation is nilpotent, which
means it does not leak a resource. Any objection to committing this 
to pkgsrc?


Index: www/php-apcu/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/www/php-apcu/Makefile,v
retrieving revision 1.19
diff -U4 -r1.19 Makefile
--- www/php-apcu/Makefile       7 Mar 2021 14:47:58 -0000       1.19
+++ www/php-apcu/Makefile       9 Sep 2021 14:16:17 -0000
@@ -1,8 +1,9 @@
 # $NetBSD: Makefile,v 1.19 2021/03/07 14:47:58 taca Exp $
 
 MODNAME=       apcu
 PECL_VERSION=  5.1.20
+PKGREVISION=   1
 CATEGORIES+=   sysutils
 
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
 COMMENT=       APCu - APC User Cache
@@ -12,8 +13,15 @@
 
 GNU_CONFIGURE_STRICT=  no # --with-pcre-dir is added for all PHP extensions
 CONFIGURE_ARGS+=       --enable-${MODNAME}
 
+# There is an x86 assembly spinlock option. 
+# It is faster, and it does not leak file descriptors...
+.if ${MACHINE_ARCH} == i386 || ${MACHINE_ARCH} == amd64 || \
+    ${MACHINE_ARCH} == x86_64
+CONFIGURE_ARGS+=       --enable-apcu-spinlocks
+.endif
+
 PLIST_SRC+=            ${.CURDIR}/PLIST.extras
 PLIST_SUBST+=          PKGBASE=${PKGBASE}
 
 DOCDIR=                        ${PREFIX}/share/doc/${PKGBASE}


-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index