Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368350 - Git holds open files on disk so they cannot be erased
Summary: Git holds open files on disk so they cannot be erased
Status: RESOLVED FIXED
Alias: None
Product: Hudson
Classification: Technology
Component: GIT (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Bob Foster CLA
QA Contact:
URL:
Whiteboard: candidate-3.2.0
Keywords:
: 368549 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-01-11 09:31 EST by Geoff Waymark CLA
Modified: 2014-04-17 17:51 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Geoff Waymark CLA 2012-01-11 09:31:54 EST
Build Identifier: #43 Eclipse build

Windows only.

Reproducible: Always

Steps to Reproduce:
1. Create a simple job that clones a git url
2. Build it
3. From windows explorer or the command line try to delete the workspace

The .git directory is held open by a java process.
Comment 1 Geoff Waymark CLA 2012-01-13 11:15:20 EST
*** Bug 368549 has been marked as a duplicate of this bug. ***
Comment 2 upendra attarde CLA 2012-05-25 00:47:17 EDT
Facing the same problem and getting the following Exception:-

Cleaning the workspace because project is configured to clean the 
workspace before each build.
FATAL: Unable to delete C:\Users\admin\.hudson\jobs\myproject
\workspace\.git\objects\pack\pack-
b38c095fff6a391435a492ccf49985ed82dfd245.pack
java.io.IOException: Unable to delete C:\Users\admin\.hudson\jobs
\myproject\workspace\.git\objects\pack\pack-
b38c095fff6a391435a492ccf49985ed82dfd245.pack
	at hudson.Util.deleteFile(Util.java:263)
	at hudson.Util.deleteRecursive(Util.java:305)
	at hudson.Util.deleteContentsRecursive(Util.java:224)
	at hudson.Util.deleteRecursive(Util.java:304)
	at hudson.Util.deleteContentsRecursive(Util.java:224)
	at hudson.Util.deleteRecursive(Util.java:304)
	at hudson.Util.deleteContentsRecursive(Util.java:224)
	at hudson.Util.deleteRecursive(Util.java:304)
	at hudson.Util.deleteContentsRecursive(Util.java:224)
	at hudson.Util.deleteRecursive(Util.java:304)
	at hudson.FilePath$9.invoke(FilePath.java:826)
	at hudson.FilePath$9.invoke(FilePath.java:824)
	at hudson.FilePath.act(FilePath.java:758)
	at hudson.FilePath.act(FilePath.java:740)
	at hudson.FilePath.deleteRecursive(FilePath.java:824)
	at hudson.model.AbstractProject.cleanWorkspace

(AbstractProject.java:2053)
	at hudson.model.AbstractBuild$AbstractRunner.run

(AbstractBuild.java:419)
	at hudson.model.Run.run(Run.java:1366)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
	at hudson.model.ResourceController.execute

(ResourceController.java:88)
	at hudson.model.Executor.run(Executor.java:145)

pack-b38c095fff6a391435a492ccf49985ed82dfd245.pack file is held open by java .
Comment 3 Bob Foster CLA 2014-04-14 18:18:04 EDT
The problem is not restricted to Windows, just easier to reproduce there. For example, if Hudson home is on an NFS share, the open files will create .nfsNNNN files in the local workspace that can't be deleted.

In simple terms, once user has done a remote build using git, the job can't be deleted.

NB: There is a separate bug 432569 for the issue that non-deletable job directory causes partial, invalid delete.
Comment 4 Bob Foster CLA 2014-04-15 19:01:04 EDT
After 1 build:

hudson$ lsof -p 29109 | grep "\.git"
java    29109 bobfoster  246r     REG                1,2      2067 121028078 /Users/bobfoster/hudson/org.eclipse.hudson.core/work/teams/Team1/jobs/Team1.JobA/workspace/.git/objects/pack/pack-f35b66ac8a7d977047c992b0b2eeded35066b469.pack

After 2 builds:

hudson$ lsof -p 29109 | grep "\.git"
java    29109 bobfoster  246r     REG                1,2      2067 121028078 /Users/bobfoster/hudson/org.eclipse.hudson.core/work/teams/Team1/jobs/Team1.JobA/workspace/.git/objects/pack/pack-f35b66ac8a7d977047c992b0b2eeded35066b469.pack
java    29109 bobfoster  247r     REG                1,2      2067 121028078 /Users/bobfoster/hudson/org.eclipse.hudson.core/work/teams/Team1/jobs/Team1.JobA/workspace/.git/objects/pack/pack-f35b66ac8a7d977047c992b0b2eeded35066b469.pack

Jenkins had a similar bug: https://issues.jenkins-ci.org/browse/JENKINS-19994
Comment 5 Bob Foster CLA 2014-04-17 17:44:50 EDT
Fixed by commit 24ca398eff06919394bebd2a31b0f465d3b5c405 - will be released as part of 3.2.0 plugins
Comment 6 Bob Foster CLA 2014-04-17 17:51:02 EDT
See previous comment.