Skip to content

Handle missing stack traces in ExtendedThreadInformation #3655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 2.x
Choose a base branch
from

Conversation

PAX523
Copy link

@PAX523 PAX523 commented May 8, 2025

Fix ArrayIndexOutOfBoundsException on invocation of Message.getFormattedMessage() when any thread has no stack trace, which occurs on some JVM implementations.

See issue: #3214

The mentioned method retrieves detail information about all existing threads and collects it in a result string. One of the information are the stack traces. Some JVM implementations (such as OpenJ9) have an empty stack trace of threads in a specific state. This, in turn, results in a ArrayIndexOutOfBoundsException if the user tries to dump all thread information via org.apache.logging.log4j.message.ThreadDumpMessage.ThreadDumpMessage(String).

Checklist

  • Base your changes on 2.x branch if you are targeting Log4j 2; use main otherwise
  • ./mvnw verify succeeds (if it fails due to code formatting issues reported by Spotless, simply run ./mvnw spotless:apply and retry)
  • Non-trivial changes contain an entry file in the src/changelog/.2.x.x directory
  • Tests for the changes are provided
  • Commits are signed (optional, but highly recommended)

Fix ArrayIndexOutOfBoundsException on invocation of Message.getFormattedMessage() when any thread has no stack trace, which occurs on some JVM implementations.
Copy link

github-actions bot commented May 8, 2025

Job Requested goals Build Tool Version Build Outcome Build Scan®
build-macos-latest clean install 3.9.8 Build Scan PUBLISHED
build-ubuntu-latest clean install 3.9.8 Build Scan PUBLISHED
build-windows-latest clean install 3.9.8 Build Scan PUBLISHED
Generated by gradle/develocity-actions

@ppkarwasz ppkarwasz moved this from To triage to In review in Log4j bug tracker May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

1 participant