You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Shawn Heisey (JIRA)" <ji...@apache.org> on 2018/05/24 22:53:00 UTC

[jira] [Commented] (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=16489948#comment-16489948 ] 

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

[~erickerickson], with 8u172 64-bit on Windows, I have just confirmed behavior when both ExitOnOutOfMemoryError and OnOutOfMemoryError options are configured.  I wrote a little program whose entire job was to fill up the heap and ignore OOME.

{code:java}
package foobar;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

public class Whee
{
	public static void main(String[] args)
	{
		AtomicInteger i = new AtomicInteger();
		List<String> l = new ArrayList<>();
		while (true)
		{
			try {
				l.add(Integer.toString(i.incrementAndGet()));
			}
			catch (OutOfMemoryError e)
			{
			}
		}
	}
}
{code}

The script configured for OnOutOfMemroyError just echos a single string to stdout.  If neither option is configured, the JVM stays running with no output, and if only the current option is configured, then I get the output from the command I configured and the JVM stays running.  If both are configured, the JVM exits *and* the script output is seen.

This means that if we can verify the java version is new enough, it will be dead easy to have OOM killing on ANY platform, and the executed command can just be responsible for logging the fact that an OOM occurred and Solr was killed.  I think I can leverage this on the startup scripting I've got planned for SOLR-6733 and SOLR-6734.

> 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
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org