Bug 210191 - java/openjdk8: Fix for OpenJDK Network Crash (regression of PR 175417)
Summary: java/openjdk8: Fix for OpenJDK Network Crash (regression of PR 175417)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-java (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2016-06-10 13:57 UTC by Andrew Smith
Modified: 2016-07-28 04:10 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (java)


Attachments
patch_bsd_close_jdk8 (2.26 KB, patch)
2016-06-10 13:58 UTC, Andrew Smith
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Smith 2016-06-10 13:57:16 UTC
PR 175417 observed that the change to select() 2 from poll() produced crashes in java/openjdk7.

This was initially provided as a FreeBSD patch to the bsd-port of OpenJDK and then was adopted upstream directly into bsd-port.

This change was never added to the jdk8 upstream bsd-port at the OpenJDK mercurial repo and since the patch was previosuly available ustream from jdk7 it was never added to the jdk8 port either.

The result is that java/openjdk8 is susceptible to crashes on network timesouts just as java/openjdk7 was.

I have personally observed this in a perormance test environment that could produce the failure within 10 minutes using 6 Tomcat servers using a JMeter test for one of our applications as the back end infrastructure started to saturate and introduce network timeouts.

The source file effected is jdk/src/solaris/native/java/net/bsd_close.c which requires the conditional switch back to using the poll mechanism if not on an Apple platform.

This file in the upstream differs only in that it lacks this conditional handling for NET_Timeout for non Apple platforms so this patch has been effectively reassembled from that change between the bsd-port/jdk8 and bsd-port/bsd-port for the java/openjdk8 port.

Ideally this should go upstream into bsd-port/jdk8 but for now it is needed in the FreeBSD port to stabilise any high throughput network applications that may suffer frequent NET_Timeout conditions.

Crashes in our environment without the patch under Apache Tomcat 8 result in a wide variety of SIGBUS and SIGSEGV errors often in GCTaskThread or VMThread.

The patch provided can be applied by simply dropping it into /usr/ports/java/openjdk8/files prior to a port build.
Comment 1 Andrew Smith 2016-06-10 13:58:12 UTC
Created attachment 171267 [details]
patch_bsd_close_jdk8
Comment 2 Andrew Smith 2016-06-10 14:18:50 UTC
Noting for future reference and porting effort that bsd-ports/jdk9 has bsd_close here src/java.base/macosx/native/libnet/bsd_close.c and it also lacks the conditional change back to poll.
Comment 3 Andrew Smith 2016-06-10 20:00:07 UTC
I'm not sure if I missed some etiquette here but not that you have removed [PATCH] from the title which I had previously considered helpful to a maintainer finding a patch on the PR and seems to be common place.

Not changing it back of course if there is a reason why we shouldn't keep some additional cue's in the title of the article to help folks who often have a day job as well as put effort into maintaining these ports.
Comment 4 Andrew Smith 2016-06-10 21:03:35 UTC
Just out of curiosity, are you using Akka in the Scala apps..? I need to finish my due diligence piece on that so I'm kinda' interested and have heard of some interesting stability concerns re sun.misc.Unsafe and Akka providing their own..?
Comment 5 Andrew Smith 2016-06-10 21:29:57 UTC
Previous comment misplayed related to anther bug thread. Apologies
Comment 6 huanghwh 2016-06-11 22:33:50 UTC
This patch also bug Bug 208553.
Comment 7 Andrew Smith 2016-06-11 23:13:11 UTC
Seems effects some additonal PRs so change to 'Some People' from self.
Comment 8 commit-hook freebsd_committer freebsd_triage 2016-06-12 21:56:42 UTC
A commit references this bug:

Author: glewis
Date: Sun Jun 12 21:56:01 UTC 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 <iamasmith.home@gmail.com>

Changes:
  head/java/openjdk8/Makefile
  head/java/openjdk8/files/patch-jdk-src-solaris-native-java-net-bsd_close.c
Comment 9 Greg Lewis freebsd_committer freebsd_triage 2016-06-13 02:39:52 UTC
I've committed this change to the openjdk8 port.  Leaving it open while I get it into the openjdk8 upstream and openjdk9 upstream.
Comment 10 Greg Lewis freebsd_committer freebsd_triage 2016-06-13 05:07:08 UTC
I think openjdk9 actually has some issues on where to get this in.  The bsd_close.c file there is only part of the MacOS X build now.  We'll need some additional work to pull it in.  I can get it into the openjdk8 upstream though, since it is just a forward port from openjdk7.
Comment 11 Andrew Smith 2016-06-22 13:39:48 UTC
My OCA has been processed and I now appear on the OCA web page as 'Andrew Smith - OpenJDK' and am happy for you to sponsor these changes should you wish.

-Andy
Comment 12 Greg Lewis freebsd_committer freebsd_triage 2016-07-28 04:10:21 UTC
This has been pushed upstream.  Thanks Andrew!