[Bug 53883] isapi_redirect v 1.2.37 crashes w3wp.exe on the production web servers - faulting module msvcrt.dll

2012-09-25 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53883

Frank Kavanagh  changed:

   What|Removed |Added

 OS||All

--- Comment #1 from Frank Kavanagh  ---
More information on this: The site is configured under SiteMinder validation.
The application is running as a dll in IIS but part of the application is Java
hosted in tomcat. isapi_redirect is used to pass the request from IIS to the
application in tomcat. Both the IIS virtual directory and the tomcat
applciation context are protected by SiteMinder.

During the pass through Sieminder will validate the request and add its
siteminder headers to the request header. Would the change in size of the
request header be the cause of this issue?

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



[GUMP@vmgump]: Project tomcat-taglibs-standard (in module tomcat-taglibs) failed

2012-09-25 Thread Gump
To whom it may engage...

This is an automated request, but not an unsolicited one. For 
more information please visit http://gump.apache.org/nagged.html, 
and/or contact the folk at gene...@gump.apache.org.

Project tomcat-taglibs-standard has an issue affecting its community 
integration.
This issue affects 2 projects,
 and has been outstanding for 95 runs.
The current state of this project is 'Failed', with reason 'Build Failed'.
For reference only, the following projects are affected by this:
- tomcat-taglibs-standard :  Standard Taglib
- tomcat-taglibs-standard-install :  JSP Taglibs


Full details are available at:

http://vmgump.apache.org/gump/public/tomcat-taglibs/tomcat-taglibs-standard/index.html

That said, some information snippets are provided here.

The following annotations (debug/informational/warning/error messages) were 
provided:
 -INFO- Optional dependency httpunit failed with reason build failed
 -DEBUG- (Apache Gump generated) Apache Maven Settings in: 
/srv/gump/public/workspace/tomcat-taglibs/standard/gump_mvn_settings.xml
 -INFO- Failed with reason build failed
 -DEBUG- Maven POM in: 
/srv/gump/public/workspace/tomcat-taglibs/standard/pom.xml
 -INFO- Failed to extract fallback artifacts from Gump Repository



The following work was performed:
http://vmgump.apache.org/gump/public/tomcat-taglibs/tomcat-taglibs-standard/gump_work/build_tomcat-taglibs_tomcat-taglibs-standard.html
Work Name: build_tomcat-taglibs_tomcat-taglibs-standard (Type: Build)
Work ended in a state of : Failed
Elapsed: 20 secs
Command Line: /opt/maven2/bin/mvn --batch-mode -DskipTests=true --settings 
/srv/gump/public/workspace/tomcat-taglibs/standard/gump_mvn_settings.xml 
install 
[Working Directory: /srv/gump/public/workspace/tomcat-taglibs/standard]
M2_HOME: /opt/maven2
-
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[debug] execute contextualize
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory 
/srv/gump/public/workspace/tomcat-taglibs/standard/spec/src/test/resources
[INFO] Copying 3 resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] No sources to compile
[INFO] [surefire:test {execution: default-test}]
[INFO] Tests are skipped.
[INFO] [bundle:bundle {execution: default-bundle}]
[INFO] [install:install {execution: default-install}]
[INFO] Installing 
/srv/gump/public/workspace/tomcat-taglibs/standard/spec/target/taglibs-standard-spec-1.2-SNAPSHOT.jar
 to 
/srv/gump/public/workspace/mvnlocalrepo/shared/org/apache/taglibs/taglibs-standard-spec/1.2-SNAPSHOT/taglibs-standard-spec-1.2-SNAPSHOT.jar
[INFO] [bundle:install {execution: default-install}]
[INFO] Parsing 
file:/srv/gump/public/workspace/mvnlocalrepo/shared/repository.xml
[INFO] Installing 
org/apache/taglibs/taglibs-standard-spec/1.2-SNAPSHOT/taglibs-standard-spec-1.2-SNAPSHOT.jar
[INFO] Writing OBR metadata
[INFO] 
[INFO] Building JSTL Implementation
[INFO]task-segment: [install]
[INFO] 
[INFO] [remote-resources:process {execution: default}]
[INFO] snapshot org.apache.taglibs:taglibs-standard-spec:1.2-SNAPSHOT: checking 
for updates from apache.snapshots
[debug] execute contextualize
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 14 resources
[INFO] Copying 3 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 96 source files to 
/srv/gump/public/workspace/tomcat-taglibs/standard/impl/target/classes
[INFO] -
[ERROR] COMPILATION ERROR : 
[INFO] -
[ERROR] 
/srv/gump/public/workspace/tomcat-taglibs/standard/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java:[38,7]
 error: DataSourceWrapper is not abstract and does not override abstract method 
getParentLogger() in CommonDataSource
[INFO] 1 error
[INFO] -
[INFO] 
[ERROR] BUILD FAILURE
[INFO] 
[INFO] Compilation failure
/srv/gump/public/workspace/tomcat-taglibs/standard/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java:[38,7]
 error: DataSourceWrapper is not abstract and does not override abstract method 
getParentLogger() in CommonDataSource

[INFO] 
[INFO] For more information, run Maven with the -e switch
[INFO] ---

WebClassLoader using SystemClassLoader to load ServletDef?

2012-09-25 Thread Elgs Chen
Dear Tomcat Developers,

I have a question regarding the behavior of the WebClassLoader.loadClass(String 
name, boolean resolve) in the org.apache.catalina.loader package.

I have the following assumptions, please correct me if any is wrong:
1, It seems the WebClassLoader only uses the SystemClassLoader (or 
AppClassLoader) to loader tomcat core classes, like ServletDef;
2, It seems if tomcat is started up by the startup.sh from the bin directory, 
the classpath in the startup command line will include only the jars in the bin 
directory: bootstrap.jar, commons-daemon.jar and tomcat-juli.jar;
3, ClassLoader.getSystemClassLoader() by default returns the class loader with 
the startup command-line classpath; 

Now if the above three assumption are correct, it seems that it's not possible 
for the WebClassLoader to load the tomcat core classes as only the few 
bootstrap jars are in the system class loader's classpath. However, the fact is 
the startup.sh script indeed starts tomcat up. Why?

For this I wrote some test code. My idea is to write a very simple bootstrap 
class(Bootstrap) which creates an instance of URLClassLoader, the instance of 
URLClassLoader has all jars shipped with the embedded tomcat 7.0.30. This 
classloader then loads another Class(TomcatMain), then instantiates it and 
calls its main method reflectively to start it up. The purpose of doing so is 
to save the effort to modify classpath in the startup script each time new jars 
are added. My Bootstrap class looks something like this:
public static void main(String[] args) throws Exception {
List jarList = new ArrayList();
System.out.println(getServerHome());
getClassPath(jarList, new File(getServerHome(), "lib"));
URL[] urlList = toURL(jarList);
URLClassLoader loader = new URLClassLoader(urlList);
Class c = loader.loadClass(args[0]);
Method m = c.getMethod("main", new Class[] { args.getClass() });
String[] appArgs = new String[args.length - 1];
System.arraycopy(args, 1, appArgs, 0, args.length - 1);
m.invoke(null, new Object[] { appArgs });
}

 And the TomcatMain looks something like this:
public static void main(String[] args) throws Exception {
if (args[0].indexOf("start") != -1) {
System.out.println("Self:" + TomcatMain.class.getClassLoader());
System.out.println("Parent:" + 
TomcatMain.class.getClassLoader().getParent());
String appBase = getServerHome() + "/web";
final Tomcat tomcat = new Tomcat();
tomcat.setPort(8080);
//...
}
}
   
Then I pack the Bootstrap in loader.jar, running the following command from the 
command-line:
java -cp loader.jar Bootstrap TomcatMain start

I get the following error output:
Self:java.net.URLClassLoader@60ec2ea8
Parent:sun.misc.Launcher$AppClassLoader@e776f7
...
SEVERE: End event threw exception
java.lang.ClassNotFoundException: org.apache.catalina.deploy.ServletDef
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at 
org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:852)
...
Then I debug into the WebClassLoader, it turned out that the SystemClassLoader 
is not able to load the ServletDef class. And it looks reasonable, as the 
system class loader should be the one that I put the few bootstrap jars in the 
command line, as the assumption 2 implies. Seems The WebClassLoader doesn't 
intend to load the ServletDef from the URLClassLoader created by the Bootstrap 
at all.

To further prove what I thought, I tried to start up the TomcatMain directly 
from the command line, with all embedded tomcat shipped jars in the command 
line classpath.  This time it works. Tomcat started up successfully, with the 
following output: 
Self:sun.misc.Launcher$AppClassLoader@492833ff
Parent:sun.misc.Launcher$ExtClassLoader@6e6dcfde
This time, it uses the system(app) class loader to load the ServletDef, which 
enclosing jar is in the command line classpath. So far, that proved what I 
guess.

