While trying to port Facebook's Presto (https://prestodb.io/) to FreeBSD 10.2, I got an Exception with the following stacktrace (running openjdk8-8.60.24_1): javax.management.RuntimeErrorException: java.lang.InternalError: errno: 2 error: Unable to open directory /proc/self/fd at sun.management.OperatingSystemImpl.getOpenFileDescriptorCount(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:193) at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:175) at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:117) at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:54) at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237) at com.sun.jmx.mbeanserver.PerInterface.getAttribute(PerInterface.java:83) at com.sun.jmx.mbeanserver.MBeanSupport.getAttribute(MBeanSupport.java:206) at com.sun.jmx.mbeanserver.MBeanSupport.getAttributes(MBeanSupport.java:213) at javax.management.StandardMBean.getAttributes(StandardMBean.java:390) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttributes(DefaultMBeanServerInterceptor.java:709) at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttributes(JmxMBeanServer.java:705) at com.facebook.presto.connector.jmx.JmxRecordSetProvider.getAttributes(JmxRecordSetProvider.java:171) at com.facebook.presto.connector.jmx.JmxRecordSetProvider.getRecordSet(JmxRecordSetProvider.java:73) at com.facebook.presto.connector.jmx.TestJmxSplitManager.testRecordSetProvider(TestJmxSplitManager.java:110) After investigating the code it seems like OpenJDK8 is using the wrong path to check for open file descriptors on FreeBSD. Could this be an OpenJDK bug?
Created attachment 164047 [details] Java Stacktrace
This problem seems to be introduced in r372338, i.e., mis-merged fix for JDK-8031581: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/c44d84c6774d
A commit references this bug: Author: jkim Date: Thu Dec 10 18:43:51 UTC 2015 New revision: 403464 URL: https://svnweb.freebsd.org/changeset/ports/403464 Log: Fix regression introduced in r372338, i.e., mis-merged fix for JDK-8031581. PR: 205192 Changes: head/java/openjdk8/Makefile head/java/openjdk8/files/patch-jdk_src_solaris_native_sun_management_OperatingSystemImpl.c
Fixed in r403464. Thanks!