dweiss commented on code in PR #13164: URL: https://github.com/apache/lucene/pull/13164#discussion_r1516765998
########## lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestSimpleServer.java: ########## @@ -135,39 +132,12 @@ public void run() { } } - /** currently, this only works/tested on Sun and IBM. */ + /** forcibly halt the JVM: similar to crashing */ // poached from TestIndexWriterOnJRECrash ... should we factor out to TestUtil? seems dangerous // to give it such "publicity"? private static void crashJRE() { - final String vendor = Constants.JAVA_VENDOR; - final boolean supportsUnsafeNpeDereference = - vendor.startsWith("Oracle") || vendor.startsWith("Sun") || vendor.startsWith("Apple"); - - try { - if (supportsUnsafeNpeDereference) { - try { - Class<?> clazz = Class.forName("sun.misc.Unsafe"); - java.lang.reflect.Field field = clazz.getDeclaredField("theUnsafe"); - field.setAccessible(true); - Object o = field.get(null); - Method m = clazz.getMethod("putAddress", long.class, long.class); - m.invoke(o, 0L, 0L); - } catch (Throwable e) { - System.out.println("Couldn't kill the JVM via Unsafe."); - e.printStackTrace(System.out); - } - } - - // Fallback attempt to Runtime.halt(); - Runtime.getRuntime().halt(-1); - } catch (Exception e) { - System.out.println("Couldn't kill the JVM."); - e.printStackTrace(System.out); - } - - // We couldn't get the JVM to crash for some reason. - throw new RuntimeException("JVM refuses to die!"); + Runtime.getRuntime().halt(1); Review Comment: There's this one and there's a halt() call in TestCodecLoadingDeadlock. The TestCodecLoadingDeadlock seems reasonable since it tries to exit the forked JVM after dumping stacks. The logic in TestSimpleServer is quite complicated (and the forking code too). I think we should leave it for a separate patch? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org