Skip to content
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

[FIXED JENKINS-44330] - Prevent classloading of Target comparator in LogRecorder#orderedTargets() #2894

Conversation

oleg-nenashev
Copy link
Member

@oleg-nenashev oleg-nenashev commented May 20, 2017

It is just a hotfix, there may be other LogRecorders affected. Ideally we need a response from Jetty maintainers to jetty/jetty.project#1563. No tests since I see no way to trigger such classloading + no actual need in it.

See JENKINS-44330.

Changelog entries

Proposed changelog entries:

Submitter checklist

  • JIRA issue is well described
  • Link to JIRA ticket in description, if appropriate
  • Appropriate autotests or explanation to why this change has no tests
  • For new API and extension points: Link to the reference implementation in open-source (or example in Javadoc)

Desired reviewers

@reviewbybees @olamy @damphyr

…LogRecorder#orderedTargets()

It is just a hotfix, there may be other LogRecorders affected. Ideally we need a response from Jetty maintainers to jetty/jetty.project#1563. No tests since I see no way to trigger such classloading + no actual need in it.
@oleg-nenashev oleg-nenashev added needs-more-reviews Complex change, which would benefit from more eyes regression-fix Pull request that fixes a regression in one of the previous Jenkins releases labels May 20, 2017
@oleg-nenashev
Copy link
Member Author

oleg-nenashev commented May 20, 2017

Bonus: it improves performance a bit.

@ghost
Copy link

ghost commented May 20, 2017

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

public int compare(Target left, Target right) {
return right.getName().length() - left.getName().length();
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@oleg-nenashev how this change can prevent a StackOverflow?

Copy link
Member Author

Choose a reason for hiding this comment

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

The class will be loaded in Static initializer instead of the orderedTargets() call. Static initilizer will be run when the class is first accessed, hence it will happen long before the Recorder starts receiving the data

Copy link
Contributor

Choose a reason for hiding this comment

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

@oleg-nenashev Thanks. It looks like a bad design of LogRecorder.

Copy link
Member

Choose a reason for hiding this comment

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

Well logging systems generally are sensitive to this class of bugs: you have to be very careful to not run any potentially novel classes in the course of handling a log event.

public int compare(Target left, Target right) {
return right.getName().length() - left.getName().length();
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Well logging systems generally are sensitive to this class of bugs: you have to be very careful to not run any potentially novel classes in the course of handling a log event.

@oleg-nenashev
Copy link
Member Author

@reviewbybees done. Will merge towards the next weekly if nobody votes against

@oleg-nenashev oleg-nenashev added ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback and removed needs-more-reviews Complex change, which would benefit from more eyes labels May 20, 2017
@oleg-nenashev oleg-nenashev merged commit a27b739 into jenkinsci:master May 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback regression-fix Pull request that fixes a regression in one of the previous Jenkins releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants