Resolved: ORDS killed with ${APP_VM_OPTS[@]}" ${ORDS_DEBUG}  error

Resolved: ORDS killed with ${APP_VM_OPTS[@]}" ${ORDS_DEBUG} error

Resolving the /usr/local/bin/ords: line 221 error

You may have encountered ORDS being killed at various times, often during startup, but occasionally whilst in operation.

The error looks like this...

/usr/local/bin/ords: line 221:   734 Killed                  ${JAVA} "${APP_VM_OPTS[@]}" ${ORDS_DEBUG} -jar "${ORDS_HOME}"/${ORDS_WAR} ${ORDS_VERBOSE} "$@"

You may have also seen different line numbers reported, like this...

/home/oracle/software/ords/bin/ords: line 221:   724 Killed                  ${JAVA} "${APP_VM_OPTS[@]}" ${ORDS_DEBUG} -jar "${ORDS_HOME}"/${ORDS_WAR} ${ORDS_VERBOSE} "$@"

After some investigation, it appears that the cause is very often related to the amount of initial and maximum heap size for the Java Virtual Machine (JVM) to be used by ORDS & Java Applications.

I will update this blog if other reasons are found.

Oracle-Base suggests setting the initial heap (Xms) and maximum heap (Xmx) to 1126 megabytes.

export _JAVA_OPTIONS="-Xms1126M -Xmx1126M"

By setting this environment variable, ORDS will use these heap sizes by default, unless overridden by specific options passed to the application at launch time.

Therefore the full set of commands to launch ORDS (assuming your config file is in the recommended location of /etc/ords/config) would be

export _JAVA_OPTIONS="-Xms1126M -Xmx1126M"
ords --config /etc/ords/config serve

However, after starting ORDS, you may see the error again. The trick here is to reduce the heap sizes and find the sweet spot. Try these out:

This seemed to work for my Oracle 23c Free Docker, APEX & ORDS blog:

export _JAVA_OPTIONS="-Xms512M -Xmx512M"

... and this seemed to work for the m1 version of the same blog - although slow performance was noted

export _JAVA_OPTIONS="-Xms256M -Xmx256M"

As I said previously, the trick here is to start by reducing the heap sizes and then experiment by increasing them until you find the sweet spot for your environment.

Hope this helps