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

Bug 315024

Summary: fix dead lock when credentials are retrieved from secure store
Product: z_Archived Reporter: Steffen Pingel <steffen.pingel>
Component: MylynAssignee: Steffen Pingel <steffen.pingel>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P2 CC: robert.elves, steffen.pingel, wseliga
Version: unspecified   
Target Milestone: 3.4   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
retrieve username without opening secure store
none
mylyn/context/zip
none
removed locking when accessing secure store and legacy fall back
none
mylyn/context/zip none

Description Steffen Pingel CLA 2010-05-31 00:40:38 EDT
If a task repository opens the secure store on a non-UI thread while task repository credentials are accessed concurrently on the UI thread a dead lock can occur:

"Worker-0" prio=10 tid=0x00000000416d3800 nid=0x7da1 in Object.wait() 0x00007f5256bf1000
java.lang.Thread.State: TIMED_WAITING (on object monitor)

	at java.lang.Object.wait(Native Method)

- waiting on <0x00007f52982597a0> (a org.eclipse.ui.internal.Semaphore)

	at org.eclipse.ui.internal.Semaphore.acquire(Semaphore.java:43)

- locked <0x00007f52982597a0> (a org.eclipse.ui.internal.Semaphore)

	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:168)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4113)
	at org.eclipse.equinox.internal.security.ui.storage.DefaultPasswordProvider.getPassword(DefaultPasswordProvider.java:47)
	at org.eclipse.equinox.internal.security.storage.PasswordProviderModuleExt.getPassword(PasswordProviderModuleExt.java:35)
	at org.eclipse.equinox.internal.security.storage.SecurePreferencesRoot.getModulePassword(SecurePreferencesRoot.java:254)
	at org.eclipse.equinox.internal.security.storage.SecurePreferencesRoot.getPassword(SecurePreferencesRoot.java:219)
	at org.eclipse.equinox.internal.security.storage.SecurePreferences.put(SecurePreferences.java:224)
	at org.eclipse.equinox.internal.security.storage.SecurePreferencesWrapper.put(SecurePreferencesWrapper.java:110)
	at org.eclipse.mylyn.tasks.core.TaskRepository.addAuthInfo(TaskRepository.java:258)

- locked <0x00007f527a6857a8> (a java.lang.Object)

	at org.eclipse.mylyn.tasks.core.TaskRepository.setCredentials(TaskRepository.java:763)

- locked <0x00007f527b0c47a0> (a org.eclipse.mylyn.tasks.core.TaskRepository)

	at com.atlassian.connector.eclipse.internal.jira.ui.MigrateToSecureStorageJob.migrateToSecureStorage(MigrateToSecureStorageJob.java:62)
	at com.atlassian.connector.eclipse.internal.jira.ui.MigrateToSecureStorageJob.run(MigrateToSecureStorageJob.java:45)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

"main" prio=10 tid=0x0000000040f5e800 nid=0x7d87 waiting for monitor entry 0x00007f52a6c75000
java.lang.Thread.State: BLOCKED (on object monitor)

	at org.eclipse.mylyn.tasks.core.TaskRepository.getAuthInfo(TaskRepository.java:394)

- waiting to lock <0x00007f527a6857a8> (a java.lang.Object)

	at org.eclipse.mylyn.tasks.core.TaskRepository.getCredentials(TaskRepository.java:513)

- locked <0x00007f527b0af498> (a org.eclipse.mylyn.tasks.core.TaskRepository)

	at org.eclipse.mylyn.tasks.core.TaskRepository.getUserName(TaskRepository.java:653)
	at org.eclipse.mylyn.tasks.core.TaskRepository.getUserName(TaskRepository.java:643)
	at com.tasktop.resources.ui.TasktopResourcesUiPlugin$5.run(TasktopResourcesUiPlugin.java:281)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)

- locked <0x00007f529b8ff020> (a org.eclipse.swt.widgets.RunnableLock)

	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3468)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3115)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
	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:368)
	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: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:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Comment 1 Wojciech Seliga CLA 2010-06-01 05:04:37 EDT
Steffen,

Is there a chance it's fixed for Mylyn 3.4 (and Helios release)?
It's quite urgent for us, as otherwise we would need to asap revert all changes we made to keep passwords secure of our connectors.

Cheers,
Wojtek
Comment 2 Steffen Pingel CLA 2010-06-01 17:00:33 EDT
Created attachment 170706 [details]
retrieve username without opening secure store
Comment 3 Steffen Pingel CLA 2010-06-01 17:00:36 EDT
Created attachment 170707 [details]
mylyn/context/zip
Comment 4 Steffen Pingel CLA 2010-06-01 17:15:13 EDT
Created attachment 170710 [details]
removed locking when accessing secure store and legacy fall back
Comment 5 Steffen Pingel CLA 2010-06-01 17:15:17 EDT
Created attachment 170711 [details]
mylyn/context/zip
Comment 6 Steffen Pingel CLA 2010-06-01 17:28:44 EDT
I have committed the patches which should fix the dead lock and password prompting on startup. Wojtek, please let me know in case anything else need to be done here.
Comment 7 Wojciech Seliga CLA 2010-06-02 15:40:03 EDT
Thanks Steffen!

I hope it will suffice.
Now I am dogfooding Mylyn from trunk every day (with our securely stored passwords), so in case there some other problems or changes required, I'll report them immediately.