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 155546 Details for
Bug 299053
Clone of bug 296343 (3.3.x)
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.3 maintenance
patch_299053.txt (text/plain), 4.62 KB, created by
Olivier Thomann
on 2010-01-07 15:40:29 EST
(
hide
)
Description:
Proposed fix + regression test for 3.3 maintenance
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2010-01-07 15:40:29 EST
Size:
4.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.107.2.5 >diff -u -r1.107.2.5 JavaSearchBugsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 17 Dec 2008 10:22:41 -0000 1.107.2.5 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 7 Jan 2010 20:41:06 -0000 >@@ -18,6 +18,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; >@@ -25,9 +26,12 @@ > > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.core.ClassFile; >+import org.eclipse.jdt.internal.core.JavaModelManager; > import org.eclipse.jdt.internal.core.SourceMethod; > 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.IndexManager; >+import org.eclipse.jdt.internal.core.search.indexing.IndexRequest; > import org.eclipse.jdt.internal.core.search.matching.MatchLocator; > import org.eclipse.jdt.internal.core.search.matching.PatternLocator; > import org.eclipse.jdt.internal.core.search.matching.TypeDeclarationPattern; >@@ -8146,5 +8150,55 @@ > search(method, REFERENCES); > assertSearchResults(""); > } >- >+/** >+ * @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.getJavaModelManager().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 >#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.91 >diff -u -r1.91 JobManager.java >--- search/org/eclipse/jdt/internal/core/search/processing/JobManager.java 2 Apr 2007 11:34:20 -0000 1.91 >+++ search/org/eclipse/jdt/internal/core/search/processing/JobManager.java 7 Jan 2010 20:41:10 -0000 >@@ -320,6 +320,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(); > } > }
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 299053
: 155546