Re: Large webapps in 7.0.29 and Annotation Scanning not respecting metadata-complete

2012-08-02 Thread Mark Thomas
Andreas Pålsson wpt2...@hotmail.com wrote:

I have been thinking about this issue all day, and I think the
specification needs more work on this area.


There is certainly no need for a container to wade through hundreds
maybe even thousands of classes in search of something that does not
exist.
It is an unnecessary task which consumes both time and resources.


I am all for making it easier for a developer, and make the container
scan everything by default.

But there is also an obvious need for a solution to specifically define
where a container should look for annotations when we have web
applications with very large amount of classes.

Even if it has to be an XML-file, such as in Spring where you can
instruct  the framework where to look for beans, entities, controllers
and such.


Mark, is there a way we can influence the EG to change this?

Thanks.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

The bad news is that this is a 3.0 feature so we are way past being able to 
influence it. Personally I dislike most of the 3.0 pluggability featutes.

If you have ideas how to improve things then the EG lists Rainer pointed you to 
is the place to take them.

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Large webapps in 7.0.29 and Annotation Scanning not respecting metadata-complete

2012-08-01 Thread Mark Thomas
On 01/08/2012 02:53, andreas palsson wrote:
 
 Good morning.
 
 After upgrading to 7.0.29, one of my larger webapps could no longer be 
 deployed due to OutOfMemoryError.
 As far as I know, this is related to the new feature of annotation scanning 
 which was enabled in v7.0.29 (see the stack trace below).
 
 Have anyone else experienced the same issue?

There are multiple issues going on here. There have been reported
previously and are understood. I'll try and explain the full story.

The servlet spec requires (and the expert group (EG) confirmed) that
Tomcat always scans for ServletContainerInitializers (SCIs), even if
metadata-complete is true. Tomcat was changed to do this in 7.0.29.

SCIs can have @HandlesTypes annotations. If one is present, Tomcat must
scan every class and its hierarchy looking for matches to the
HandlesTypes. Tomcat caches the results of this scan to speed up
processing so it doesn't repeatedly scan the same classes. If A  B both
inherit from C, when Tomcat scans A it also scans C and caches the
result so it doesn't have to scan C again when checking B. Tomcat was
caching more than it needed to making the cache excessively large. This
is bug 53535 which has already been fixed and will be in 7.0.30 onwards.

This then raises the question of how to turn of scanning for classes
that match HandlesTypes. While the spec says that JARs excluded using an
absolute-ordering are not scanned for matches to HandlesTypes it was
unclear what is meant to happen when metadata-complete is true since
ordering is ignored in that case.

The EG has recently clarified this and stated that JARs excluded using
an absolute-ordering are not scanned for matches to HandlesTypes
regardless of the setting of metadata-complete. The discussion is not
yet complete and we are waiting for it to conclude and before
implementing the results of that discussion in 7.0.30.

Mark


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Large webapps in 7.0.29 and Annotation Scanning not respecting metadata-complete

2012-08-01 Thread andreas palsson

Thank you Mark for explaining this.
I'll see if I can get my hands on a 7.0.30 and see how it works out.
 
One thing though, would it be possible to allow Tomcat to _only_ scan for SCI's 
in WEB-INF/classes and exclude WEB-INF/lib (even for parent classes inherited 
in the former)?
It would be great to have some control over the SCI's as some could be located 
in any of the dependencies I have added to the application.

// andreas 

 
 

 Date: Wed, 1 Aug 2012 08:51:04 +0100
 From: ma...@apache.org
 To: users@tomcat.apache.org
 Subject: Re: Large webapps in 7.0.29 and Annotation Scanning not respecting 
 metadata-complete
 
 There are multiple issues going on here. There have been reported
 previously and are understood. I'll try and explain the full story.
 
[...]
 
 Mark
 
  

Re: Large webapps in 7.0.29 and Annotation Scanning not respecting metadata-complete

2012-08-01 Thread Mark Thomas
On 01/08/2012 09:35, andreas palsson wrote:
 
 Thank you Mark for explaining this. I'll see if I can get my hands on
 a 7.0.30 and see how it works out.

You'll need to wait until all the issues have been fixed and then build
from trunk. Keep an eye on the dev list.

 One thing though, would it be possible to allow Tomcat to _only_ scan
 for SCI's in WEB-INF/classes and exclude WEB-INF/lib (even for parent
 classes inherited in the former)? It would be great to have some
 control over the SCI's as some could be located in any of the
 dependencies I have added to the application.

No. You can exclude SCIs in JARs through absolute ordering but you can't
stop Tomcat scanning WEB-INF/classes for matching types.

