-
Notifications
You must be signed in to change notification settings - Fork 146
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-74975] Fix Semaphore over-allocation of permits / limit all CleanupTasks #495
base: master
Are you sure you want to change the base?
Conversation
@@ -382,22 +389,27 @@ public static class Deleter extends ItemListener { | |||
|
|||
private static /* almost final */ int CLEANUP_THREAD_LIMIT = SystemProperties.getInteger(Deleter.class.getName() + ".CLEANUP_THREAD_LIMIT", Integer.valueOf(0)).intValue(); | |||
|
|||
private final transient ExecutorService executorService = Executors.newSingleThreadExecutor(threadFactory()); |
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.
I'm unsure; Will this survive a reload configuration from disk?
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.
I don't think this class is saved to disk at all; it's just an extension. If you restart Jenkins while a lot of deletion tasks are waiting to run, I do think they will all be lost if that's what you mean, but it looks like that was the case before this PR too.
@@ -382,22 +389,27 @@ public static class Deleter extends ItemListener { | |||
|
|||
private static /* almost final */ int CLEANUP_THREAD_LIMIT = SystemProperties.getInteger(Deleter.class.getName() + ".CLEANUP_THREAD_LIMIT", Integer.valueOf(0)).intValue(); | |||
|
|||
private final transient ExecutorService executorService = Executors.newSingleThreadExecutor(threadFactory()); |
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.
I don't think this class is saved to disk at all; it's just an extension. If you restart Jenkins while a lot of deletion tasks are waiting to run, I do think they will all be lost if that's what you mean, but it looks like that was the case before this PR too.
(amends #237)
The
CleanupTask
of the built-in node were scheduled instantly without acquiring permit from the Semaphore but they were releasing permits, hence creating additional permits over time. Reducing the effectiveness of the limit overtime.Add the Jenkins
built-in
node to list of nodes to be limited.NOTES: I guess another solution is to continue not limit the number of
CleanupTask
executed for thebuilt-in
node but that looks rather confusing in the first place to have aCLEANUP_THREAD_LIMIT
that only partially limit the Cleanup tasks..Testing done
-Djenkins.branch.WorkspaceLocatorImpl\$Deleter.CLEANUP_THREAD_LIMIT=1
jenkins.branch.WorkspaceLocatorImpl.Deleter.cleanupPool.availablePermits()
and validate that it shows1
jenkins.branch.WorkspaceLocatorImpl.Deleter.cleanupPool.availablePermits()
and validate that it still shows1
Submitter checklist