From owner-svn-ports-all@freebsd.org Sun Jun 12 21:56:02 2016 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EF0EAF1554; Sun, 12 Jun 2016 21:56:02 +0000 (UTC) (envelope-from glewis@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 28BF328BA; Sun, 12 Jun 2016 21:56:02 +0000 (UTC) (envelope-from glewis@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5CLu1c7074454; Sun, 12 Jun 2016 21:56:01 GMT (envelope-from glewis@FreeBSD.org) Received: (from glewis@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5CLu1CA074452; Sun, 12 Jun 2016 21:56:01 GMT (envelope-from glewis@FreeBSD.org) Message-Id: <201606122156.u5CLu1CA074452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glewis set sender to glewis@FreeBSD.org using -f From: Greg Lewis Date: Sun, 12 Jun 2016 21:56:01 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r416826 - in head/java/openjdk8: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jun 2016 21:56:02 -0000 Author: glewis Date: Sun Jun 12 21:56:01 2016 New Revision: 416826 URL: https://svnweb.freebsd.org/changeset/ports/416826 Log: . Use poll() rather than select() on BSD to avoid crashes during network timeouts. This is forwarded ported from OpenJDK 7. . Bump PORTREVISION for this fix. PR: 210191 Submitted by: Andrew Smith Added: head/java/openjdk8/files/patch-jdk-src-solaris-native-java-net-bsd_close.c (contents, props changed) Modified: head/java/openjdk8/Makefile Modified: head/java/openjdk8/Makefile ============================================================================== --- head/java/openjdk8/Makefile Sun Jun 12 21:53:48 2016 (r416825) +++ head/java/openjdk8/Makefile Sun Jun 12 21:56:01 2016 (r416826) @@ -2,6 +2,7 @@ PORTNAME= openjdk PORTVERSION= ${JDK_MAJOR_VERSION}.${JDK_UPDATE_VERSION}.${JDK_BUILD_NUMBER:S/^0//} +PORTREVISION= 1 CATEGORIES= java devel MASTER_SITES= http://download.java.net/openjdk/jdk${JDK_MAJOR_VERSION}/promoted/b${DIST_BUILD_NUMBER}/:jdk \ https://adopt-openjdk.ci.cloudbees.com/job/jtreg/${JTREG_JENKINS_BUILD}/artifact/:jtreg \ Added: head/java/openjdk8/files/patch-jdk-src-solaris-native-java-net-bsd_close.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/java/openjdk8/files/patch-jdk-src-solaris-native-java-net-bsd_close.c Sun Jun 12 21:56:01 2016 (r416826) @@ -0,0 +1,85 @@ +--- ./jdk/src/solaris/native/java/net/bsd_close.c Fri Apr 15 03:53:39 2016 +0100 ++++ ./jdk/src/solaris/native/java/net/bsd_close.c Sun May 01 21:26:40 2016 -0700 +@@ -345,6 +345,76 @@ + * signal other than our wakeup signal. + */ + int NET_Timeout(int s, long timeout) { ++/* ++ * On MacOS X, poll(2) is not working correctly, so a select(2) based ++ * implementation is preferred. See ++ * ++ * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7131399 ++ * ++ * However, on FreeBSD, the select(2) based implementation can cause ++ * crashes under load and poll(2) is preferred. See ++ * ++ * http://docs.freebsd.org/cgi/getmsg.cgi?fetch=215525+0+current/freebsd-java ++ * ++ * Other *BSD will use poll(2) for now, but please adjust as appropriate. ++ */ ++#ifndef __APPLE__ ++ long prevtime = 0, newtime; ++ struct timeval t; ++ fdEntry_t *fdEntry = getFdEntry(s); ++ ++ /* ++ * Check that fd hasn't been closed. ++ */ ++ if (fdEntry == NULL) { ++ errno = EBADF; ++ return -1; ++ } ++ ++ /* ++ * Pick up current time as may need to adjust timeout ++ */ ++ if (timeout > 0) { ++ gettimeofday(&t, NULL); ++ prevtime = t.tv_sec * 1000 + t.tv_usec / 1000; ++ } ++ ++ for(;;) { ++ struct pollfd pfd; ++ int rv; ++ threadEntry_t self; ++ ++ /* ++ * Poll the fd. If interrupted by our wakeup signal ++ * errno will be set to EBADF. ++ */ ++ pfd.fd = s; ++ pfd.events = POLLIN | POLLERR; ++ ++ startOp(fdEntry, &self); ++ rv = poll(&pfd, 1, timeout); ++ endOp(fdEntry, &self); ++ ++ /* ++ * If interrupted then adjust timeout. If timeout ++ * has expired return 0 (indicating timeout expired). ++ */ ++ if (rv < 0 && errno == EINTR) { ++ if (timeout > 0) { ++ gettimeofday(&t, NULL); ++ newtime = t.tv_sec * 1000 + t.tv_usec / 1000; ++ timeout -= newtime - prevtime; ++ if (timeout <= 0) { ++ return 0; ++ } ++ prevtime = newtime; ++ } ++ } else { ++ return rv; ++ } ++ ++ } ++#else + long prevtime = 0, newtime; + struct timeval t, *tp = &t; + fd_set fds; +@@ -431,4 +501,5 @@ + } + + } ++#endif + }