Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 308506 - Refactoring causes Exception on Windows
Summary: Refactoring causes Exception on Windows
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 0.7.1   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 0.9.0-M2   Edit
Assignee: Jens Baumgart CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-08 11:57 EDT by Kyle Harms CLA
Modified: 2016-04-26 06:24 EDT (History)
3 users (show)

See Also:


Attachments
Eclipse log of exception (13.93 KB, text/plain)
2010-04-08 11:57 EDT, Kyle Harms CLA
no flags Details
Workaround for Windows refactoring (3.84 KB, patch)
2010-04-09 15:13 EDT, Kyle Harms CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle Harms CLA 2010-04-08 11:57:11 EDT
Created attachment 164230 [details]
Eclipse log of exception

Refactoring Java code on Windows XP or Vista causes an error.  The refactoring will not complete and the source will be left in an inconsistent state.


The error message that shows during refactoring:
====
"An exception has been caught while processing the refactoring 'Rename Compilation Unit'.

Reason:
Problems encountered while moving resources.
====

The "Details >>" button of the error dialog shows nothing.  However the eclipse workspace .log file shows the exception.


I have tried to reproduce this on Linux and OS X without success.  I can reproduce this faithfully on Windows.

How to reproduce:
1.  Rename a Java class with a large Java project with Egit enabled on Windows.
2.  After 1, refactor again.
3.  Repeat until the error occurs (usually only two or three tries).


Eclipse 3.5, Egit 0.7.1, Windows XP
Comment 1 Mykola Nikishov CLA 2010-04-09 14:02:55 EDT
Comment on attachment 164230 [details]
Eclipse log of exception

MIME Type changed
Comment 2 Kyle Harms CLA 2010-04-09 15:13:12 EDT
Created attachment 164420 [details]
Workaround for Windows refactoring

After some investigation into this issue it appears that the .git/index file is being read by multiple threads at once.  

This particular re-factoring problem is caused when the FileLock of DirCache tries to FileLock.commit.  FileLock.commit tries to delete the old .git/index, however, if at the same time DirCache may be reading .git/index and since Windows has locked the file FileLock.commit cannot delete the file.

There may be better ways to fix this however this works for now.
Comment 3 Jens Baumgart CLA 2010-07-23 08:05:33 EDT
Fix proposed: http://egit.eclipse.org/r/#change,1172
Comment 4 Stefan Lay CLA 2010-08-04 08:38:50 EDT
Fixed with db82b8d7eb646a2d31f1b4e52ab4a623743192e9
Comment 5 SVK PETO CLA 2016-04-26 06:24:43 EDT
The same problem on W7.
Version: Luna Service Release 2 (4.4.2)