[ 
https://issues.apache.org/jira/browse/SOLR-9168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17531471#comment-17531471
 ] 

Shawn Heisey commented on SOLR-9168:
------------------------------------

Revisiting this.

With Solr 9.0, the minimum Java version is 11 ... which means that all 
supported versions of Java (at least Oracle and OpenJDK) should have the 
options that were added in 8u92.  I have no idea whether IBM's Java supports 
them, but since we strongly recommend NOT using IBM Java, I don't know that we 
have to worry about it too much.  If anyone has access to an IBM Java that we 
can try, we can verify this.

[https://www.oracle.com/java/technologies/javase/8u92-relnotes.html]

Java 8u92 added the {{-XX:+ExitOnOutOfMemoryError}} an{color:#172b4d}d 
{{-XX:+CrashOnOutOfMemoryError}} par{color}ameters.  We couldn't easily use 
these new options in Solr 8.x and earlier, because those versions DID support 
running with a Java 8 release before 8u92.

As I noted earlier in this issue, I have done some testing, and if one of these 
is combined with the {{-XX+OnOutOfMemoryError}}  option, both are honored.  The 
JVM will exit or crash as configured, AND the script will be executed.  So we 
can change OOM handling to do both, and it should behave the same on Windows 
and POSIX systems.

I think we should use the combined OOME options in 9.x to have Java kill the 
program and run a script to log the event.  And I think at the same time we can 
give people the ability to place a custom program or script at a predefined 
location in the var dir, handling the original intent of this issue.  I thought 
of a bikeshed for this ... deciding whether we use the Exit option or the Crash 
option.  I am leaning towards Crash, but I could be persuaded to go with Exit.

> 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
>             Fix For: 5.5.1
>
>         Attachments: 
> 0001-SOLR-9168-Allow-users-to-specify-their-own-OnOutOfMe.patch, 
> SOLR-9168-userdefined.patch, SOLR-9168.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.7#820007)

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

Reply via email to