Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 152085 Details for
Bug 294894
Workspace lock not released leading to deadlock
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Test 1 patch
bug294894-test.patch (text/plain), 4.98 KB, created by
James Blackburn
on 2009-11-12 13:26:32 EST
(
hide
)
Description:
Test 1 patch
Filename:
MIME Type:
Creator:
James Blackburn
Created:
2009-11-12 13:26:32 EST
Size:
4.98 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.tests.resources >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.resources/META-INF/MANIFEST.MF,v >retrieving revision 1.10 >diff -u -r1.10 MANIFEST.MF >--- META-INF/MANIFEST.MF 5 Oct 2009 11:43:16 -0000 1.10 >+++ META-INF/MANIFEST.MF 12 Nov 2009 18:22:45 -0000 >@@ -30,6 +30,7 @@ > org.eclipse.test.performance;resolution:=optional, > org.eclipse.core.filesystem, > org.eclipse.core.runtime, >- org.eclipse.core.expressions >+ org.eclipse.core.expressions, >+ org.eclipse.ui > Eclipse-AutoStart: true > Bundle-Activator: org.eclipse.core.tests.internal.resources.TestActivator >Index: src/org/eclipse/core/tests/resources/regression/Bug_294894.java >=================================================================== >RCS file: src/org/eclipse/core/tests/resources/regression/Bug_294894.java >diff -N src/org/eclipse/core/tests/resources/regression/Bug_294894.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/tests/resources/regression/Bug_294894.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,135 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 Broadcom Coporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * James Blackburn (Broadcom Corp.) - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.core.tests.resources.regression; >+ >+import java.io.*; >+import org.eclipse.core.resources.*; >+import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.jobs.Job; >+import org.eclipse.core.tests.resources.ResourceTest; >+import org.eclipse.swt.widgets.Display; >+ >+/** >+ * Testsuite for resources plugin lock-up >+ */ >+public class Bug_294894 extends ResourceTest { >+ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ } >+ >+ protected void tearDown() throws Exception { >+ super.tearDown(); >+ } >+ >+ public void testDeadLockFail() throws Exception { >+ final String proj = "testProject"; >+ >+ final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(proj); >+ create(project, true); >+ >+ final IFile file = project.getFile("foo"); >+ project.getFile("foo").create(new ByteArrayInputStream(new byte[] {'a'}), true, null); >+ >+ for (int i = 0; i < 1000; i++) { >+ System.out.println(i); >+ // Run this in a job holding the appropriate scheduling rule >+ Job j = new Job("jobwithfilelock") { >+ >+ protected IStatus run(IProgressMonitor monitor) { >+ >+ // Job to deadlock with this: Display -> Resource Lock >+ Job j = new Job("Workspace refresh") { >+ protected IStatus run(IProgressMonitor monitor) { >+ Display.getDefault().syncExec(new Runnable() { >+ public void run() { >+ try { >+ appendContentsWithException(project); >+ ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null); >+ } catch (Exception e) { >+ fail(); >+ } >+ } >+ }); >+ return Status.OK_STATUS; >+ } >+ }; >+ >+ j.schedule(); >+ try { >+ Thread.sleep(1); >+ } catch (Exception e) { >+ fail(); >+ } >+ >+ // Grab Display and refresh the file... [Resource -> Display ] >+ Display.getDefault().syncExec(new Runnable() { >+ public void run() { >+ try { >+ file.refreshLocal(IResource.DEPTH_ONE, null); >+ } catch (Exception e) { >+ fail(); >+ } >+ } >+ }); >+ return Status.OK_STATUS; >+ } >+ }; >+ j.setRule(file); >+ j.schedule(); >+ j.join(); >+ >+ // Now try to append to the file >+ file.appendContents(new ByteArrayInputStream(new byte[] {'a'}), IResource.FORCE, null); >+ } >+ } >+ >+ public InputStream getContents(String text) { >+ return new ByteArrayInputStream(text.getBytes()); >+ } >+ >+ public void appendContentsWithException(IProject project) { >+ int count = 5; >+ final IFile targets[] = new IFile[count]; >+ for (int i = 0; i < count; i++) >+ targets[i] = project.getFile("file" + i); >+ try { >+ for (int i = 0; i < count; i++) >+ if (!targets[i].exists()) >+ targets[i].create(getContents("abc"), false, null); >+ } catch (CoreException e) { >+ fail("1.0"); >+ } >+ >+ // Run [count] failing append content jobs >+ Job[] js = new Job[count]; >+ for (int i = 0; i < count; i++) { >+ final int j = i; >+ js[i] = new Job("bad append") { >+ protected IStatus run(IProgressMonitor monitor) { >+ try { >+ targets[j].appendContents(new InputStream() { >+ public int read() throws IOException { >+ throw new IOException("Stream closed"); >+ } >+ }, false, false, null); >+ } catch (CoreException e) { >+ fail("2.0"); >+ } >+ return Status.OK_STATUS; >+ } >+ }; >+ js[i].schedule(); >+ } >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 294894
:
151953
|
151954
|
152020
|
152022
|
152031
|
152084
|
152085
|
163428
|
163433
|
163463