Community
Participate
Working Groups
I20111209-1447 + EGit 1.2.0.201112111816 What steps will reproduce the problem? 1. Team > Add on first project from a repo 2. Quickly repeat the same action on a different project in the same repo 3. Inspect the Error Log -- Error Details -- Date: Wed Dec 14 12:57:24 CET 2011 Message: Failed to add resource to index Severity: Error Product: Eclipse SDK 3.8.0.v201112091447 (org.eclipse.sdk.ide) Plugin: org.eclipse.egit.core Session Data: eclipse.buildId=I20111209-1447 java.fullversion=JRE 1.6.0 IBM J9 2.4 Windows XP x86-32 jvmwi3260sr7-20091214_49398 (JIT enabled, AOT enabled) J9VM - 20091214_049398 JIT - r9_20091123_13891 GC - 20091111_AA BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=pl_PL Command-line arguments: -os win32 -ws win32 -arch x86 Exception Stack Trace: org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of add command at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:199) at org.eclipse.egit.core.op.AddToIndexOperation.execute(AddToIndexOperation.java:78) at org.eclipse.egit.ui.internal.actions.AddToIndexActionHandler$1.run(AddToIndexActionHandler.java:56) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by: java.io.IOException: Cannot lock D:\workspace\eclipse\egit\egit\.git\index at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:193) at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:239) at org.eclipse.jgit.lib.Repository.lockDirCache(Repository.java:873) at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:136) ... 3 more org.eclipse.core.runtime.CoreException: Failed to add resource to index at org.eclipse.egit.core.op.AddToIndexOperation.execute(AddToIndexOperation.java:81) at org.eclipse.egit.ui.internal.actions.AddToIndexActionHandler$1.run(AddToIndexActionHandler.java:56) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by: org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of add command at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:199) at org.eclipse.egit.core.op.AddToIndexOperation.execute(AddToIndexOperation.java:78) ... 2 more Caused by: java.io.IOException: Cannot lock D:\workspace\eclipse\egit\egit\.git\index at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:193) at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:239) at org.eclipse.jgit.lib.Repository.lockDirCache(Repository.java:873) at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:136) ... 3 more
Worked fine when repeated after a while.
Just now I noticed that "git status" shows me a lot of changes (staged) for files I haven't touched. So far these are EOL diffs, but still it's a mess. Bumping severity.
Proposed a fix for missing unlock calls in finally blocks: http://egit.eclipse.org/r/4859 But I assume this is not the root cause of the problem. Currently the AddToIndexOperation provides the input resources as scheduling rule. This is wrong because this suggests that two Add To Index Jobs could run in parallel if the resources belong to the same Git repository. A better solution would be using a scheduling rule with all projects of the related Git repository. The scheduling rules of other EGit operations need to be checked, too.
merged http://egit.eclipse.org/r/4859 as 6b68574c5e3585620736b1a70ce92984c9f18cab
Fix proposed: http://egit.eclipse.org/r/4871 The fix avoids two add Jobs running in parallel.
(In reply to comment #5) > Fix proposed: http://egit.eclipse.org/r/4871 > > The fix avoids two add Jobs running in parallel. The fix avoids two add Jobs running in parallel if the Jobs are related to resources belonging to the same Git repository.
merged http://egit.eclipse.org/r/4871 as 99354e31eee9a6e73c394fc4a6be90b32956dec2
Marking as fixed, see comment 7. I haven't verified the fix though.