So my question is:
How does the startup.sh shipped with tomcat binary make the WebClassLoader to 
load the ServletDef?

Thanks,
Elgs

Re: WebClassLoader using SystemClassLoader to load ServletDef?

2012-09-25 Thread Mark Thomas
On 25/09/2012 13:19, Elgs Chen wrote:
> Dear Tomcat Developers,
> 
> I have a question regarding the behavior of the 
> WebClassLoader.loadClass(String name, boolean resolve) in the 
> org.apache.catalina.loader package.
> 
> I have the following assumptions, please correct me if any is wrong:
> 1, It seems the WebClassLoader only uses the SystemClassLoader (or 
> AppClassLoader) to loader tomcat core classes, like ServletDef;

Wrong. See [1].

> 2, It seems if tomcat is started up by the startup.sh from the bin directory, 
> the classpath in the startup command line will include only the jars in the 
> bin directory: bootstrap.jar, commons-daemon.jar and tomcat-juli.jar;

Correct.

> 3, ClassLoader.getSystemClassLoader() by default returns the class loader 
> with the startup command-line classpath; 

Correct.

> Now if the above three assumption are correct, it seems that it's not 
> possible for the WebClassLoader to load the tomcat core classes as only the 
> few bootstrap jars are in the system class loader's classpath. However, the 
> fact is the startup.sh script indeed starts tomcat up. Why?

The logical conclusion would be that one or more of the assumptions is
wrong.


> So my question is:
> How does the startup.sh shipped with tomcat binary make the WebClassLoader to 
> load the ServletDef?

See [2], line 262.

Mark


[1] http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html
[2]
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java?view=annotate

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



Re: to improve the performance of form-based upload for Tomcat 7

2012-09-25 Thread Fastupload
Konstantin, to whom maybe concern,

What's the right  org  that I can apply a commuter account of apache open 
source project?

Best Regards,
Link Qian


On Sep 11, 2012, at 9:48 PM, Konstantin Kolinko  wrote:

> 2012/9/11 Link Qian :
>> Konstantin,
>> 
>> Could you give me a reference about involving development process of Tomcat 
>> open source project?
> 
> http://tomcat.apache.org/getinvolved.html
> 
> http://www.apache.org/dev/contributors.html
> http://www.apache.org/foundation/how-it-works.html
> 
> If you need more detailed explanation, please ask on the mailing list,
> so that others could answer as well.
> 
> Best regards,
> Konstantin Kolinko
> 


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



Re: WebClassLoader using SystemClassLoader to load ServletDef?

2012-09-25 Thread Elgs Chen
Hi Mark,

Thanks for your fast answer. That helped me to narrow down the scope of this 
problem. I understand line 262 is to initialize and create the common, shared 
and catalina class loaders. But I'm still struggling how the 
WebappClassLoader.loadClass(String name, boolean resolve) be able to load the 
class ServletDef. Can you please give me some more insight into this method? I 
think the it should load the class via the catalina class loader as my previous 
assumption 1 was wrong. If this is the case, How does this method achieve that?

Many thanks,
Elgs


On Sep 25, 2012, at 9:28 PM, Mark Thomas  wrote:

> On 25/09/2012 13:19, Elgs Chen wrote:
>> Dear Tomcat Developers,
>> 
>> I have a question regarding the behavior of the 
>> WebClassLoader.loadClass(String name, boolean resolve) in the 
>> org.apache.catalina.loader package.
>> 
>> I have the following assumptions, please correct me if any is wrong:
>> 1, It seems the WebClassLoader only uses the SystemClassLoader (or 
>> AppClassLoader) to loader tomcat core classes, like ServletDef;
> 
> Wrong. See [1].
> 
>> 2, It seems if tomcat is started up by the startup.sh from the bin 
>> directory, the classpath in the startup command line will include only the 
>> jars in the bin directory: bootstrap.jar, commons-daemon.jar and 
>> tomcat-juli.jar;
> 
> Correct.
> 
>> 3, ClassLoader.getSystemClassLoader() by default returns the class loader 
>> with the startup command-line classpath; 
> 
> Correct.
> 
>> Now if the above three assumption are correct, it seems that it's not 
>> possible for the WebClassLoader to load the tomcat core classes as only the 
>> few bootstrap jars are in the system class loader's classpath. However, the 
>> fact is the startup.sh script indeed starts tomcat up. Why?
> 
> The logical conclusion would be that one or more of the assumptions is
> wrong.
> 
> 
>> So my question is:
>> How does the startup.sh shipped with tomcat binary make the WebClassLoader 
>> to load the ServletDef?
> 
> See [2], line 262.
> 
> Mark
> 
> 
> [1] http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html
> [2]
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java?view=annotate
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 
> 


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



Re: WebClassLoader using SystemClassLoader to load ServletDef?

2012-09-25 Thread Mark Thomas
On 25/09/2012 16:04, Elgs Chen wrote:
> Hi Mark,
> 
> Thanks for your fast answer. That helped me to narrow down the scope of this 
> problem. I understand line 262 is to initialize and create the common, shared 
> and catalina class loaders. But I'm still struggling how the 
> WebappClassLoader.loadClass(String name, boolean resolve) be able to load the 
> class ServletDef. Can you please give me some more insight into this method? 
> I think the it should load the class via the catalina class loader as my 
> previous assumption 1 was wrong. If this is the case, How does this method 
> achieve that?

This is beginning to sound like a homework question. I suggest you look
at the source code for the WebappClassLoader and/or trace through the
code using a debugger.

Mark


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



Re: to improve the performance of form-based upload for Tomcat 7

2012-09-25 Thread Mark Thomas
On 25/09/2012 15:14, Fastupload wrote:
> Konstantin, to whom maybe concern,
> 
> What's the right  org  that I can apply a commuter account of apache open 
> source project?

You don't. You should read this [1]. Patches (in diff -u format) should
be attached to Bugzilla issues.

Mark

[1] http://www.apache.org/foundation/how-it-works.html


> 
> Best Regards,
> Link Qian
> 
> 
> On Sep 11, 2012, at 9:48 PM, Konstantin Kolinko  
> wrote:
> 
>> 2012/9/11 Link Qian :
>>> Konstantin,
>>>
>>> Could you give me a reference about involving development process of Tomcat 
>>> open source project?
>>
>> http://tomcat.apache.org/getinvolved.html
>>
>> http://www.apache.org/dev/contributors.html
>> http://www.apache.org/foundation/how-it-works.html
>>
>> If you need more detailed explanation, please ask on the mailing list,
>> so that others could answer as well.
>>
>> Best regards,
>> Konstantin Kolinko
>>
> 
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 


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



Re: to improve the performance of form-based upload for Tomcat 7

2012-09-25 Thread Christopher Schultz
Link,

On 9/25/12 10:14 AM, Fastupload wrote:
> What's the right  org  that I can apply a commuter account of apache
> open source project?

Committers are invited by the current group of active participants. The
best way to be invited is to become active in the community (i.e. this
mailing list and/or the us...@tomcat.apache.org mailing list), and
submit patches.

If you have a specific patch you think would be useful, file an
enhancement request in Bugzilla and attach your patch to it. If it's
useful, someone will apply it and give you credit.

I'm interested in how you are able to obtain a "5x speed improvement
over commons file-upload": the slowest link in the chain is the network
which you can't fix with software (other than compression). I'm unclear
as to why you think Boyer Moore string searching will be measurably
faster than simple String.indexOf because the search strings (the
multipart boundaries, usually only about 64 bytes) are so small.

Also, I think the use of Boyer Moore is naïve, as it will require you to
read a whole multipart part into memory before searching for the
boundary and disassembling the parts.

Finally, you ignore an opportunity to further improve your algorithm
because the multipart boundary does not change from part to part: you
can cache the charset and offset tables for the multipart boundary for
the entire request instead of re-creating them each time you search. But
then you'd have to understand the algorithm instead of just copy/pasting
from Wikipedia. At least change some of the Javadoc formatting if you
are going to steal other people's work. Otherwise, give them credit.

-chris



signature.asc
Description: OpenPGP digital signature


Re: WebClassLoader using SystemClassLoader to load ServletDef?

2012-09-25 Thread Elgs Chen
Hi Mark,

I finally get my homework done. Thank you so much for pointing me to the right 
direction. That really helped me to gain huge insight into the inner world of 
the tomcat.

I used JPDA to attach my eclipse to tomcat. Then I was able to see everything 
happens with the WebappClassLoader.loadClass. For my question, the key is to 
set the WebappClassLoader's parent class loader. Previously it was the system 
class loader, which is not intended. As this became obvious, I added a line to 
set the server's parent class loader, like this:

final StandardServer server = (StandardServer) tomcat.getServer();
server.setParentClassLoader(TomcatMain.class.getClassLoader());

Now the server's parent class loader becomes my URLClassLoader, and that is the 
class loader being able to load all the jars I put in the lib directory. Then I 
start my Bootstrap, it works like a charm!!

Mark, thank you so much. I really really appreciate you fast and kind help!

Best regards,
Elgs

On Sep 25, 2012, at 11:04 PM, Elgs Chen  wrote:

> Hi Mark,
> 
> Thanks for your fast answer. That helped me to narrow down the scope of this 
> problem. I understand line 262 is to initialize and create the common, shared 
> and catalina class loaders. But I'm still struggling how the 
> WebappClassLoader.loadClass(String name, boolean resolve) be able to load the 
> class ServletDef. Can you please give me some more insight into this method? 
> I think the it should load the class via the catalina class loader as my 
> previous assumption 1 was wrong. If this is the case, How does this method 
> achieve that?
> 
> Many thanks,
> Elgs
> 
> 
> On Sep 25, 2012, at 9:28 PM, Mark Thomas  wrote:
> 
>> On 25/09/2012 13:19, Elgs Chen wrote:
>>> Dear Tomcat Developers,
>>> 
>>> I have a question regarding the behavior of the 
>>> WebClassLoader.loadClass(String name, boolean resolve) in the 
>>> org.apache.catalina.loader package.
>>> 
>>> I have the following assumptions, please correct me if any is wrong:
>>> 1, It seems the WebClassLoader only uses the SystemClassLoader (or 
>>> AppClassLoader) to loader tomcat core classes, like ServletDef;
>> 
>> Wrong. See [1].
>> 
>>> 2, It seems if tomcat is started up by the startup.sh from the bin 
>>> directory, the classpath in the startup command line will include only the 
>>> jars in the bin directory: bootstrap.jar, commons-daemon.jar and 
>>> tomcat-juli.jar;
>> 
>> Correct.
>> 
>>> 3, ClassLoader.getSystemClassLoader() by default returns the class loader 
>>> with the startup command-line classpath; 
>> 
>> Correct.
>> 
>>> Now if the above three assumption are correct, it seems that it's not 
>>> possible for the WebClassLoader to load the tomcat core classes as only the 
>>> few bootstrap jars are in the system class loader's classpath. However, the 
>>> fact is the startup.sh script indeed starts tomcat up. Why?
>> 
>> The logical conclusion would be that one or more of the assumptions is
>> wrong.
>> 
>> 
>>> So my question is:
>>> How does the startup.sh shipped with tomcat binary make the WebClassLoader 
>>> to load the ServletDef?
>> 
>> See [2], line 262.
>> 
>> Mark
>> 
>> 
>> [1] http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html
>> [2]
>> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java?view=annotate
>> 
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: dev-h...@tomcat.apache.org
>> 
>> 
> 
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 
> 



svn commit: r1390047 - in /tomcat/trunk/java/org/apache: catalina/connector/Request.java coyote/AbstractProtocol.java coyote/ProtocolHandler.java coyote/http11/AbstractHttp11Processor.java

2012-09-25 Thread markt
Author: markt
Date: Tue Sep 25 18:49:20 2012
New Revision: 1390047

URL: http://svn.apache.org/viewvc?rev=1390047&view=rev
Log:
Creating the map entries for the special request attributes was generating ~11% 
of the garbage in the load test. Re-factor so these entries are not created.

Modified:
tomcat/trunk/java/org/apache/catalina/connector/Request.java
tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1390047&r1=1390046&r2=1390047&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Tue Sep 25 
18:49:20 2012
@@ -3225,5 +3225,44 @@ public class Request
 // NO-OP
 }
 });
+specialAttributes.put(Globals.COMET_SUPPORTED_ATTR,
+new SpecialAttributeAdapter() {
+@Override
+public Object get(Request request, String name) {
+return Boolean.valueOf(
+request.getConnector().getProtocolHandler(
+).isCometSupported());
+}
+@Override
+public void set(Request request, String name, Object 
value) {
+// NO-OP
+}
+});
+specialAttributes.put(Globals.COMET_TIMEOUT_SUPPORTED_ATTR,
+new SpecialAttributeAdapter() {
+@Override
+public Object get(Request request, String name) {
+return Boolean.valueOf(
+request.getConnector().getProtocolHandler(
+).isCometTimeoutSupported());
+}
+@Override
+public void set(Request request, String name, Object 
value) {
+// NO-OP
+}
+});
+specialAttributes.put(Globals.SENDFILE_SUPPORTED_ATTR,
+new SpecialAttributeAdapter() {
+@Override
+public Object get(Request request, String name) {
+return Boolean.valueOf(
+request.getConnector().getProtocolHandler(
+).isSendfileSupported());
+}
+@Override
+public void set(Request request, String name, Object 
value) {
+// NO-OP
+}
+});
 }
 }

Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1390047&r1=1390046&r2=1390047&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Tue Sep 25 
18:49:20 2012
@@ -157,6 +157,24 @@ public abstract class AbstractProtocol i
 }
 
 
+@Override
+public boolean isCometSupported() {
+return endpoint.getUseComet();
+}
+
+
+@Override
+public boolean isCometTimeoutSupported() {
+return endpoint.getUseCometTimeout();
+}
+
+
+@Override
+public boolean isSendfileSupported() {
+return endpoint.getUseSendfile();
+}
+
+
 // -- Properties that are passed through to the 
EndPoint
 
 @Override

Modified: tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java?rev=1390047&r1=1390046&r2=1390047&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java Tue Sep 25 
18:49:20 2012
@@ -88,4 +88,22 @@ public interface ProtocolHandler {
  * Requires APR/native library
  */
 public boolean isAprRequired();
+
+
+/**
+ * Does this ProtocolHandler support Comet?
+ */
+public boolean isCometSupported();
+
+
+/**
+ * Does this ProtocolHandler support Comet timeouts?
+ */
+public boolean isCometTimeoutSupported();
+
+
+/**
+ * Does this ProtocolHandler support sendfile?
+ */
+public boolean isSendfileSupported();
 }

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.j

Re: WebClassLoader using SystemClassLoader to load ServletDef?

2012-09-25 Thread Christopher Schultz
Elgs,

On 9/25/12 1:15 PM, Elgs Chen wrote:
> Hi Mark,
> 
> I finally get my homework done. Thank you so much for pointing me to the 
> right direction. That really helped me to gain huge insight into the inner 
> world of the tomcat.
> 
> I used JPDA to attach my eclipse to tomcat. Then I was able to see everything 
> happens with the WebappClassLoader.loadClass. For my question, the key is to 
> set the WebappClassLoader's parent class loader. Previously it was the system 
> class loader, which is not intended. As this became obvious, I added a line 
> to set the server's parent class loader, like this:
> 
> final StandardServer server = (StandardServer) tomcat.getServer();
> server.setParentClassLoader(TomcatMain.class.getClassLoader());
> 
> Now the server's parent class loader becomes my URLClassLoader, and that is 
> the class loader being able to load all the jars I put in the lib directory. 
> Then I start my Bootstrap, it works like a charm!!
> 
> Mark, thank you so much. I really really appreciate you fast and kind help!

Note that Tomcat separates ClassLoaders in this way to protect
"system"-level classes from being loaded by web applications. By
changing the parent ClassLoader, you are undoing that protection.

-chris



signature.asc
Description: OpenPGP digital signature


Re: WebClassLoader using SystemClassLoader to load ServletDef?

2012-09-25 Thread Elgs Chen
Hi Chris,

Thanks for reminding. I'm fully aware of the separating to protecting 
mechanism, and some classes are loaded from top to down, like those starting 
with java and javax, and some are prohibited to be loaded from the webapp class 
loaders, like the servlet API classes like ServletDef, others are bottom to up. 
Actually I think I'm just doing the similar thing as what Tomcat is doing. I'm 
creating my URLClassLoader while Tomcat is creating the common class loader. So 
I think my instance of URLClassLoader is just a simple counterpart of the 
common class loader. And above them is the system/app class loader.

Would you correct me if my understanding is not accurate?

Best regards,
Elgs

On Sep 26, 2012, at 3:19 AM, Christopher Schultz  
wrote:

