Skip to content

Apache Lucene open-source search software

SOLR-14302: Ensure Solr always includes the stacktrace for exceptions by using '-OmitStackTraceInFastThrow'

Chris Hostetter255132fc1c6d
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 2738d622c4b..ebb7366e4d5 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -79,6 +79,9 @@ Bug Fixes
* SOLR-14128: Improve distributed locking around managed schema upgrade process. (ab)
+* SOLR-14302: Ensure Solr always includes the stacktrace for exceptions by using '-OmitStackTraceInFastThrow'
+ (hossman)
+
Other Changes
---------------------
* SOLR-14197: SolrResourceLoader: marked many methods as deprecated, and in some cases rerouted exiting logic to avoid
diff --git a/solr/bin/solr b/solr/bin/solr
index 11f50815889..9711dbd6610 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -2204,7 +2204,9 @@ function start_solr() {
SOLR_START_OPTS=('-server' "${JAVA_MEM_OPTS[@]}" "${GC_TUNE[@]}" "${GC_LOG_OPTS[@]}" "${IP_ACL_OPTS[@]}" \
"${REMOTE_JMX_OPTS[@]}" "${CLOUD_MODE_OPTS[@]}" $SOLR_LOG_LEVEL_OPT -Dsolr.log.dir="$SOLR_LOGS_DIR" \
"-Djetty.port=$SOLR_PORT" "-DSTOP.PORT=$stop_port" "-DSTOP.KEY=$STOP_KEY" \
- "${SOLR_HOST_ARG[@]}" "-Duser.timezone=$SOLR_TIMEZONE" \
+ # '-OmitStackTraceInFastThrow' ensures stack traces in errors,
+ # users who don't care about useful error msgs can override in SOLR_OPTS with +OmitStackTraceInFastThrow
+ "${SOLR_HOST_ARG[@]}" "-Duser.timezone=$SOLR_TIMEZONE" "-XX:-OmitStackTraceInFastThrow" \
"-Djetty.home=$SOLR_SERVER_DIR" "-Dsolr.solr.home=$SOLR_HOME" "-Dsolr.data.home=$SOLR_DATA_HOME" "-Dsolr.install.dir=$SOLR_TIP" \
"-Dsolr.default.confdir=$DEFAULT_CONFDIR" "${LOG4J_CONFIG[@]}" "${SOLR_OPTS[@]}" "${SECURITY_MANAGER_OPTS[@]}")
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
index 2f28bd68e0a..4b3f991bdf3 100755
--- a/solr/bin/solr.cmd
+++ b/solr/bin/solr.cmd
@@ -1284,6 +1284,9 @@ IF "%verbose%"=="1" (
)
set START_OPTS=-Duser.timezone=%SOLR_TIMEZONE%
+REM '-OmitStackTraceInFastThrow' ensures stack traces in errors,
+REM users who don't care about useful error msgs can override in SOLR_OPTS with +OmitStackTraceInFastThrow
+set "START_OPTS=%START_OPTS% -XX:-OmitStackTraceInFastThrow"
set START_OPTS=%START_OPTS% !GC_TUNE! %GC_LOG_OPTS%
IF NOT "!CLOUD_MODE_OPTS!"=="" set "START_OPTS=%START_OPTS% !CLOUD_MODE_OPTS!"
IF NOT "!IP_ACL_OPTS!"=="" set "START_OPTS=%START_OPTS% !IP_ACL_OPTS!"
diff --git a/solr/bin/solr.in.cmd b/solr/bin/solr.in.cmd
index f018f3188d0..9100db494f0 100755
--- a/solr/bin/solr.in.cmd
+++ b/solr/bin/solr.in.cmd
@@ -47,8 +47,7 @@ REM set GC_TUNE=%GC_TUNE% -XX:+UseCMSInitiatingOccupancyOnly
REM set GC_TUNE=%GC_TUNE% -XX:CMSInitiatingOccupancyFraction=50
REM set GC_TUNE=%GC_TUNE% -XX:CMSMaxAbortablePrecleanTime=6000
REM set GC_TUNE=%GC_TUNE% -XX:+CMSParallelRemarkEnabled
-REM set GC_TUNE=%GC_TUNE% -XX:+ParallelRefProcEnabled
-REM set GC_TUNE=%GC_TUNE% -XX:-OmitStackTraceInFastThrow etc.
+REM set GC_TUNE=%GC_TUNE% -XX:+ParallelRefProcEnabled etc.
REM Set the ZooKeeper connection string if using an external ZooKeeper ensemble
REM e.g. host1:2181,host2:2181/chroot
@@ -203,4 +202,4 @@ REM Runs solr in a java security manager sandbox. This can protect against some
REM Runtime properties are passed to the security policy file (server\etc\security.policy)
REM You can also tweak via standard JDK files such as ~\.java.policy, see https://s.apache.org/java8policy
REM This is experimental! It may not work at all with Hadoop/HDFS features.
-REM set SOLR_SECURITY_MANAGER_ENABLED=true
\ No newline at end of file
+REM set SOLR_SECURITY_MANAGER_ENABLED=true
diff --git a/solr/bin/solr.in.sh b/solr/bin/solr.in.sh
index 3b31cdc7843..b13d2084b34 100644
--- a/solr/bin/solr.in.sh
+++ b/solr/bin/solr.in.sh
@@ -58,8 +58,7 @@
#-XX:CMSInitiatingOccupancyFraction=50 \
#-XX:CMSMaxAbortablePrecleanTime=6000 \
#-XX:+CMSParallelRemarkEnabled \
-#-XX:+ParallelRefProcEnabled \
-#-XX:-OmitStackTraceInFastThrow etc.
+#-XX:+ParallelRefProcEnabled etc.
# Set the ZooKeeper connection string if using an external ZooKeeper ensemble
# e.g. host1:2181,host2:2181/chroot