aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Frankenberger <simon-alpine@fraho.eu>2023-11-27 07:37:12 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2023-11-28 09:19:44 +0000
commit2e1b2ce16ff1d9be06547dc3b8520ef4c78a67d3 (patch)
tree635e361a21fd73431fcf9e3a447fcce11d0b7e09
parentcf9e22cbfc83c425590a5d3d98b8eb66e231466b (diff)
community/openjdk8: remove close-fd workaround again
Remove this workaroudn and use opendir() on /proc/self/fd again. This fixes an issue on our internal build server, where the openfiles ulimit was at 1bn, causing a single Runtime.exec() to take over 9 seconds. This patch should not be needed any longer, as the java 9+ aoirts didn't include it in the first place and seem to run just fine.
-rw-r--r--community/openjdk8/APKBUILD4
-rw-r--r--community/openjdk8/icedtea-jdk-close-fds.patch115
2 files changed, 1 insertions, 118 deletions
diff --git a/community/openjdk8/APKBUILD b/community/openjdk8/APKBUILD
index bad9bdba411..483d3c28e67 100644
--- a/community/openjdk8/APKBUILD
+++ b/community/openjdk8/APKBUILD
@@ -6,7 +6,7 @@ _icedteaver=3.29.0
# pkgver is <JDK version>.<JDK update>.<JDK build>
# Check https://icedtea.classpath.org/wiki/Main_Page when updating!
pkgver=8.392.08
-pkgrel=0
+pkgrel=1
pkgdesc="OpenJDK 8 provided by IcedTea"
url="https://icedtea.classpath.org/"
# riscv64 blocked by openjdk7
@@ -96,7 +96,6 @@ source="https://icedtea.classpath.org/download/source/icedtea-$_icedteaver.tar.x
icedtea-jdk-implicit.patch
icedtea-jdk-musl.patch
icedtea-jdk-includes.patch
- icedtea-jdk-close-fds.patch
icedtea-int-conversion.patch
icedtea-autoconf-config.patch
icedtea-jdk-disable-vfork.patch
@@ -462,7 +461,6 @@ b135991c76b0db8fa7c363e0903624668e11eda7b54a943035c214aa4d7fc8c3e8110ed200edcec8
0103259808b177819fd5db49c290b211ed086ed2f209912de145529f7d070e448d3399fc5b729a869b164cff7004d1633f9b1da80d7ebc657eaeaf86d6bd6b99 icedtea-jdk-implicit.patch
3b01de971f64f082d3e289cf337e635ef001381e8ca427a77baa9c52c7ba423889f57665779ca5b3c8bcefb8feacbea31dfaac580c969a4f061439069ee34aae icedtea-jdk-musl.patch
974fb54532b7e7d738f4278187fc6bd9f9b2d99866b94f68a617ee4911c89a3b8cc41ecfdcaefecf9157492d006b1844b6b0b41ac4209d84f9e8d13c9e485dd3 icedtea-jdk-includes.patch
-26d33ea5c55f89beebb0c05cc520e839439285f80d8ffca66ee9ef833ba65332dd7848de0b1a7e040d2eed494410d446729db72b09d8a23b6eea55749b8f6f54 icedtea-jdk-close-fds.patch
4fcad23d533d6a1fd5526223cb76330aebbbbab3766c43a5b6d5d8cc9c729381d153cced81aae2666798c82e90e10e193db33207b357e01fb5ebd0b686263394 icedtea-int-conversion.patch
662d662d0a7a84be2978e921317589f212f3ba3b7629527ba0f1140b5ac4c1024893e0ed176211688ed1a4505968c4befc841ed57ffcdbb9d355c2cb0571b167 icedtea-autoconf-config.patch
c70fee8f1a10c155494ab9c6e55e979d8a3e23f12358ffe9de2029ae15feff361957f1aa43af43c90ecf00523f92e3333b40311a8d0c132ebd456486cb85ed8a icedtea-jdk-disable-vfork.patch
diff --git a/community/openjdk8/icedtea-jdk-close-fds.patch b/community/openjdk8/icedtea-jdk-close-fds.patch
deleted file mode 100644
index 5a6d56d4ed0..00000000000
--- a/community/openjdk8/icedtea-jdk-close-fds.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-Avoid use opendir after fork as its not async safe and may lead to deadlock
-
-https://gitlab.alpinelinux.org/alpine/aports/-/issues/11861
-
-diff --git a/openjdk/jdk/src/solaris/native/java/lang/childproc.c b/openjdk/jdk/src/solaris/native/java/lang/childproc.c
-index 1d183cf..05aa6cb 100644
---- openjdk/jdk/src/solaris/native/java/lang/childproc.c
-+++ openjdk/jdk/src/solaris/native/java/lang/childproc.c
-@@ -23,13 +23,13 @@
- * questions.
- */
-
--#include <dirent.h>
- #include <errno.h>
- #include <fcntl.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
- #include <limits.h>
-+#include <poll.h>
-
- #include "childproc.h"
-
-@@ -56,61 +56,47 @@ closeSafely(int fd)
- return (fd == -1) ? 0 : close(fd);
- }
-
--int
--isAsciiDigit(char c)
--{
-- return c >= '0' && c <= '9';
--}
--
--#ifdef _ALLBSD_SOURCE
--#define FD_DIR "/dev/fd"
--#define dirent64 dirent
--#define readdir64 readdir
--#elif defined(_AIX)
--/* AIX does not understand '/proc/self' - it requires the real process ID */
--#define FD_DIR aix_fd_dir
--#else
--#define FD_DIR "/proc/self/fd"
--#endif
--
- int
- closeDescriptors(void)
- {
-- DIR *dp;
-- struct dirent64 *dirp;
- int from_fd = FAIL_FILENO + 1;
-+ struct pollfd pfds[1024];
-+ int i, total, nclosed = 0;
-+ int max_fd = sysconf(_SC_OPEN_MAX);
-
-- /* We're trying to close all file descriptors, but opendir() might
-- * itself be implemented using a file descriptor, and we certainly
-- * don't want to close that while it's in use. We assume that if
-- * opendir() is implemented using a file descriptor, then it uses
-- * the lowest numbered file descriptor, just like open(). So we
-- * close a couple explicitly. */
-+ if (max_fd < 0)
-+ return 0;
-
-- close(from_fd); /* for possible use by opendir() */
-- close(from_fd + 1); /* another one for good luck */
-+ /* init events */
-+ total = max_fd - from_fd;
-+ for (i = 0; i < (total < 1024 ? total : 1024); i++) {
-+ pfds[i].events = 0;
-+ }
-
--#if defined(_AIX)
-- /* AIX does not understand '/proc/self' - it requires the real process ID */
-- char aix_fd_dir[32]; /* the pid has at most 19 digits */
-- snprintf(aix_fd_dir, 32, "/proc/%d/fd", getpid());
--#endif
-+ while (from_fd < max_fd) {
-+ int nfds, r = 0;
-
-- if ((dp = opendir(FD_DIR)) == NULL)
-- return 0;
-+ total = max_fd - from_fd;
-+ nfds = total < 1024 ? total : 1024;
-
-- /* We use readdir64 instead of readdir to work around Solaris bug
-- * 6395699: /proc/self/fd fails to report file descriptors >= 1024 on Solaris 9
-- */
-- while ((dirp = readdir64(dp)) != NULL) {
-- int fd;
-- if (isAsciiDigit(dirp->d_name[0]) &&
-- (fd = strtol(dirp->d_name, NULL, 10)) >= from_fd + 2)
-- close(fd);
-- }
-+ for (i = 0; i < nfds; i++)
-+ pfds[i].fd = from_fd + i;
-
-- closedir(dp);
-+ do {
-+ r = poll(pfds, nfds, 0);
-+ } while (r == -1 && errno == EINTR);
-
-+ if (r < 0)
-+ return 0;
-+
-+
-+ for (i = 0; i < nfds; i++)
-+ if (pfds[i].revents != POLLNVAL) {
-+ nclosed++;
-+ close(pfds[i].fd);
-+ }
-+ from_fd += nfds;
-+ }
- return 1;
- }
-