> Elgs,
> 
> On 9/25/12 1:15 PM, Elgs Chen wrote:
>> Hi Mark,
>> 
>> I finally get my homework done. Thank you so much for pointing me to the 
>> right direction. That really helped me to gain huge insight into the inner 
>> world of the tomcat.
>> 
>> I used JPDA to attach my eclipse to tomcat. Then I was able to see 
>> everything happens with the WebappClassLoader.loadClass. For my question, 
>> the key is to set the WebappClassLoader's parent class loader. Previously it 
>> was the system class loader, which is not intended. As this became obvious, 
>> I added a line to set the server's parent class loader, like this:
>> 
>> final StandardServer server = (StandardServer) tomcat.getServer();
>> server.setParentClassLoader(TomcatMain.class.getClassLoader());
>> 
>> Now the server's parent class loader becomes my URLClassLoader, and that is 
>> the class loader being able to load all the jars I put in the lib directory. 
>> Then I start my Bootstrap, it works like a charm!!
>> 
>> Mark, thank you so much. I really really appreciate you fast and kind help!
> 
> Note that Tomcat separates ClassLoaders in this way to protect
> "system"-level classes from being loaded by web applications. By
> changing the parent ClassLoader, you are undoing that protection.
> 
> -chris
> 


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



svn commit: r1390162 - in /tomcat/trunk/java/org/apache: coyote/http11/AbstractHttp11Processor.java coyote/http11/Http11AprProcessor.java coyote/http11/Http11NioProcessor.java coyote/http11/Http11Proc

2012-09-25 Thread markt
Author: markt
Date: Tue Sep 25 21:36:55 2012
New Revision: 1390162

URL: http://svn.apache.org/viewvc?rev=1390162&view=rev
Log:
Move the cache for the attributes listed below from the Processor to the 
SocketWrapper as they are fixed for the lifetime of the socket and the 
Processor gets recycled on every request
- remote address
- remote host name
- remote port
- local address
- local host name
- local port

This reduces object allocation during my load test by ~30% (the allocations 
were triggered by the AccessLogValve logging the remote IP)

Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1390162&r1=1390161&r2=1390162&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Tue 
Sep 25 21:36:55 2012
@@ -159,42 +159,6 @@ public abstract class AbstractHttp11Proc
 protected int keepAliveTimeout = -1;
 
 /**
- * Remote Address associated with the current connection.
- */
-protected String remoteAddr = null;
-
-
-/**
- * Remote Host associated with the current connection.
- */
-protected String remoteHost = null;
-
-
-/**
- * Local Host associated with the current connection.
- */
-protected String localName = null;
-
-
-/**
- * Local port to which the socket is connected
- */
-protected int localPort = -1;
-
-
-/**
- * Remote port to which the socket is connected
- */
-protected int remotePort = -1;
-
-
-/**
- * The local Host address.
- */
-protected String localAddr = null;
-
-
-/**
  * Maximum timeout on uploads. 5 minutes as in Apache HTTPD server.
  */
 protected int connectionUploadTimeout = 30;
@@ -1662,12 +1626,6 @@ public abstract class AbstractHttp11Proc
 asyncStateMachine.recycle();
 }
 upgradeInbound = null;
