NetBSD Problem Report #53950

From www@NetBSD.org  Tue Feb  5 14:50:33 2019
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 410417A16A
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  5 Feb 2019 14:50:33 +0000 (UTC)
Message-Id: <20190205145031.F3FDA7A1DB@mollari.NetBSD.org>
Date: Tue,  5 Feb 2019 14:50:31 +0000 (UTC)
From: Rainer.Pruy@acrys.com
Reply-To: Rainer.Pruy@acrys.com
To: gnats-bugs@NetBSD.org
Subject: openjdk8 sun.nio.ch.KQueue.java is using wrong constants
X-Send-Pr-Version: www-1.0

>Number:         53950
>Category:       pkg
>Synopsis:       openjdk8 sun.nio.ch.KQueue.java is using wrong constants
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 05 14:55:00 +0000 2019
>Originator:     Rainer Pruy
>Release:        pkgsrc-2018Q4
>Organization:
Acrys Consult GmbH & Co. KG
>Environment:
e.g. NetBSD 7.1.0_PATCH (GENERIC)
or   NetBSD 8.0_STABLE (GENERIC)
>Description:
sun.nio.ch.KQueue.java uses constants that are expected to equal ones defined with sys/event.h. Actually some of those constants are defined differently:

Kqueue.java:
   static final int EVFILT_READ  = -1;
   static final int EVFILT_WRITE = -2;

sys/event.h
#define EVFILT_READ             0
#define EVFILT_WRITE            1

This causes calls using such constants (kqueue()) to fail with EINVAL
completely prohibiting use of NIO functionality relying on kqueue.


>How-To-Repeat:
The problem was identified when trying to install an
Apache karaf instance onto a NetBSD system.

This failed with ssh service looping at high speed logging failures.

Any selector based server issuing accept should fail with the very same symptoms.
>Fix:
Below is the uuencoded tgz of a set of patches that fix the problem.

The approach taken is to completely avoiding to define the constants with the java side, but initializes them from native methods that just return the constants from C level and thus directly from the proper sys/event.h.
The approach not only works for NetBSD but also for macosx platform
that seems to be also using kqueue implementation with NIO
as it simply ensures the java code is using the proper values for the current platform.

Here is the patch:
begin 644 openjdk8-kqueue-patches.tgz
M'XL(`*J>65P``^U76W/:1ACUJ_4K]B$/-D)(*X'(F';&U(;&"6-<H'7?-(JT
M&-F*I&H7XHS'_[U[D;`20!?3TF:B,QXM,M]E=[_=<SXBFS@+A-6(C<J]^V#A
MV+%PZ-NQARW'MS%&V,++P`J\T'(6UH??EFB)6O?VRCXJ"0UJFMEN'VD"?(3=
M3OJNM_7.$33:>MLTVEV=_5_7S38=RR;8!TM,[!B`HS@,R2'R_<_PYAJ17Z:7
M;R1)411`ZZ_2^JM)_=6D_BJMOTKKKSH+-5/_5AA[=\<ZK:6B0<6``!IG;>,,
M&BTM!9#94Y)EN6)LZ?P<*!VC"0T@BX'^@[L`806>),`0Q=[*)@C0,A+/`7,O
ML'W@!02,A\/I8&8-1_U?IV"-G\'<M^_P>#['B)R<]B0@PJ@J=?4)BK&DL/>-
M<(,_AE>CF349]"]9%`7V\@UO)U>S`3/4>Y)<)N(=(H/5D,YA@FR7S2S7*PV_
M]KJ-/8*^61!;Z<Y96OW+RV1+M$=V(W<OR!I?#Z;OQK/$%&HYIA>C07^RCJIK
MN]>1F0!?1=_-779F$MQ\'""\"$FNR\MDN,N%C^PXNT>-AO@`&J#O^Z%##Q(&
M-HA"WP=V'-M?``G!P@Y<'X%EQ%Z>SIW01<`)EP%Y!FB%`H);_+!"K=LT@<P&
M:&X[K5O/:T"?*\3GNW$PY7S[S0-3VF-]6,JYI)4I99RM2RF'=55DL4.;9@]_
ML3T\.05D$8>?,;@:#QX=%!$O#-:UW.+%JS-!=QZF]_I$!(KF;E/L=CKR6]]\
MJ0"=R']-R@=$E*O_8C>WR+]3)4>!_D/3,!/]US7ZQ_0?=LUNK?\'0+[^B_IO
MD6AG/^W?'9=3J0D9D]*GP8GT/>T'-L^@E>7+]]=7@T`"SXP-V.<_;\:3&;AG
MEYJ^7O1'(TG>$>9K&N6!5@V`@E43W`L*)PL/GTKRDV"S&)%E'&35FS+7,^.Z
MUR86;%PU,^\`]DG-6+U"4B;7^Z1+=:%*RD3R]TDKU*5*4MXT%*3<=283I1+I
M0".;SCE-6U:A1'.7MB6ILO62;^;@A'_S$]"8^;]__S?Y_Y/]@.@CHL)(?_GY
MWD>VPN1=^8C=ZCF*^!\:7<'_W6ZWT]$9_VNF9M3\?P!L\C^KOYK67Q7U5S/U
MSS`_A(K^%F@:I?TSH[V3^8LB<LY_:S+.IT\(&>=/?[^^3?I&"[8@NSK'Q]LO
MW4T8$]JQ.`^(1+87]W9;6J+9$YJ1:_<B+90(=II])1VE##G5%UI29BZTX;Q6
M:)60;MY:/9=VR<5;(KKI&_K+J-@J[;E_J$[Z^T1%_O]D.R%^K)BCB/]UROEK
M_F=]/^W_#0/6_'\`5.1_4?]_6`)$4*$"&E<!K;H*E.6QUTD`^`8E!:&J6RH/
M5?R$6%3Q2*6CBD^QD)2786Y)FV`4Q\NH,*0;VUX`:RFI4:-&C1HU:M2H4:-&
/C1HU7H^_`64,L)``*```
`
end

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.