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

Bug 385421

Summary: Mylyn doesn't remember credentials for Bugzilla (AuthorizationDatabase.save fails on Windows PC)
Product: z_Archived Reporter: Tobias Oberlies <t-oberlies>
Component: MylynAssignee: Mylyn Inbox <mylyn-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: Jesse.Weinstein, lmcbout, mark, matthias.schmalz, sascha.scholz
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Tobias Oberlies CLA 2012-07-18 12:07:21 EDT
I am using the Secure Storage protected by the Windows logon. When trying to save my Bugzilla credentials with Mylyn, the credentials are not stored, and I get a variable (2-4) number of error log entries, all with the following root cause:

Caused by: java.io.IOException: Access is denied
	at java.io.WinNTFileSystem.createFileExclusively(Native Method)
	at java.io.File.createNewFile(File.java:883)
	at org.eclipse.core.internal.runtime.auth.AuthorizationDatabase.save(AuthorizationDatabase.java:323)

My first guess for the failure is that this is a timing issue: createNewFile() could be failing because that call may overtake the preceding delete() call on the same file name. When I change the timing, e.g. through debugging the method, it consistently succeeds. Timing problems would also this would explain the variable number of errors. 

One of the full log entries is:
!ENTRY org.eclipse.mylyn.tasks.core 4 0 2012-07-18 13:00:59.407
!MESSAGE Could not set authorization credentials
!STACK 1
org.eclipse.core.runtime.CoreException: Unable to write to authorization database: C:\Env\Eclipse\Installation\juno\configuration\org.eclipse.core.runtime\.keyring.
	at org.eclipse.core.internal.runtime.auth.AuthorizationDatabase.save(AuthorizationDatabase.java:331)
	at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.core.internal.runtime.AuthorizationHandler.saveKeyring(AuthorizationHandler.java:135)
	at org.eclipse.core.internal.runtime.AuthorizationHandler.addAuthorizationInfo(AuthorizationHandler.java:178)
	at org.eclipse.core.runtime.Platform.addAuthorizationInfo(Platform.java:482)
	at org.eclipse.mylyn.tasks.core.TaskRepository.addAuthInfo(TaskRepository.java:279)
	at org.eclipse.mylyn.tasks.core.TaskRepository.setCredentials(TaskRepository.java:751)
	at org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.applyTo(AbstractRepositorySettingsPage.java:1679)
	at org.eclipse.mylyn.internal.bugzilla.ui.tasklist.BugzillaRepositorySettingsPage.applyToInternal(BugzillaRepositorySettingsPage.java:700)
	at org.eclipse.mylyn.internal.bugzilla.ui.tasklist.BugzillaRepositorySettingsPage.applyTo(BugzillaRepositorySettingsPage.java:559)
	at org.eclipse.mylyn.tasks.ui.wizards.AbstractTaskRepositoryPage.performFinish(AbstractTaskRepositoryPage.java:287)
	at org.eclipse.mylyn.internal.tasks.ui.wizards.EditRepositoryWizard.performFinish(EditRepositoryWizard.java:81)
	at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:827)
	at org.eclipse.mylyn.commons.ui.dialogs.EnhancedWizardDialog.finishPressed(EnhancedWizardDialog.java:111)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:432)
	at org.eclipse.mylyn.commons.ui.dialogs.EnhancedWizardDialog.buttonPressed(EnhancedWizardDialog.java:99)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.mylyn.tasks.ui.TasksUiUtil.openEditRepositoryWizard(TasksUiUtil.java:206)
	at org.eclipse.mylyn.internal.tasks.ui.commands.OpenTaskRepositoryPropertiesHandler.execute(OpenTaskRepositoryPropertiesHandler.java:33)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:76)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:229)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:210)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:851)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:744)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:728)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:667)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1022)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:916)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:585)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:540)
	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:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
Caused by: java.io.IOException: Access is denied
	at java.io.WinNTFileSystem.createFileExclusively(Native Method)
	at java.io.File.createNewFile(File.java:883)
	at org.eclipse.core.internal.runtime.auth.AuthorizationDatabase.save(AuthorizationDatabase.java:323)
	... 67 more
Comment 1 Tobias Oberlies CLA 2012-07-18 12:09:54 EDT
Forgot to mention: I tried both an Oracle jdk1.6.0_30 VM and an Oracle jdk1.7.0_05 VM, and the symptoms are the same.
Comment 2 John Arthorne CLA 2012-07-23 15:41:27 EDT
What version of Eclipse is this? Bug says 4.2 but AuthorizationDatabase no longer exists in Eclipse 4.2. This is not Equinox secure storage but rather than Eclipse 1.0 keyring mechanism that was deprecated long ago.
Comment 3 Tobias Oberlies CLA 2012-07-25 10:01:48 EDT
I have installed the Eclipse SDK (org.eclipse.sdk.ide) in version 4.2.0.I20120608-1400. Maybe the deprecated mechanism is pulled in by a different feature, possibly the Mylyn Bugzilla Connector (org.eclipse.mylyn.bugzilla_feature.feature.group/3.8.0.v20120612-0600).
Comment 4 Tobias Oberlies CLA 2012-07-25 10:07:43 EDT
Mylyn was a good guess: org.eclipse.mylyn.tasks.core/3.8.0.v20120612-0600 has a Require-Bundle: org.eclipse.core.runtime.compatibility.auth;resolution:=optional;x-installation:=greedy

