Bug 107194 - weaving gives a bad file descriptor exception on resource reading
Summary: weaving gives a bad file descriptor exception on resource reading
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2.1   Edit
Hardware: Macintosh All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-17 07:01 EDT by Torsten Curdt CLA
Modified: 2005-08-18 05:52 EDT (History)
0 users

See Also:


Attachments
Builder.java (3.03 KB, text/plain)
2005-08-17 07:02 EDT, Torsten Curdt CLA
no flags Details
weaved Builder.class (8.25 KB, application/octet-stream)
2005-08-17 07:03 EDT, Torsten Curdt CLA
no flags Details
not-weaved Builder.class (4.22 KB, application/octet-stream)
2005-08-17 07:03 EDT, Torsten Curdt CLA
no flags Details
aspect (1.64 KB, text/plain)
2005-08-18 04:02 EDT, Torsten Curdt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Torsten Curdt CLA 2005-08-17 07:01:03 EDT
We are running junit testcases through maven1.

The Builder class startes up the Avalon Fortress
container. Once that is weaved we get a java.io.IOException
when trying to read the configuration file via
ClassLoader.getResourceAsStream.

Removing the pointcut on that very class seems solve the
problem. Though it's not really understanable why.

Attached you find

 o weaved Builder.class
 o non-weaved Builder.class
 o source code Builder.java

and here is the stacktrace

java.io.IOException: Bad file descriptor
        at java.io.FileInputStream.read(Native Method)
        at
org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown
Source)
        at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at
org.apache.avalon.framework.configuration.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:254)
        at
org.apache.avalon.framework.configuration.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:202)
        at container.Builder.createContainer_aroundBody0(Builder.java:28)
        at container.Builder.createContainer_aroundBody1$advice(Builder.java:191)
        at container.Builder.createContainer(Builder.java)
        at
com.managesoft.distribution.AbstractComponentTestCase.setUpContainer(AbstractComponentTestCase.java:80)
        at
com.managesoft.distribution.AbstractComponentTestCase.setUp(AbstractComponentTestCase.java:128)
        at junit.framework.TestCase.runBare(TestCase.java:125)
Comment 1 Torsten Curdt CLA 2005-08-17 07:02:08 EDT
Created attachment 26187 [details]
Builder.java
Comment 2 Torsten Curdt CLA 2005-08-17 07:03:02 EDT
Created attachment 26188 [details]
weaved Builder.class
Comment 3 Torsten Curdt CLA 2005-08-17 07:03:39 EDT
Created attachment 26189 [details]
not-weaved Builder.class
Comment 4 Wes Isberg CLA 2005-08-17 23:45:26 EDT
Thanks for reporting this bug, but I'm not sure I understand why this is a bug
with AspectJ.  I assume that without the pointcut (i.e., without the around
advice) the file-load is not attempted (and that functionality is lost), so it
makes sense that it wouldn't tickle this problem.  There's an aspect (not
provided in source?) which uses around advice to build something, and somewhere
in the bowels the file descriptor is bad.  I don't know from this where the file
descriptor comes from, etc.  It sounds like the aspect and the woven class is
loading correctly, so the the AspectJ runtime classes are available.  One option
is to enable or disable around advice inlining and see if that makes a
difference.   Could you isolate this a bit more?  

Also, if anything it's a compiler bug.
Comment 5 Torsten Curdt CLA 2005-08-18 04:02:22 EDT
Created attachment 26221 [details]
aspect
Comment 6 Torsten Curdt CLA 2005-08-18 04:14:03 EDT
Sorry for not being clear.

The file load is always being attempted but only without the aspect it succeeds.
With the aspect I get the exeception. For now I am using the commented out
"within" expression so there are no pointcuts for that very class to make it
work in my app. (In all the other classes the aspect seems to work just fine!)
But to me this sounds really strange and I would like to track that down. (It's
just the container startup!?)

Just tell me what information you need.
Comment 7 Adrian Colyer CLA 2005-08-18 05:52:51 EDT
Wes, this bug report came out of a discussion on the users list that you might
have missed whilst you were out. The aspect was a simple (harmless looking)
logging aspect, and adding !within(Builder) to the pointcuts in it stopped this
bug from happening. Although I can't imagine how at the moment, it seems highly
probably that something the weaver has done is causing this problem.