Skip to content

SOLR-18066: Fix hideIgnoreStackTrace from the solr.xml#4278

Open
utsav00 wants to merge 2 commits intoapache:mainfrom
utsav00:fix/SOLR-18066-enable-hideStackTrace
Open

SOLR-18066: Fix hideIgnoreStackTrace from the solr.xml#4278
utsav00 wants to merge 2 commits intoapache:mainfrom
utsav00:fix/SOLR-18066-enable-hideStackTrace

Conversation

@utsav00
Copy link
Copy Markdown

@utsav00 utsav00 commented Apr 11, 2026

https://issues.apache.org/jira/browse/SOLR-18066

Description

Solr has a hideStackTrace setting in solr.xml that's meant to strip Java stack traces from HTTP error responses,

The setting was being respected for core-level endpoints but completely ignored for coreless endpoints like logging/levels that aren't tied to any specific Solr index.

Solution

The fix adds a two-tier fallback:

  1. If there's a core -> read hideStackTrace from it (existing)
  2. If there's no core -> fall back to the CoreContainer directly from the request context

Tests

After building, fetch a coreless point -

curl -s -X PUT http://localhost:8983/api/node/logging/levels \
  -H "Content-Type: application/json" \
  -d '{"logger": "org.apache.solr", "level": "DEBUG"}' | python3 -m json.tool

Same endpoint after toggling hideStackTrace in the solr.xml in the build folder

The response after the fix and turning the respective config true -

{
    "responseHeader": {
        "status": 500,
        "QTime": 159
    },
    "error": {
        "code": 500,
        "errorClass": "com.fasterxml.jackson.databind.exc.MismatchedInputException",
        "msg": "Cannot deserialize value of type `java.util.ArrayList<org.apache.solr.client.api.model.LogLevelChange>` from Object value (token `JsonToken.START_OBJECT`)\n at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 1]"
    }
}

No trace in the response body

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide (nothing to do I believe)
  • I have added a changelog entry for my change

@igiguere
Copy link
Copy Markdown
Contributor

+1 for me.

Good catch, and thank you! I remember woking on the ticket to hide stack traces, I should probably have paid attention to that when wroking on JAX-RS resources.

@utsav00
Copy link
Copy Markdown
Author

utsav00 commented Apr 14, 2026

Was happy to work on this, @igiguere!

This is a dumb question but I am not able to find an option to rerun the workflow - doesn't seem to be failing due to the changes on this PR. Can you please help retrigger the workflow run?

@epugh
Copy link
Copy Markdown
Contributor

epugh commented Apr 14, 2026

I have retriggered the solr tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants