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

GC before trying to delete the Jenkins home directory #357

Merged
merged 3 commits into from
Dec 8, 2021

Conversation

basil
Copy link
Member

@basil basil commented Dec 8, 2021

We run System.gc() after shutting down Jenkins and deleting the Jenkins home directory, but by then it is too late on Windows: deleting the Jenkins home directory may have already failed due to open files held by class loaders. This PR solves the problem by moving the GC to before we delete the Jenkins home directory.

@basil basil added the bug label Dec 8, 2021
@basil
Copy link
Member Author

basil commented Dec 8, 2021

In draft state until I open a PR demonstrating that with this change the test suite passes on Windows.

basil added a commit to basil/jenkins that referenced this pull request Dec 8, 2021
@basil basil marked this pull request as ready for review December 8, 2021 22:35
@basil
Copy link
Member Author

basil commented Dec 8, 2021

This PR was tested successfully in a passing Windows CI run in jenkinsci/jenkins#6024.

Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

Interestingly it seems that the bug has been fixed for URLClassLoader as of Java 7, once switching to URLClassLoader we may not need this work around

src/main/java/org/jvnet/hudson/test/HudsonTestCase.java Outdated Show resolved Hide resolved
@basil basil merged commit 5a5dbf5 into jenkinsci:master Dec 8, 2021
@basil basil deleted the windows branch December 8, 2021 23:23
basil added a commit to basil/jenkins that referenced this pull request Dec 10, 2021
basil added a commit to basil/jenkins that referenced this pull request Dec 11, 2021
basil added a commit to basil/jenkins that referenced this pull request Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants