tillrohrmann commented on a change in pull request #9703: [FLINK-14038]Add default GC options for flink on yarn to facilitate debugging URL: https://github.com/apache/flink/pull/9703#discussion_r341645233
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java ########## @@ -513,6 +514,76 @@ public static Configuration cloneConfiguration(Configuration configuration) { return clonedConfiguration; } + /** + * Format the default gc logging options + * @param logDirectory to save the gc log + * @return the formatted gc logging options string + */ + public static String getGCLoggingOpts(String logDirectory) { + return "-Xloggc:" + logDirectory + "/gc.log " + + "-XX:+PrintGCApplicationStoppedTime " + + "-XX:+PrintGCDetails " + + "-XX:+PrintGCDateStamps " + + "-XX:+UseGCLogFileRotation " + + "-XX:NumberOfGCLogFiles=10 " + + "-XX:GCLogFileSize=10M " + + "-XX:+PrintPromotionFailure " + + "-XX:+PrintGCCause"; + } + + /** + * Format the default heapdump options + * @param appId application id + * @param ident the ident of the process, taskmanager/jobmanager + * @param logDirectory to print some logs + * @param heapdumpDir to save heap dump file + * @return the formatted heapdump options string + */ + public static String getHeapdumpOpts(String appId, String ident, String logDirectory, String heapdumpDir) { + String dumpDestName = String.format("flink-%s-heapdump.hprof", ident); + String dumpFileDestPath = new File(heapdumpDir, appId + "-" + dumpDestName).getAbsolutePath(); + String oomScript = String.format("echo -e 'OutOfMemoryError! Killing current process %%p...\n" + + "Check gc logs and heapdump file(%s) for details.' > " + + logDirectory + "/%s.err; " + + "kill -9 %%p", + dumpFileDestPath, ident); + return String.format("-XX:+HeapDumpOnOutOfMemoryError " + + "-XX:HeapDumpPath=%s " + + "-XX:OnOutOfMemoryError=\"%s\"", + dumpFileDestPath, + oomScript); + } Review comment: Same here. Please use tabs for indentation. ---------------------------------------------------------------- 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 With regards, Apache Git Services