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

RemoteInvocationHandler.reportStats LogRecord’s could get mangled during serialization #392

Merged
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
79 changes: 39 additions & 40 deletions src/main/java/hudson/remoting/RemoteInvocationHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -703,13 +703,12 @@ private void reportStats() {
double tStd = tCount <= 0 || tVarTimesCount < 0 ? 0 : Math.sqrt(tVarTimesCount / tCount);
Level targetLevel = m15Avg > 100 ? Level.INFO : m15Avg > 50 ? Level.FINE : Level.FINER;
if (logger.isLoggable(targetLevel)) {
logger.log(targetLevel, "rate(1min) = {0,number,0.0}±{1,number,0.0}/sec; "
+ "rate(5min) = {2,number,0.0}±{3,number,0.0}/sec; "
+ "rate(15min) = {4,number,0.0}±{5,number,0.0}/sec; "
+ "rate(total) = {6,number,0.0}±{7,number,0.0}/sec; N = {8,number}",
new Object[]{
logger.log(targetLevel, () -> String.format("rate(1min) = %.1f±%.1f/sec; "
+ "rate(5min) = %.1f±%.1f/sec; "
+ "rate(15min) = %.1f±%.1f/sec; "
+ "rate(total) = %.1f±%.1f/sec; N = %d",
m1Avg, m1Std, m5Avg, m5Std, m15Avg, m15Std, tAvg, tStd, tCount
});
));
}
if (tCount < 10L) {
// less than 10 reports is too soon to start alerting the user
Expand All @@ -719,63 +718,63 @@ private void reportStats() {
if (m15Std > 1 && 100 < m15Avg - 2 * m15Std) {
if (tStd > 1 && 100 < tAvg - 2 * tStd) {
logger.log(Level.SEVERE,
Copy link
Member Author

Choose a reason for hiding this comment

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

These are some sort of exotic conditions with no test coverage that I know of, so just hoping it works.

Copy link
Member Author

Choose a reason for hiding this comment

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

see #81

retainOrigin ?
"The all time average rate is {0,number,0.0}±{1,number,0.0}/sec. "
+ "The 15 minute average rate is {2,number,0.0}±{3,number,0.0}/sec. "
String.format(retainOrigin ?
"The all time average rate is %.1f±%.1f/sec. "
+ "The 15 minute average rate is %.1f±%.1f/sec. "
+ "At the 95% confidence level both are above 100.0/sec. "
+ "If this message is repeated often in the logs then PLEASE "
+ "seriously consider setting system property ''hudson.remoting"
+ ".RemoteInvocationHandler.Unexporter.retainOrigin'' to "
+ "''false'' to trade debug diagnostics for reduced memory "
+ "seriously consider setting system property 'hudson.remoting"
+ ".RemoteInvocationHandler.Unexporter.retainOrigin' to "
+ "'false' to trade debug diagnostics for reduced memory "
+ "pressure."
: "The all time average rate is {0,number,0.0}±{1,number,0.0}/sec. "
+ "The 15 minute average rate is {2,number,0.0}±{3,number,0.0}/sec. "
+ "At the 95% confidence level both are above 100.0/sec. ",
new Object[]{tAvg, tStd, m15Avg, m15Std});
: "The all time average rate is %.1f±%.1f/sec. "
+ "The 15 minute average rate is %.1f±%.1f/sec. "
+ "At the 95%% confidence level both are above 100.0/sec. ",
tAvg, tStd, m15Avg, m15Std));
return;
}
logger.log(Level.WARNING,
retainOrigin ?
"The 15 minute average rate is {0,number,0.0}±{1,number,0.0}/sec. "
String.format(retainOrigin ?
"The 15 minute average rate is %.1f±%.1f/sec. "
+ "At the 95% confidence level this is above 100.0/sec. "
+ "If this message is repeated often in the logs then very "
+ "seriously consider setting system property ''hudson.remoting"
+ ".RemoteInvocationHandler.Unexporter.retainOrigin'' to "
+ "''false'' to trade debug diagnostics for reduced memory "
+ "seriously consider setting system property 'hudson.remoting"
+ ".RemoteInvocationHandler.Unexporter.retainOrigin' to "
+ "'false' to trade debug diagnostics for reduced memory "
+ "pressure."
: "The 15 minute average rate is {0,number,0.0}±{1,number,0.0}/sec. "
+ "At the 95% confidence level this is above 100.0/sec. ",
new Object[]{m15Avg, m15Std});
: "The 15 minute average rate is %.1f±%.1f/sec. "
+ "At the 95%% confidence level this is above 100.0/sec. ",
m15Avg, m15Std));
return;
}
if (m5Std > 1 && 100 < m5Avg - 2 * m5Std) {
logger.log(Level.WARNING,
retainOrigin ?
"The 5 minute average rate is {0,number,0.0}±{1,number,0.0}/sec. "
String.format(retainOrigin ?
"The 5 minute average rate is %.1f±%.1f/sec. "
+ "At the 95% confidence level this is above 100.0/sec. "
+ "If this message is repeated often in the logs then "
+ "seriously consider setting system property ''hudson.remoting"
+ ".RemoteInvocationHandler.Unexporter.retainOrigin'' to "
+ "''false'' to trade debug diagnostics for reduced memory "
+ "seriously consider setting system property 'hudson.remoting"
+ ".RemoteInvocationHandler.Unexporter.retainOrigin' to "
+ "'false' to trade debug diagnostics for reduced memory "
+ "pressure."
: "The 5 minute average rate is {0,number,0.0}±{1,number,0.0}/sec. "
+ "At the 95% confidence level this is above 100.0/sec. ",
new Object[]{m5Avg, m5Std});
: "The 5 minute average rate is %.1f±%.1f/sec. "
+ "At the 95%% confidence level this is above 100.0/sec. ",
m5Avg, m5Std));
return;
}
if (m1Std > 1 && 100 < m1Avg - 2 * m1Std) {
logger.log(Level.INFO,
retainOrigin ?
"The 1 minute average rate is {0,number,0.0}±{1,number,0.0}/sec. "
String.format(retainOrigin ?
"The 1 minute average rate is %.1f±%.1f/sec. "
+ "At the 95% confidence level this is above 100.0/sec. "
+ "If this message is repeated often in the logs then "
+ "consider setting system property ''hudson.remoting"
+ ".RemoteInvocationHandler.Unexporter.retainOrigin'' to "
+ "''false'' to trade debug diagnostics for reduced memory "
+ "consider setting system property 'hudson.remoting"
+ ".RemoteInvocationHandler.Unexporter.retainOrigin' to "
+ "'false' to trade debug diagnostics for reduced memory "
+ "pressure."
: "The 1 minute average rate is {0,number,0.0}±{1,number,0.0}/sec. "
+ "At the 95% confidence level this is above 100.0/sec. ",
new Object[]{m1Avg, m1Std});
: "The 1 minute average rate is %.1f±%.1f/sec. "
+ "At the 95%% confidence level this is above 100.0/sec. ",
m1Avg, m1Std));
return;
}
}
Expand Down