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

[JENKINS-73692] Turn off logging from BackgroundGlobalBuildDiscarder #9663

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

jglick
Copy link
Member

@jglick jglick commented Aug 26, 2024

JENKINS-73692: I noticed that a support bundle (support-core) contained task-logs/Periodic background build discarder.log, task-logs/Periodic background build discarder.log.1, etc., each running around 10Mb. #5802 noted that this could happen

BackgroundGlobalBuildDiscarder will currently print something every hour if there are any jobs defined

but it was not obvious how serious this was at the time on a large controller with thousands of jobs. While it only runs every hour, and takes just a minute or so in this big controller, each time it spews out close to 2Mb of text. Worse, the log messages are almost completely uninformative since they only depend on the static configuration, not whether or not builds (or their artifacts) were actually deleted!

Testing done

Created two projects, one with a build discarder set, the other not; and configured a global build discarder.

diff --git core/src/main/java/jenkins/model/BackgroundGlobalBuildDiscarder.java core/src/main/java/jenkins/model/BackgroundGlobalBuildDiscarder.java
index 943a7fd04b..5c0c568984 100644
--- core/src/main/java/jenkins/model/BackgroundGlobalBuildDiscarder.java
+++ core/src/main/java/jenkins/model/BackgroundGlobalBuildDiscarder.java
@@ -75,6 +72,6 @@ public class BackgroundGlobalBuildDiscarder extends AsyncPeriodicWork {
 
     @Override
     public long getRecurrencePeriod() {
-        return HOUR;
+        return 1000;
     }
 }

and then watched the file. Every second it would print

Started at Mon Aug 26 14:54:57 EDT 2024
Processing xxx
Offering xxx to Project Build Discarder
xxx accepted by Project Build Discarder
Offering xxx to Specific Build Discarder
xxx accepted by Specific Build Discarder
Processing yyy
Offering yyy to Project Build Discarder
Offering yyy to Specific Build Discarder
yyy accepted by Specific Build Discarder
Finished at Mon Aug 26 14:54:57 EDT 2024. 1ms

With the patch, the file is no longer touched.

Proposed changelog entries

  • No longer printing verbose and uninformative messages to $JENKINS_HOME/logs/tasks/Periodic background build discarder.log.

Proposed upgrade guidelines

N/A

Before the changes are marked as ready-for-merge:

Maintainer checklist

@MarkEWaite MarkEWaite added the bug For changelog: Minor bug. Will be listed after features label Aug 26, 2024
@MarkEWaite
Copy link
Contributor

@jglick should this be considered for backporting to the 2.462.2 LTS release?

@MarkEWaite
Copy link
Contributor

This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback.

/label ready-for-merge

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Aug 27, 2024
@MarkEWaite MarkEWaite self-assigned this Aug 27, 2024
@jglick
Copy link
Member Author

jglick commented Aug 27, 2024

should this be considered for backporting

It could be. jenkinsci/support-core-plugin#573 (if accepted) would address the most important symptom even on older cores, but just avoiding the disk space is probably reason enough. I will file an issue for it.

@jglick jglick changed the title Turn off logging from BackgroundGlobalBuildDiscarder [JENKINS-73692] Turn off logging from BackgroundGlobalBuildDiscarder Aug 27, 2024
@MarkEWaite MarkEWaite merged commit f84ab6a into jenkinsci:master Aug 28, 2024
15 checks passed
@jglick jglick deleted the BackgroundGlobalBuildDiscarder branch August 28, 2024 12:08
krisstern pushed a commit to krisstern/jenkins that referenced this pull request Sep 16, 2024
jenkinsci#9663)

Turn off logging from `BackgroundGlobalBuildDiscarder`

(cherry picked from commit f84ab6a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For changelog: Minor bug. Will be listed after features ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants