Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,19 @@ public void execute(final Runnable command) {
if (t instanceof OutOfMemoryError) {
throw t;
}
if (enableSubmitterStackTrace) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we still need to have this flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe so. So the baseCause, which is now always logged, will be t (the real throwable) if submitterStackTrace is null. Since when enableSumbitterStackTrace==false then submitterStackTrace=null (logic from above), then we will only be logging t if enableSubmitterStackTrace==false. The submitterStackTraces will only be included if enableSubmitterStackTrace==true.

It is still a little different than the previous logic, which only logged the error message, but I think the spirit of the flag is still the same.

log.error(
"Uncaught exception {} thrown by thread: {}",
t,
currentThread.getName(),
submitterStackTrace);
} else {
log.error("Uncaught exception {} thrown by thread: {}", t, currentThread.getName());
// Flip around the exception cause tree, because it is in reverse order
Throwable baseCause = t;
Throwable nextCause = submitterStackTrace;
while (nextCause != null) {
baseCause = new Exception(nextCause.getMessage(), baseCause);
baseCause.setStackTrace(nextCause.getStackTrace());
nextCause = nextCause.getCause();
}
log.error(
"Uncaught exception {} thrown by thread: {}",
t,
currentThread.getName(),
baseCause);
throw t;
} finally {
isServerPool.remove();
Expand Down