-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8329013: StackOverflowError when starting Apache Tomcat with signed jar #18534
Conversation
👋 Welcome back coffeys! A progress list of the required criteria for merging this PR into |
@coffeys This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 169 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
Hello Sean, from what I understand of this proposed fix, what we are attempting here is to prevent a re-entrant call into |
Thanks for taking a look at this Jai. Without the src patch, the test should create an SOE. Have a look at the resulting jtr file[1]. jtreg complains about a timeout due to some other lock up issue. I figured that since the test shouldn't fail, then it shouldn't be an issue. Probably worth logging another issue to track that. The [1] (pasting a better SOE stacktrace (first one was partial removal of src patch)
|
You are right, turns out the jtr file did have the StackOverFlowError from the test introduced in this PR - I just didn't check it given the other issue. Now that I look at the stacktrace and the complex checks we are adding, I am starting to wonder if these re-entrancy checks should actually be added within the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code changes LGTM. Some comments on the test.
EventHelper.isLoggingSecurity(); | ||
return super.getProperty(p); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add newline?
// opening of a signed jar during System logger initialization triggered | ||
// a recursive call (via EventHelper.isLoggingSecurity) back into | ||
// logger API | ||
EventHelper.isLoggingSecurity(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an additional check you could set a static volatile boolean to true here and double check that it's been set at the end of the main method,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact it doesn't need to be volatile since it all happens in the main thread - but that's not a big issue.
@jaikiran I did look at adding logic in the Logger libraries also to correct this issue. Significant work was done in that area last year via JDK-8314263 I guess the question is what sort of Logger and LoggerFinder would you return in cases where recursion is detected ? Extra issues might arise from the System.getLogger method being public and widely used. Additional issues might stem from the fact that Logger libraries can be plugged in and returned Logger might be stored as a static variable etc. It seemed safer to catch the issue at the EventHelper level - a library that's confined to internal JDK use. |
Agreed - a lot of questions will need to be answered before attempting any change in that code. I don't have answers to any of those though :) Given that Having said that, I didn't mean to stop you from doing this change in |
Thanks for the reviews. Yes - your suggestion would be another example of how recursion could occur with the System Logger Jai. I'll have a look to see if some sort of Noop Logger could be returned if recursion is detected at System Logger end. /integrate |
Going to push as commit 925d829.
Your commit was automatically rebased without conflicts. |
Calling extra logging calls during initialization of Logger libraries can cause recursion leading to StackOverflowError
This patch adds logic to the EventHelper class to detect recursion and prevent it.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18534/head:pull/18534
$ git checkout pull/18534
Update a local copy of the PR:
$ git checkout pull/18534
$ git pull https://git.openjdk.org/jdk.git pull/18534/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18534
View PR using the GUI difftool:
$ git pr show -t 18534
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18534.diff
Webrev
Link to Webrev Comment