madrob commented on a change in pull request #2055:
URL: https://github.com/apache/lucene-solr/pull/2055#discussion_r517648922



##########
File path: solr/bin/solr
##########
@@ -2172,6 +2172,16 @@ function start_solr() {
     SOLR_OPTS+=($AUTHC_OPTS)
   fi
 
+  # If a heap dump directory is specified, enable it in SOLR_OPTS
+  if [[ -z "$SOLR_HEAP_DUMP_DIR" ]] && [[ "$SOLR_HEAP_DUMP" == "true" ]]; then
+    SOLR_HEAP_DUMP_DIR="${SOLR_LOGS_DIR}/dumps"
+  fi
+  if [[ -n "$SOLR_HEAP_DUMP_DIR" ]]; then
+    SOLR_OPTS+=("-XX:+HeapDumpOnOutOfMemoryError")
+    SOLR_OPTS+=("-XX:HeapDumpPath=$SOLR_HEAP_DUMP_DIR/solr-$(date 
+%s)-pid$$.hprof")
+    mkdir -p "$SOLR_HEAP_DUMP_DIR" 2>/dev/null

Review comment:
       I was doing it to match the call at 
https://github.com/apache/lucene-solr/blob/8f75d6ff4f0d981136f64a28c173b5ac4a7263ec/solr/bin/solr#L2243
 but that also had additional checks afterwards. I extracted the commonality 
here and call that function instead.
   
   mkdir can fail if you don't have permissions to that directory path, which 
would also indicate that the process won't have permissions later to write the 
log files.




----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to