File tree 2 files changed +22
-0
lines changed
server/src/main/java/org/elasticsearch/bootstrap
test/framework/src/main/java/org/elasticsearch/bootstrap
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,24 @@ static void initializeProbes() {
160
160
JvmInfo .jvmInfo ();
161
161
}
162
162
163
+ /**
164
+ * JDK 14 bug:
165
+ * https://github.com/elastic/elasticsearch/issues/50512
166
+ * We circumvent it here by loading the offending class before installing security manager.
167
+ *
168
+ * To be removed once the JDK is fixed.
169
+ */
170
+ static void fixJDK14EAFileChannelMap () {
171
+ // minor time-bomb here to ensure that we reevaluate if final 14 version does not include fix.
172
+ if (System .getProperty ("java.version" ).equals ("14-ea" )) {
173
+ try {
174
+ Class .forName ("jdk.internal.misc.ExtendedMapMode" , true , Bootstrap .class .getClassLoader ());
175
+ } catch (ClassNotFoundException e ) {
176
+ throw new RuntimeException ("Unable to lookup ExtendedMapMode class" , e );
177
+ }
178
+ }
179
+ }
180
+
163
181
private void setup (boolean addShutdownHook , Environment environment ) throws BootstrapException {
164
182
Settings settings = environment .settings ();
165
183
@@ -211,6 +229,8 @@ public void run() {
211
229
// Log ifconfig output before SecurityManager is installed
212
230
IfConfig .logIfNecessary ();
213
231
232
+ fixJDK14EAFileChannelMap ();
233
+
214
234
// install SM after natives, shutdown hooks, etc.
215
235
try {
216
236
Security .configure (environment , BootstrapSettings .SECURITY_FILTER_BAD_DEFAULTS_SETTING .get (settings ));
Original file line number Diff line number Diff line change @@ -102,6 +102,8 @@ public class BootstrapForTesting {
102
102
// Log ifconfig output before SecurityManager is installed
103
103
IfConfig .logIfNecessary ();
104
104
105
+ Bootstrap .fixJDK14EAFileChannelMap ();
106
+
105
107
// install security manager if requested
106
108
if (systemPropertyAsBoolean ("tests.security.manager" , true )) {
107
109
try {
You can’t perform that action at this time.
0 commit comments