You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "Shawn Heisey (Jira)" <ji...@apache.org> on 2022/05/04 01:58:00 UTC

[jira] [Comment Edited] (SOLR-9168) Add availability to specify own oom handing script

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

Shawn Heisey edited comment on SOLR-9168 at 5/4/22 1:57 AM:
------------------------------------------------------------

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.


was (Author: elyograg):
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-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org