Bug 408846 - Delete Repository fails due to open file handles
Summary: Delete Repository fails due to open file handles
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 2.3   Edit
Hardware: PC Windows 8
: P3 normal with 1 vote (vote)
Target Milestone: 5.8   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 411682 564615 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-05-23 13:16 EDT by Timo Kinnunen CLA
Modified: 2020-08-25 08:28 EDT (History)
5 users (show)

See Also:


Attachments
Open file handles in Process Explorer (72.62 KB, image/png)
2013-05-23 13:18 EDT, Timo Kinnunen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Timo Kinnunen CLA 2013-05-23 13:16:37 EDT
What steps will reproduce the problem?
1. In Git Repository Exploring, click "Add an existing repository to this view"
2. Select the clone of repository from git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.aggregator.git and click Finish
3. Expend the added repository.
4. Expand the list of submodules.
5. Right-click the root node and select Delete Repository..., click Ok
6. Error message pops up but the repository is removed from view but file handles to submodules are kept open.

Trying to delete the folder in Windows File Explorer fails with a message saying that several files are open in eclipse.exe. These file handles are visible in Process Explorer as well. 

Closing the Git Repository Exploring perspective cleans up the file handles.


-- Error Details --
Date: Thu May 23 19:48:01 EEST 2013
Message: Could not delete file D:\y\.git\modules\eclipse.jdt\objects\pack\pack-dfaf47389e3c5bc5b64f4ee508db7e1a077e8908.pack
Severity: Error
Product: Eclipse 1.5.2.20130110-1126 (org.eclipse.epp.package.java.product)
Plugin: org.eclipse.egit.ui
Session Data:
eclipse.buildId=M20130204-1200
java.version=1.7.0_21
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.java.product

Exception Stack Trace:
java.io.IOException: Could not delete file D:\y\.git\modules\eclipse.jdt\objects\pack\pack-dfaf47389e3c5bc5b64f4ee508db7e1a077e8908.pack
	at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:142)
	at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:126)
	at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:126)
	at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:126)
	at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:126)
	at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:126)
	at org.eclipse.egit.ui.internal.repository.tree.command.RemoveCommand.deleteRepositoryContent(RemoveCommand.java:221)
	at org.eclipse.egit.ui.internal.repository.tree.command.RemoveCommand.access$2(RemoveCommand.java:205)
	at org.eclipse.egit.ui.internal.repository.tree.command.RemoveCommand$2.run(RemoveCommand.java:162)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Comment 1 Timo Kinnunen CLA 2013-05-23 13:18:21 EDT
Created attachment 231401 [details]
Open file handles in Process Explorer

Screenshot of the list of open file handles.
Comment 2 Jay Arthanareeswaran CLA 2013-07-10 08:53:28 EDT
*** Bug 411682 has been marked as a duplicate of this bug. ***
Comment 3 Alexander Nittka CLA 2020-03-13 04:51:42 EDT
I am not sure if this problem is just an EGit-UI problem. In my current Windows 10 EGit development setup, deleting a repository fails both in the development Eckipse and in the runtime Eclipse. In contrast to the original ticket comment, deleting in the Windows File explorer immediately works. In my case submodules were not involved. I created a repository with two committed files. The project is not imported (repo only visible in the Git Repositories view, no other EGit views open).

But even the EGit and JGit unit tests (e.g. all in CloneCommandTest) fail on tear down because files cannot be deleted.

Of course, these two problems with deletion could have different causes.
Comment 4 Eclipse Genie CLA 2020-03-13 09:17:54 EDT
New Gerrit change created: https://git.eclipse.org/r/159310
Comment 5 Alexander Nittka CLA 2020-03-13 09:24:57 EDT
At least for the non-submodule-case the problem seems to have been that Windows does not permit the deletion of read-only files. When stripping down CloneCommandTest cases, I noticed that when removing dst.setReadOnly() in JGit's ObjectDirectory (lines 691, 708), the tests did not fail anymore.

As a consequence, I made files writable in FileUtils before trying to delete them. Afterwards, the CloneCommandTest cases succeeded and deleting a repository from the Git Repositories View worked as well.
Comment 6 Alexander Nittka CLA 2020-03-13 09:40:39 EDT
The submodule deletion problem is not solved, so the two problems were indeed unrelated (sorry for hijacking the ticket).
Comment 7 Eclipse Genie CLA 2020-03-14 09:55:32 EDT
New Gerrit change created: https://git.eclipse.org/r/159363
Comment 8 Eclipse Genie CLA 2020-03-26 15:08:35 EDT
Gerrit change https://git.eclipse.org/r/159363 was merged to [master].
Commit: http://git.eclipse.org/c/egit/egit.git/commit/?id=89781627c1e0a2abbfa6901921ba33524ebc7b73
Comment 9 Eclipse Genie CLA 2020-04-03 15:13:18 EDT
Gerrit change https://git.eclipse.org/r/159310 was merged to [master].
Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=bc4ed530a5f19b5dae77f3aa76369003bd6c3599
Comment 10 Alexander Nittka CLA 2020-04-04 01:10:33 EDT
With the two changes merged, this issue should be resolved. Maybe someone could confirm that.
Comment 11 Matthias Sohn CLA 2020-08-25 08:28:47 EDT
*** Bug 564615 has been marked as a duplicate of this bug. ***