From cfbcd54ba94d4ee6d05dd23e3a2b4af65da5b5ad Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 10 Jan 2018 15:39:05 +0000 Subject: [PATCH] jrobin: Disable DeallocationHelper for Java 9 --- .../java/src/engine/misc/DeallocationHelper.java | 16 +++++++++++++++- .../java/src/org/jrobin/core/RrdNioBackend.java | 6 ++++-- history.txt | 15 +++++++++++++-- .../java/src/net/i2p/router/RouterVersion.java | 2 +- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/apps/jrobin/java/src/engine/misc/DeallocationHelper.java b/apps/jrobin/java/src/engine/misc/DeallocationHelper.java index f37d83f1e2..158b80b960 100644 --- a/apps/jrobin/java/src/engine/misc/DeallocationHelper.java +++ b/apps/jrobin/java/src/engine/misc/DeallocationHelper.java @@ -127,7 +127,21 @@ public class DeallocationHelper { cleanerCleanMethod.invoke(cleaner); success = true; } - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + //} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (IllegalAccessException | RuntimeException | InvocationTargetException e) { + // Replaced with RuntimeException for OpenJDK 9b181 + // throws a java.lang.reflect.InaccessibleObjectException extends RuntimeException which is only in Java 9 + // WARNING: An illegal reflective access operation has occurred + // WARNING: Illegal reflective access by engine.misc.DeallocationHelper (file:/path/to/jrobin.jar) to field java.nio.DirectByteBuffer.att + // WARNING: Please consider reporting this to the maintainers of engine.misc.DeallocationHelper + // WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations + // WARNING: All illegal access operations will be denied in a future release + // Thread terminated unexpectedly: Shutdown task net.i2p.router.web.StatSummarizer$Shutdown + // java.lang.reflect.InaccessibleObjectException: Unable to make public void jdk.internal.ref.Cleaner.clean() accessible: module java.base does not "exports jdk.internal.ref" to unnamed module @381353a0 + // at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) + // at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) + // at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198) + // at java.base/java.lang.reflect.Method.setAccessible(Method.java:192) logger.warn("The deallocation of a direct NIO buffer has failed", e); } finally { directByteBufferCleanerMethod.setAccessible(directByteBufferCleanerMethodWasAccessible); diff --git a/apps/jrobin/java/src/org/jrobin/core/RrdNioBackend.java b/apps/jrobin/java/src/org/jrobin/core/RrdNioBackend.java index 62a640a8c2..73213b36e7 100644 --- a/apps/jrobin/java/src/org/jrobin/core/RrdNioBackend.java +++ b/apps/jrobin/java/src/org/jrobin/core/RrdNioBackend.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; +import net.i2p.util.SystemVersion; import engine.misc.DeallocationHelper; @@ -35,7 +36,8 @@ import engine.misc.DeallocationHelper; public class RrdNioBackend extends RrdFileBackend { private final SyncManager m_syncManager; private MappedByteBuffer m_byteBuffer = null; - private static final DeallocationHelper _dHelper = new DeallocationHelper(); + // Too many ominous warnings from Java 9 + private static final DeallocationHelper _dHelper = SystemVersion.isJava9() ? null : new DeallocationHelper(); /** * Creates RrdFileBackend object for the given file path, backed by @@ -105,7 +107,7 @@ public class RrdNioBackend extends RrdFileBackend { if (!isReadOnly()) { stopSchedule(); } - if (m_byteBuffer != null) { + if (_dHelper != null && m_byteBuffer != null) { _dHelper.deallocate(m_byteBuffer); m_byteBuffer = null; } diff --git a/history.txt b/history.txt index c6c856db11..0d65e3af95 100644 --- a/history.txt +++ b/history.txt @@ -1,6 +1,17 @@ +2018-01-10 zzz + * Addressbook: Remove finalizers (ticket #2115) + * i2psnark: Fix double-escaping of '&' (ticket #2127) + * jrobin: Disable DeallocationHelper for Java 9 + +2018-01-09 zzz + * SusiMail: Rewrite/fix subject line encoding + 2018-01-06 zzz - * i2ptunnel: Escape chars unescaped by browsers (ticket #2130) - * i2ptunnel, eepget: Better error message on invalid URLs (ticket #2130) + * Console: Show and set burst bandwidth (ticket #2123) + * i2ptunnel: + - Advanced config in/out tunnels separately + - Better error message on invalid URLs (eepget too) (ticket #2130) + - Escape chars unescaped by browsers (ticket #2130) 2018-01-04 zzz * i2psnark: Fix overflow in ratio sorter (ticket #2129) diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 80cfb9c849..5b1ba79e39 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 18; + public final static long BUILD = 19; /** for example "-test" */ public final static String EXTRA = "";