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 155517 Details for
Bug 299051
Clone of bug 296343
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]
Proposed fix + regression test for 3.4 maintenance
patch_299051.txt (text/plain), 4.37 KB, created by
Olivier Thomann
on 2010-01-07 12:02:37 EST
(
hide
)
Description:
Proposed fix + regression test for 3.4 maintenance
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2010-01-07 12:02:37 EST
Size:
4.37 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/internal/core/search/processing/JobManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java,v >retrieving revision 1.95 >diff -u -r1.95 JobManager.java >--- search/org/eclipse/jdt/internal/core/search/processing/JobManager.java 27 May 2008 23:46:43 -0000 1.95 >+++ search/org/eclipse/jdt/internal/core/search/processing/JobManager.java 7 Jan 2010 17:06:04 -0000 >@@ -317,6 +317,9 @@ > this.processingThread.setDaemon(true); > // less prioritary by default, priority is raised if clients are actively waiting on it > this.processingThread.setPriority(Thread.NORM_PRIORITY-1); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=296343 >+ // set the context loader to avoid leaking the current context loader >+ this.processingThread.setContextClassLoader(this.getClass().getClassLoader()); > this.processingThread.start(); > } > } >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java,v >retrieving revision 1.152.2.2 >diff -u -r1.152.2.2 JavaSearchBugsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 20 May 2009 15:21:23 -0000 1.152.2.2 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 7 Jan 2010 17:06:05 -0000 >@@ -22,6 +22,7 @@ > import org.eclipse.core.resources.IncrementalProjectBuilder; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.Path; > import org.eclipse.jdt.core.*; > import org.eclipse.jdt.core.compiler.CharOperation; >@@ -35,6 +36,7 @@ > import org.eclipse.jdt.internal.core.index.Index; > import org.eclipse.jdt.internal.core.search.AbstractSearchScope; > import org.eclipse.jdt.internal.core.search.indexing.IIndexConstants; >+import org.eclipse.jdt.internal.core.search.indexing.IndexRequest; > import org.eclipse.jdt.internal.core.search.matching.AndPattern; > import org.eclipse.jdt.internal.core.search.indexing.IndexManager; > import org.eclipse.jdt.internal.core.search.matching.MatchLocator; >@@ -10290,4 +10292,55 @@ > removeClasspathEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/b266582b.jar")); > } > } >+/** >+ * @bug 296343: OOM error caused by java indexing referencing classloader from threadLocal >+ * @test Ensure that indexing thread context class loader is not the application class loader >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=296343" >+ */ >+public void testBug296343() throws Exception { >+ simulateExit(); >+ class TestClassLoader extends ClassLoader { >+ TestClassLoader(ClassLoader parent) { >+ super(parent); >+ } >+ } >+ TestClassLoader tcl = new TestClassLoader(this.getClass().getClassLoader()); >+ ClassLoader cl = Thread.currentThread().getContextClassLoader(); >+ try { >+ // set the thread context class loader >+ Thread.currentThread().setContextClassLoader(tcl); >+ simulateRestart(); >+ >+ // get the indexing thread >+ class TestIndexRequest extends IndexRequest { >+ public Thread indexingThread = null; >+ public boolean executed = false; >+ public boolean execute(IProgressMonitor progressMonitor) { >+ this.indexingThread = Thread.currentThread(); >+ this.executed = true; >+ return true; >+ } >+ TestIndexRequest(Path containerPath, IndexManager indexManager) { >+ super(containerPath, indexManager); >+ } >+ } >+ IndexManager indexManager = JavaModelManager.getIndexManager(); >+ TestIndexRequest tir = new TestIndexRequest(new Path(""), indexManager ); >+ indexManager.request(tir); >+ int counter = 0; >+ // wait until the Index request gets executed >+ while (!tir.executed) { >+ try { >+ Thread.sleep(100); >+ } >+ catch (InterruptedException ie) { >+ // skip >+ } >+ assertTrue("Index request should have got executed within a 10s delay!", counter++ < 100); >+ } >+ assertFalse(tir.indexingThread.getContextClassLoader() == tcl); >+ } finally { >+ Thread.currentThread().setContextClassLoader(cl); >+ } >+} > } >\ No newline at end of file
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 299051
: 155517