Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365449

Summary: Create a new branch fails in Git Repo view
Product: [Technology] EGit Reporter: Paul Webster <pwebster>
Component: UIAssignee: Project Inbox <egit.ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: jens.baumgart, matthias.sohn, remy.suen, stephan.leichtvogt
Version: 1.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Paul Webster CLA 2011-12-02 10:25:25 EST
Using   Eclipse EGit	1.2.0.201112010521

I was in the Git Repo view and right-clicked on eclipse.platform.ui>Branches>Remote Tracking>origin/master.

I selected "Create Branch" and filled in my local branch, pwebster/bugMenuTests.  When I clicked OK, I got the exception at the end of the report.

But I checked:  .git/config exists, is writable, and contains correct new entries for the branch that was just created:
[branch "pwebster/bugMenuTests"]
        remote = origin
        merge = refs/heads/master
        rebase = true


I also can no longer switch branches from EGit to a regular branch, I get 

Caused by: java.io.IOException: Cannot lock /opt/pwebster/git/R42/eclipse.platform.ui/.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.CheckoutCommand.call(CheckoutCommand.java:160)


Original Exception:
After the original create, I got the exception below, and the repo did not switch from master.  

eclipse.buildId=I20111201-2015
java.fullversion=JRE 1.6.0 IBM J9 2.4 Linux amd64-64 jvmxa6460sr9-20101124_69295 (JIT enabled, AOT enabled)
J9VM - 20101124_069295
JIT  - r9_20101028_17488ifx2
GC   - 20101027_AA
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -os linux -ws gtk -arch x86_64 -data /opt/pwebster/workspaces/build42x/

Error
Fri Dec 02 10:15:22 EST 2011
Branch could not be created

java.lang.RuntimeException: java.io.IOException: Cannot read file /opt/pwebster/git/R42/eclipse.platform.ui/.git/config
	at org.eclipse.jgit.storage.file.FileRepository.getConfig(FileRepository.java:330)
	at org.eclipse.jgit.storage.file.FileRepository.getConfig(FileRepository.java:98)
	at org.eclipse.jgit.treewalk.FileTreeIterator.<init>(FileTreeIterator.java:87)
	at org.eclipse.jgit.dircache.DirCacheCheckout.<init>(DirCacheCheckout.java:182)
	at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:160)
	at org.eclipse.egit.core.op.BranchOperation$1.run(BranchOperation.java:84)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2326)
	at org.eclipse.egit.core.op.BranchOperation.execute(BranchOperation.java:103)
	at org.eclipse.egit.ui.internal.branch.BranchOperationUI.run(BranchOperationUI.java:221)
	at org.eclipse.egit.ui.internal.repository.CreateBranchPage.createBranch(CreateBranchPage.java:422)
	at org.eclipse.egit.ui.internal.repository.CreateBranchWizard$1.run(CreateBranchWizard.java:93)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
	at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1029)
	at org.eclipse.egit.ui.internal.repository.CreateBranchWizard.performFinish(CreateBranchWizard.java:87)
	at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:827)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:432)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.egit.ui.internal.repository.tree.command.CreateBranchCommand.execute(CreateBranchCommand.java:94)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:68)
	at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:228)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:209)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:122)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:161)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:717)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:622)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$6(HandledContributionItem.java:606)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$3.handleEvent(HandledContributionItem.java:565)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:977)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:893)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:91)
	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:565)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:520)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:352)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:624)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:579)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1433)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1409)
Caused by: java.io.IOException: Cannot read file /opt/pwebster/git/R42/eclipse.platform.ui/.git/config
	at org.eclipse.jgit.storage.file.FileBasedConfig.load(FileBasedConfig.java:151)
	at org.eclipse.jgit.storage.file.FileRepository.loadRepoConfig(FileRepository.java:224)
	at org.eclipse.jgit.storage.file.FileRepository.getConfig(FileRepository.java:328)
	... 66 more
Caused by: java.nio.channels.ClosedByInterruptException
	at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202)
	at sun.nio.ch.FileChannelImpl.size(FileChannelImpl.java:325)
	at org.eclipse.jgit.util.IO.readFully(IO.java:140)
	at org.eclipse.jgit.util.IO.readFully(IO.java:78)
	at org.eclipse.jgit.storage.file.FileBasedConfig.load(FileBasedConfig.java:135)
	... 68 more
Comment 1 Paul Webster CLA 2011-12-02 10:30:06 EST
from the command line I got:
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.


Removing the index.lock allowed me to checkout branches once more.

PW
Comment 2 Matthias Sohn CLA 2011-12-06 19:16:35 EST
(In reply to comment #1)
> from the command line I got:
> If no other git process is currently running, this probably means a
> git process crashed in this repository earlier. Make sure no other git
> process is running and remove the file manually to continue.
> 
> 
> Removing the index.lock allowed me to checkout branches once more.
> 
> PW

True, when you can't lock the index this usually means another git session 
crashed earlier so that it wasn't able to cleanup the index.lock file used 
to lock the index. 

Also see bug 360141.
Comment 3 Jens Baumgart CLA 2011-12-21 11:01:36 EST
Fix proposed for the secondary problem: index is locked after failed branch action

http://egit.eclipse.org/r/4869
Comment 4 Stephan Leicht Vogt CLA 2012-09-06 08:47:40 EDT
(In reply to comment #3)
> Fix proposed for the secondary problem: index is locked after failed branch
> action
> 
> http://egit.eclipse.org/r/4869

This Fix is merged but this bugzilla is still in NEW state. Is this just in this bug the case or are there more bugs open which are fixed in reality?
Comment 5 Matthias Sohn CLA 2012-12-06 19:09:19 EST
this fix was merged as 0a84ad2d2ac8153d06564895279ab4fd11ef0e80 in April 2012