-remoteAddr = null;
-remoteHost = null;
-localAddr = null;
-localName = null;
-remotePort = -1;
-localPort = -1;
 comet = false;
 recycleInternal();
 }

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1390162&r1=1390161&r2=1390162&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Tue Sep 
25 21:36:55 2012
@@ -278,87 +278,110 @@ public class Http11AprProcessor extends 
 
 if (actionCode == ActionCode.REQ_HOST_ADDR_ATTRIBUTE) {
 
-// Get remote host address
-if (remoteAddr == null && (socketRef != 0)) {
-try {
-long sa = Address.get(Socket.APR_REMOTE, socketRef);
-remoteAddr = Address.getip(sa);
-} catch (Exception e) {
-log.warn(sm.getString("http11processor.socket.info"), e);
+if (socketRef == 0) {
+request.remoteAddr().recycle();
+} else {
+if (socket.getRemoteAddr() == null) {
+try {
+long sa = Address.get(Socket.APR_REMOTE, socketRef);
+socket.setRemoteAddr(Address.getip(sa));
+} catch (Exception e) {
+log.warn(sm.getString("http11processor.socket.info"), 
e);
+}
 }
+request.remoteAddr().setString(socket.getRemoteAddr());
 }
-request.remoteAddr().setString(remoteAddr);
 
 } else if (actionCode == ActionCode.REQ_LOCAL_NAME_ATTRIBUTE) {
 
-// Get local host name
-if (localName == null && (socketRef != 0)) {
-try {
-long sa = Address.get(Socket.APR_LOCAL, socketRef);
-localName = Address.getnameinfo(sa, 0);
-} catch (Exception e) {
-log.warn(sm.getString("http11processor.socket.info"), e);
+if (socketRef == 0) {
+request.localName().recycle();
+} else {
+if (socket.getLocalName() == null) {
+try {
+ 

Re: to improve the performance of form-based upload for Tomcat 7

2012-09-25 Thread Fastupload
Chris,


here are my brief opinions.

> Committers are invited by the current group of active participants. The
> best way to be invited is to become active in the community (i.e. this
> mailing list and/or the us...@tomcat.apache.org mailing list), and
> submit patches.
> 
thanks for providing the right info.


> If you have a specific patch you think would be useful, file an
> enhancement request in Bugzilla and attach your patch to it. If it's
> useful, someone will apply it and give you credit.
> 
> I'm interested in how you are able to obtain a "5x speed improvement
> over commons file-upload": the slowest link in the chain is the network
> which you can't fix with software (other than compression). I'm unclear
> as to why you think Boyer Moore string searching will be measurably
> faster than simple String.indexOf because the search strings (the
> multipart boundaries, usually only about 64 bytes) are so small.
> 
why BoyerMoore algorithm is faster then simple String.indexOf search, you can 
reference the wiki page, 
http://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm

in fastupload, the architecture is more simple than commons file upload. also, 
fast upload requires java 5 or high version. so commons file upload cannot be 
fixed with the same way.

in fact, BoyerMoore string search algorithm is open. I research the algorithm 
and found that it is the right algorithm to find a random character in text. 
A un-titled author write the java implementation of it in Wiki. I made a bit 
enhancement of the implementation, to enable it has the ability search  content 
in java bytes.  the source code named "BoyerMoore.java"  in the fast upload 
project to give the copyright to Boyer and Moore.

where ever, BoyerMoore can search any java bytes.  Reading whole bytes of 
ServletInputStream buffer is not required.  In the case, reading some bytes 
from ServletInputStream and find boundary  from the bytes, it did good jobs 
well. if you're interested it. please reference the source code 
StreamUploaderParser.java in fast upload source. 

compare with commons file upload and Cosz upload component, only fast upload 
component provides the resolution that parse a part data of Multipart data 
represent a uploading file. and write the data into a file.  the resolution can 
reduce the memory cost when parsing a large size of file.

> Also, I think the use of Boyer Moore is naïve, as it will require you to
> read a whole multipart part into memory before searching for the
> boundary and disassembling the parts.
> 
> Finally, you ignore an opportunity to further improve your algorithm
> because the multipart boundary does not change from part to part: you
> can cache the charset and offset tables for the multipart boundary for
> the entire request instead of re-creating them each time you search.
Exactly! since fast upload 0.3.5 release, the plan includes the enhancement. 

> But
> then you'd have to understand the algorithm instead of just copy/pasting
> from Wikipedia. At least change some of the Javadoc formatting if you
> are going to steal other people's work. Otherwise, give them credit.





On Sep 25, 2012, at 11:40 PM, Christopher Schultz 
 wrote:

> Link,
> 
> On 9/25/12 10:14 AM, Fastupload wrote:
>> What's the right  org  that I can apply a commuter account of apache
>> open source project?
> 
> Committers are invited by the current group of active participants. The
> best way to be invited is to become active in the community (i.e. this
> mailing list and/or the us...@tomcat.apache.org mailing list), and
> submit patches.
> 
> If you have a specific patch you think would be useful, file an
> enhancement request in Bugzilla and attach your patch to it. If it's
> useful, someone will apply it and give you credit.
> 
> I'm interested in how you are able to obtain a "5x speed improvement
> over commons file-upload": the slowest link in the chain is the network
> which you can't fix with software (other than compression). I'm unclear
> as to why you think Boyer Moore string searching will be measurably
> faster than simple String.indexOf because the search strings (the
> multipart boundaries, usually only about 64 bytes) are so small.
> 
> Also, I think the use of Boyer Moore is naïve, as it will require you to
> read a whole multipart part into memory before searching for the
> boundary and disassembling the parts.
> 
> Finally, you ignore an opportunity to further improve your algorithm
> because the multipart boundary does not change from part to part: you
> can cache the charset and offset tables for the multipart boundary for
> the entire request instead of re-creating them each time you search. But
> then you'd have to understand the algorithm instead of just copy/pasting
> from Wikipedia. At least change some of the Javadoc formatting if you
> are going to steal other people's work. Otherwise, give them credit.
> 
> -chris
>