You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/10/22 17:14:36 UTC

[GitHub] [flink] tillrohrmann commented on a change in pull request #9703: [FLINK-14038]Add default GC options for flink on yarn to facilitate debugging

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_r337641104
 
 

 ##########
 File path: flink-dist/src/main/flink-bin/mesos-bin/mesos-appmaster-job.sh
 ##########
 @@ -31,6 +31,30 @@ CC_CLASSPATH=`manglePathList $(constructFlinkClassPath):$INTERNAL_HADOOP_CLASSPA
 
 log="${FLINK_LOG_DIR}/flink-${FLINK_IDENT_STRING}-mesos-appmaster-${HOSTNAME}.log"
 log_setting="-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback.xml"
+gclog="${FLINK_LOG_DIR}/flink-${FLINK_IDENT_STRING}-mesos-appmaster-${HOSTNAME}.gc_log"
+
+if [ ${FLINK_JVM_GC_LOGGING} ];then
+    FLINK_JVM_GC_LOGGING_OPTS="-XLoggc:${gclog} " \
+      "-XX:+PrintGCApplicationStoppedTime " \
+			"-XX:+PrintGCDetails " \
+			"-XX:+PrintGCDateStamps " \
+			"-XX:+UseGCLogFileRotation " \
+			"-XX:NumberOfGCLogFiles=10 " \
+			"-XX:GCLogFileSize=10M " \
+			"-XX:+PrintPromotionFailure " \
+			"-XX:+PrintGCCause"
+		JVM_ARGS="${FLINK_JVM_GC_LOGGING_OPTS} ${JVM_ARGS}"
+fi
+
+FLINK_HEAPDUMP_NAME="flink-${FLINK_IDENT_STRING}-mesos-appmaster-${HOSTNAME}.hprof"
+rm -rf ${FLINK_JVM_HEAPDUMP_DIRECTORY}/${FLINK_HEAPDUMP_NAME}
+if [ ${FLINK_JVM_HEAPDUMP_ON_OOM} ];then
+    FLINK_JVM_HEAPDUMP_OPTS="-XX:+HeapDumpOnOutOfMemoryError " \
+      "-XX:HeapDumpPath=${FLINK_JVM_HEAPDUMP_DIRECTORY}/${FLINK_HEAPDUMP_NAME} " \
+      "-XX:OnOutOfMemoryError=\"echo -e 'OutOfMemoryError! Killing current process %p...\n" \
+      "Check gc logs and heapdump file(${FLINK_JVM_HEAPDUMP_DIRECTORY}/${FLINK_HEAPDUMP_NAME}) for details.' > ${log}; kill -9 %p\""
+    JVM_ARGS="${FLINK_JVM_HEAPDUMP_OPTS} ${JVM_ARGS}"
+fi
 
 Review comment:
   Can we deduplicate this logic? We also have it in `flink-daemon.sh`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services