This also matches the observation that the error happens when configuring a Bugzilla task repository. Should this bug be moved over to Mylyn with the request to remove the dependency on the broken&deprecated implementation?
Comment 5 John Arthorne CLA 2012-07-25 11:34:08 EDT
(In reply to comment #4)
> This also matches the observation that the error happens when configuring a
> Bugzilla task repository. Should this bug be moved over to Mylyn with the
> request to remove the dependency on the broken&deprecated implementation?

Yes. Here is the related Juno migration guide entry:

http://help.eclipse.org/juno/topic/org.eclipse.platform.doc.isv/porting/4.2/incompatibilities.html?cp=2_3_0_2#runtime-auth
Comment 6 Steffen Pingel CLA 2012-08-13 12:32:19 EDT
Tobias, is C:\Env\Eclipse\Installation\juno\configuration\org.eclipse.core.runtime\.keyring writeable to the user that is running Eclipse?
Comment 7 Sascha Scholz CLA 2012-08-13 14:29:38 EDT
I have seen the issue on two PCs now, with and without SSD. It has always been a general Mylyn issue for me, not related to one task repository.

I remember vaguely, that it was gone when I switched back from a 64bit to a 32bit JVM. But I'll have to verify this.
Comment 8 Tobias Oberlies CLA 2012-08-14 04:32:06 EDT
(In reply to comment #6)
> Tobias, is
> C:\Env\Eclipse\Installation\juno\configuration\org.eclipse.core.runtime\.keyring
> writeable to the user that is running Eclipse?
Yes, it is. I checked the permissions, and they look normal. eclipse.exe is running as my user, and that user has full control in the file system.
Comment 9 Jesse Weinstein CLA 2012-09-13 19:50:22 EDT
I see this bug with 

eclipse.buildId=M20120208-0800
java.version=1.7.0_07
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.cpp.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.cpp.product

It happens with two versions of Mylyn: 3.8.1.v20120725-0100 and 3.6.5.v20120215-0100 .

Assuming it's related to 
org.eclipse.core.runtime.compatibility.auth (3.2.200.v20110110) "Authorization Compatibility Plug-in" [Active]

that's its version.
Comment 10 Steffen Pingel CLA 2012-09-21 17:32:18 EDT
*** Bug 390123 has been marked as a duplicate of this bug. ***
Comment 11 Tobias Oberlies CLA 2012-09-25 08:04:40 EDT
Darn, my Eclipse password expired, and now I'm getting hit by this again.

To make sure I don't forget this myself, I am posting here how to work around this:
* Start the main workspace in debug mode: eclipse -vmargs -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
* Start a second workspace
* Import org.eclipse.core.runtime.compatibility.auth in that workspace and place a method breakpoint at the entry of AuthorizationDatabase.save
* Launch a "Remote Java Application" debugging session
* In the main workspace, update the credentials of the Eclipse Bugzilla task repository
* In the debug workspace, step through the save method, resume on the last line of the method (four times)
Done!
Comment 12 Mark Van Alstyne CLA 2013-04-03 16:27:16 EDT
I see the error with:

eclipse.buildId=4.3.0.I20130314-1330
java.version=1.6.0_23
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64
Mylyn Tasks	3.9.0.I20130319-0842	

org.eclipse.core.runtime.CoreException: Unable to write to authorization database: C:\Users\mdvanals\Documents\eclipse-SDK-4.3M6-win32-x86_64\eclipse\configuration\org.eclipse.core.runtime\.keyring.
	at org.eclipse.core.internal.runtime.auth.AuthorizationDatabase.save(AuthorizationDatabase.java:331)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)


Caused by: java.io.IOException: Access is denied
	at java.io.WinNTFileSystem.createFileExclusively(Native Method)
	at java.io.File.createNewFile(Unknown Source)
	at org.eclipse.core.internal.runtime.auth.AuthorizationDatabase.save(AuthorizationDatabase.java:323)
Comment 13 Tobias Oberlies CLA 2013-08-09 10:04:51 EDT
Updated title so that I find the bug faster next time I run into this problem again. Today, it took me a while to find it.
Comment 14 Leo Dos Santos CLA 2014-05-02 19:16:36 EDT
Mylyn 3.11 has been updated to use the Equinox secure storage. The Eclipse keyring is no longer supported in Mylyn, so this specific issue won't be fixed.
Comment 15 Tobias Oberlies CLA 2014-05-05 05:13:23 EDT
(In reply to comment #14)
> Mylyn 3.11 has been updated to use the Equinox secure storage.
As of comment #5, this is exactly what was needed to fix this issue. So IMHO this bug should be marked as FIXED.
Comment 16 Sam Davis CLA 2014-05-05 13:54:22 EDT

*** This bug has been marked as a duplicate of bug 393722 ***