Mark

 
 // andreas
 
 
 
 
 Date: Wed, 1 Aug 2012 08:51:04 +0100 From: ma...@apache.org To:
 users@tomcat.apache.org Subject: Re: Large webapps in 7.0.29 and
 Annotation Scanning not respecting metadata-complete
 
 There are multiple issues going on here. There have been reported 
 previously and are understood. I'll try and explain the full
 story.
 
 [...]
 
 Mark
 
 
 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Large webapps in 7.0.29 and Annotation Scanning not respecting metadata-complete

2012-08-01 Thread Rainer Jung

On 01.08.2012 09:51, Mark Thomas wrote:

On 01/08/2012 02:53, andreas palsson wrote:


Good morning.

After upgrading to 7.0.29, one of my larger webapps could no longer be deployed due to 
OutOfMemoryError.
As far as I know, this is related to the new feature of annotation scanning 
which was enabled in v7.0.29 (see the stack trace below).

Have anyone else experienced the same issue?


There are multiple issues going on here. There have been reported
previously and are understood. I'll try and explain the full story.

The servlet spec requires (and the expert group (EG) confirmed) that
Tomcat always scans for ServletContainerInitializers (SCIs), even if
metadata-complete is true. Tomcat was changed to do this in 7.0.29.

SCIs can have @HandlesTypes annotations. If one is present, Tomcat must
scan every class and its hierarchy looking for matches to the
HandlesTypes. Tomcat caches the results of this scan to speed up
processing so it doesn't repeatedly scan the same classes. If A  B both
inherit from C, when Tomcat scans A it also scans C and caches the
result so it doesn't have to scan C again when checking B. Tomcat was
caching more than it needed to making the cache excessively large. This
is bug 53535 which has already been fixed and will be in 7.0.30 onwards.

This then raises the question of how to turn of scanning for classes
that match HandlesTypes. While the spec says that JARs excluded using an
absolute-ordering are not scanned for matches to HandlesTypes it was
unclear what is meant to happen when metadata-complete is true since
ordering is ignored in that case.

The EG has recently clarified this and stated that JARs excluded using
an absolute-ordering are not scanned for matches to HandlesTypes
regardless of the setting of metadata-complete. The discussion is not
yet complete and we are waiting for it to conclude and before
implementing the results of that discussion in 7.0.30.


Would *.jar in jarsToSkip (catalina.properties) be a workaround, or is 
that skip list also ignored for SCI / @HandlesTypes processing?


Regards,

Rainer


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Large webapps in 7.0.29 and Annotation Scanning not respecting metadata-complete

2012-08-01 Thread Andreas Pålsson
I have been thinking about this issue all day, and I think the
specification needs more work on this area.


There is certainly no need for a container to wade through hundreds
maybe even thousands of classes in search of something that does not exist.
It is an unnecessary task which consumes both time and resources.


I am all for making it easier for a developer, and make the container
scan everything by default.

But there is also an obvious need for a solution to specifically define
where a container should look for annotations when we have web
applications with very large amount of classes.

Even if it has to be an XML-file, such as in Spring where you can
instruct  the framework where to look for beans, entities, controllers
and such.


Mark, is there a way we can influence the EG to change this?

Thanks.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Large webapps in 7.0.29 and Annotation Scanning not respecting metadata-complete

2012-08-01 Thread Rainer Jung

On 01.08.2012 18:10, Andreas Pålsson wrote:

I have been thinking about this issue all day, and I think the
specification needs more work on this area.


There is certainly no need for a container to wade through hundreds
maybe even thousands of classes in search of something that does not exist.
It is an unnecessary task which consumes both time and resources.


I am all for making it easier for a developer, and make the container
scan everything by default.

But there is also an obvious need for a solution to specifically define
where a container should look for annotations when we have web
applications with very large amount of classes.

Even if it has to be an XML-file, such as in Spring where you can
instruct  the framework where to look for beans, entities, controllers
and such.


Mark, is there a way we can influence the EG to change this?


I'm not Mark and don't want to preempt any answer from him, but there is 
the following public discussion available:


http://java.net/jira/browse/SERVLET_SPEC-36

and

http://java.net/jira/browse/SERVLET_SPEC-36

Regards,

Rainer


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Large webapps in 7.0.29 and Annotation Scanning not respecting metadata-complete

2012-08-01 Thread Rainer Jung

On 01.08.2012 18:52, Rainer Jung wrote:

Mark, is there a way we can influence the EG to change this?


I'm not Mark and don't want to preempt any answer from him, but there is
the following public discussion available:

http://java.net/jira/browse/SERVLET_SPEC-36

and

http://java.net/jira/browse/SERVLET_SPEC-36


Grrr, the second link should have been:

http://java.net/projects/servlet-spec/lists/jsr340-experts/archive/2012-07/message/28

Regards,

Rainer


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org