wanglijie95 commented on a change in pull request #12181: URL: https://github.com/apache/flink/pull/12181#discussion_r427838651
########## File path: flink-core/src/test/java/org/apache/flink/core/fs/SafetyNetCloseableRegistryTest.java ########## @@ -198,4 +198,29 @@ public void testReaperThreadSpawnAndStop() throws Exception { } Assert.assertFalse(SafetyNetCloseableRegistry.isReaperThreadRunning()); } + + /** + * Test whether failure to start thread in {@link SafetyNetCloseableRegistry} + * constructor can lead to failure of subsequent state check. + */ + @Test + public void testReaperThreadStartFailed() throws Exception { + + try { + new SafetyNetCloseableRegistry(() -> new OutOfMemoryReaperThread()); + } catch (java.lang.OutOfMemoryError error) { + } + + // the OOM error will not lead to failure of subsequent constructor call. + SafetyNetCloseableRegistry closeableRegistry = new SafetyNetCloseableRegistry(); + closeableRegistry.close(); + } + + static class OutOfMemoryReaperThread extends SafetyNetCloseableRegistry.CloseableReaperThread { Review comment: done. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org