Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Regression in AST construction from M6 to M7: race condition?

Update:
If I run the single test by itself, it works.
If I run the test in a Junit test file along with two others (it's the last one that runs), it still fails with the null ast and then the error in the stack dump below
(ClosedByInterrupException)
even when I undo my "trivial change" (and don't recalculate the ast the new way unless it was null the first time... which shouldn't have changed anything.)


...Beth

Beth Tibbitts
Eclipse Parallel Tools Platform http://eclipse.org/ptp
IBM STG Communications Protocols and Tools
Mailing Address: IBM Corp., Coldstream Research Campus, 745 West New Circle Road, Lexington, KY 40511

Inactive hide details for Beth Tibbitts---05/12/2010 05:39:14 PM---I am getting a weird error in a JUnit test I have. (Update: Beth Tibbitts---05/12/2010 05:39:14 PM---I am getting a weird error in a JUnit test I have. (Update: it's working now, but sounds like a race


From:

Beth Tibbitts/Watson/IBM@IBMUS

To:

"CDT General developers list." <cdt-dev@xxxxxxxxxxx>

Date:

05/12/2010 05:39 PM

Subject:

[cdt-dev] Regression in AST construction from M6 to M7: race condition?

Sent by:

cdt-dev-bounces@xxxxxxxxxxx




I am getting a weird error in a JUnit test I have.
(Update: it's working now, but sounds like a race condition, so I'm going to go ahead and post this. read on.)

It only seems to fail when the analysis test is running within the JUnit test case, not when running from my UI.
It worked fine with CDT M6. But not with M7.
I have tested with Eclipse 3.6 M7, and the same PTP code (our 4.0 M7) the only different is CDT M6 vs. M7.
Both M6 and M7 installed from cdt-master, not from CVS.

I'm trying to create an AST.
This code works for several other test cases.
But for this one (analyzing the file testMPIbarriersErr.c) the AST returned is null.
The file should compile just fine, the only "error" is a mismatched MPI barrier statement.

(I know this is deprecated CDT code.)
So for fun, when it returns a null AST I try to get the AST in what I believe is a more recommended way.

IASTTranslationUnit ast_ =
null;
try
 {
           ast_ =
CDOM.getInstance().getASTService().getTranslationUnit(file_,
                   
CDOM.getInstance().getCodeReaderFactory(CDOM.PARSE_SAVED_RESOURCES));
       }
catch (IASTServiceProvider.UnsupportedDialectException e) {
       }
       System.
out.println("     initial ast construction: ast_="+ast_);
       
boolean temp=true;
       
       
if(temp&& ast_==null) {
       
// newer way to get ast
       
if(file_ instanceof IAdaptable) {
       ICElement ce = (ICElement)
file_.getAdapter(ICElement.class);
       System.
out.println("     ICElement: ="+ce);
       
if(ce instanceof ITranslationUnit) {
       ITranslationUnit cetu=(ITranslationUnit)ce;
       IASTTranslationUnit ast;

try
 {
ast = cetu.getAST();
System.
out.println("ast: "+ast);
}
catch (CoreException e) {
//
TODO Auto-generated catch block
e.printStackTrace();
}
       
       }


For this one testcase I get the following:

    initial ast construction: ast_=null   ===> never returned null before M7
    ICElement: =testMPIbarriersErr.c


!ENTRY org.eclipse.cdt.core 4 0 2010-05-12 17:02:42.085
!MESSAGE Error
!STACK 0

java.nio.channels.ClosedByInterruptException

at java.nio.channels.spi.AbstractInterruptibleChannel.end(
AbstractInterruptibleChannel.java:184)
at sun.nio.ch.FileChannelImpl.size(
FileChannelImpl.java:315)
at org.eclipse.cdt.internal.core.parser.scanner.FileCharArray.create(
FileCharArray.java:40)
at org.eclipse.cdt.internal.core.parser.InternalParserUtil.createFileContent(
InternalParserUtil.java:201)
at org.eclipse.cdt.internal.core.parser.InternalParserUtil.createWorkspaceFileContent(
InternalParserUtil.java:147)
at org.eclipse.cdt.core.parser.FileContent.create(
FileContent.java:83)
at org.eclipse.cdt.core.parser.FileContent.create(
FileContent.java:67)
at org.eclipse.cdt.internal.core.model.TranslationUnit.getAST(
TranslationUnit.java:781)
at org.eclipse.cdt.internal.core.model.TranslationUnit.getAST(
TranslationUnit.java:766)
at org.eclipse.ptp.pldt.mpi.analysis.cdt.graphs.impl.ResourceCollector.run(
ResourceCollector.java:86)
     ......


Has the threading/concurrency changed somehow in M7?
Note the stack dump is running code that I only run (to get the AST a different way) if the original way gives me a null AST.

HEY I just tried it with a trivial change (to calculate the AST the second way no matter what) and it constructed the ast the first time
on my "error" file. Sounds like a race condition???

*NOW* my tests are running as expected. Even when I undid the trivial change.


...Beth

Beth Tibbitts
Eclipse Parallel Tools Platform
http://eclipse.org/ptp
IBM STG Communications Protocols and Tools
Mailing Address: IBM Corp., Coldstream Research Campus, 745 West New Circle Road, Lexington, KY 40511
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


GIF image

GIF image


Back to the top