[ https://issues.apache.org/jira/browse/SOLR-9168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17926922#comment-17926922 ]
Carlos Ugarte commented on SOLR-9168: ------------------------------------- This is an old ticket, but as it's still open I hope the need for this is still recognized. SOLR-8803 did remove the ability to specify an OOM handling script. We've been using a custom startup script, and in trying to move to {{bin/solr}} have not found a supported way to do this. Passing {{-a -XX:OnOutOfMemoryError="/path/to/script arg1 arg2"}} to {{bin/solr}} yields {{ERROR: -XX:OnOutOfMemoryError="..." is not supported by this script}}. Setting {{$SOLR_ADDL_ARGS}} before invoking {{bin/solr}} did not work (the value we provide is ignored). Adding the following lines to {{bin/solr}} does allow us to specify the script: {code:bash} + # If provided, invoke a script when an OutOfMemoryError occurs + if [[ -n "${SOLR_OOM_SCRIPT}" ]]; then + SCRIPT_SOLR_OPTS+=("-XX:OnOutOfMemoryError=$SOLR_OOM_SCRIPT") + fi + {code} Does this seem reasonable? I imagine something similar would be added to {{bin/solr.cmd}}. I could submit a PR with one or both changes. Experiments using both {{-XX:OnOutOfMemoryError=script}} and {{-XX:+CrashOnOutOfMemoryError}} showed the script ran first, and the crash via the explicit {{-XX:+CrashOnOutOfMemoryError}} option was only triggered once the script terminated. My read of the file [~dan2097] linked for OpenJDK 11, 17, 21 and 23 suggest the behavior is the same across all of those versions. > Add availability to specify own oom handing script > -------------------------------------------------- > > Key: SOLR-9168 > URL: https://issues.apache.org/jira/browse/SOLR-9168 > Project: Solr > Issue Type: Improvement > Components: scripts and tools > Affects Versions: 5.5.1 > Reporter: AngryDeveloper > Priority: Major > Labels: oom > Attachments: > 0001-SOLR-9168-Allow-users-to-specify-their-own-OnOutOfMe.patch, > SOLR-9168-1.patch, SOLR-9168-2.patch, SOLR-9168-3.patch, > SOLR-9168-userdefined.patch, SOLR-9168.patch, solr-crash-oom.patch > > > Right now the start script always uses $SOLR_TIP/bin/oom_solr.sh to handle > OutOfMemoryException. This script only kills instance of solr. > We need to do some additional things (e.g sent mail about this exception) > What do you think about adding possibility to set up own script? > Proposition: > {code} > if [ -z "$SOLR_OOM_SCRIPT" ]; then > SOLR_OOM_SCRIPT=$SOLR_TIP/bin/oom_solr.sh > fi > [...] > nohup "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS \ > "-XX:OnOutOfMemoryError=$SOLR_OOM_SCRIPT $SOLR_PORT $SOLR_LOGS_DIR" \ > -jar start.jar "${SOLR_JETTY_CONFIG[@]}" \ > 1>"$SOLR_LOGS_DIR/solr-$SOLR_PORT-console.log" 2>&1 & echo $! > > "$SOLR_PID_DIR/solr-$SOLR_PORT.pid" > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org