[Bug 56770] Add worker name to logging entries

2014-07-25 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56770

--- Comment #5 from Martin Knoblauch kn...@knobisoft.de ---
Hi Christopher,

 you are talking about this hunk?

@@ -2704,13 +2726,13 @@
  */
 ajp_next_connection(p, l);
 }
+ajp_update_stats(e, aw, rc, l);
 /* Log the error only once per failed request.
  */
 jk_log(l, JK_LOG_ERROR,
-   (%s) connecting to tomcat failed.,
-   aw-name);
+   (%s) connecting to tomcat failed (rc=%d, errors=%d,
client_errors=%d).,
+   aw-name,rc,aw-s-errors,aw-s-client_errors);

-ajp_update_stats(e, aw, rc, l);
 JK_TRACE_EXIT(l);
 return rc;

Sorry for not mentioning it in the description. The explanation is simple.

Before the addition of the rc/errors/client_errors fields to the log it did not
matter where the call to update_stats occurred relative to the logging. Now we
want to display the updated numbers - at least I think so, therefore the call
to update_stats needs to happen before the logging.

Cheers
Martin

-- 
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



[Bug 56771] New: Avoid throwing NameNotFoundException in BaseDirContext#lookup()

2014-07-25 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56771

Bug ID: 56771
   Summary: Avoid throwing NameNotFoundException in
BaseDirContext#lookup()
   Product: Tomcat 7
   Version: trunk
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: xs...@ebay.com

Created attachment 31848
  -- https://issues.apache.org/bugzilla/attachment.cgi?id=31848action=edit
The issue

NameNotFoundException is thrown when the resource can't be found in this
DirContext.

In the method BaseDirContext, it also goes through all the alternate or backup
DirContexts to lookup the resource one by one until the resource is found.
A NameNotFoundException is thrown in the alternate DirContext when the given
resource name isn't in this DirContext.

  public final Object lookup(String name) throws NamingException {
// First check for aliases
if (!aliases.isEmpty()) {
AliasResult result = findAlias(name);
if (result.dirContext != null) {
return result.dirContext.lookup(result.aliasName);
}
}

// Next do a standard lookup
Object obj = doLookup(name);

if (obj != null)
return obj;

// Check the alternate locations
for (DirContext altDirContext : altDirContexts) {
try {
obj = altDirContext.lookup(/META-INF/resources + name);
if (obj != null)
return obj;
} catch ( NamingException ex) {
// ignore
}
}

// Really not found
throw new NameNotFoundException(
sm.getString(resources.notFound, name));
}


It takes much CPU time.   It could be optimized by checking result is null or
not.

Here is the optimized code,
public final Object lookup(String name) throws NamingException {
// First check for aliases
Object obj = doLookupWithoutNFE(name);
if (obj != null) {
return obj;
}

// Really not found
throw new NameNotFoundException(
sm.getString(resources.notFound, name));
}

protected Object doLookupWithoutNFE(String name) throws NamingException {
if (!aliases.isEmpty()) {
AliasResult result = findAlias(name);
if (result.dirContext != null) {
return result.dirContext.lookup(result.aliasName);
}
}

// Next do a standard lookup
Object obj = doLookup(name);

if (obj != null)
return obj;

// Check the alternate locations
String resourceName = /META-INF/resources + name;
for (DirContext altDirContext : altDirContexts) {
if (altDirContext instanceof BaseDirContext) {
obj =
((BaseDirContext)altDirContext).doLookupWithoutNFE(resourceName);
}
else {
try {
obj = altDirContext.lookup(resourceName);
} catch ( NamingException ex) {
// ignore
}
}
if (obj != null) {
return obj;
}
}

//Return null instead
return null;
}

-- 
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



[Bug 56771] Avoid throwing NameNotFoundException in BaseDirContext#lookup()

2014-07-25 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56771

--- Comment #1 from Sheldon Shao xs...@ebay.com ---
Created attachment 31849
  -- https://issues.apache.org/bugzilla/attachment.cgi?id=31849action=edit
Patch for BaseDirContext

Patch for BaseDirContext

-- 
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



[Bug 56771] Avoid throwing NameNotFoundException in BaseDirContext#lookup()

2014-07-25 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56771

--- Comment #2 from Sheldon Shao xs...@ebay.com ---
Created attachment 31850
  -- https://issues.apache.org/bugzilla/attachment.cgi?id=31850action=edit
JProfiler snapshot after optimized

-- 
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



[Bug 56614] Add a switch to ignore annotations detection on tag instances for performance reason

2014-07-25 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56614

Sheldon Shao xs...@ebay.com changed:

   What|Removed |Added

   Severity|enhancement |normal

-- 
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



Cookie configuration for a node-draining tool

2014-07-25 Thread Christopher Schultz
All,

Please see http://markmail.org/thread/x4yjs62jxe4q3ns3 for reference.

I'm writing a Valve that can basically scuttle a session cookie under
certain circumstances.

My first implementation just had JSESSIONID as the cookie name, and I
was using request.getContextPath() as the cookie path. When I went back
to improve it, I changed the cookie name to a class variable that was
configurable.

When I was writing my documentation, it occurred to me that I might be
able to inspect Tomcat's configuration to determine the cookie name and
path instead of having the user configure them in the Valve itself...
users /are/ configuring that stuff elsewhere already -- why make them do
it twice?

So it looks like I have three choices:

1. Use manual configuration. This is what I'm trying to avoid.

2. Use request.getServletContext().getSessionCookieConfig().*

3. Use request.getContext().getSessionCookie*

#2 would not be back-portable past Tomcat 7.

Is there an appreciable difference between #2 and #3? Is there a
preference either way?

I'm kind of inclined to target #2 because it uses the servlet API and
provides a better example that could be used perhaps outside of a Valve.

Any thoughts?

I think I might still have to use
request.getContext().getSessionCookiePathUsesTrailingSlash() because
that does not seem to be available in the servlet API's
SessionCookieConfig object.

Thanks,
-chris



signature.asc
Description: OpenPGP digital signature


little feedback from 8 changes

2014-07-25 Thread Romain Manni-Bucau
Hi

I have 2 main issues/requests regarding big refactorings done in 8.x
(mainly integrating it with tomee):

1) is it possible to get an easy way to switch scanning of @WebXXX and
@HandleTypes? In TomEE we already scanned it while scanning for other infos
(CDI, EJB, web services JAXRS/JAXWS,...) and we have our own model (jar or
dir url - list of class names) and it would be awesome to be able to reuse
it without as much hacks as today.

2) I surely missed something but how to share tld scanning of the container
jars? Basically in StandardJarScanner withscanClassPath=true, we have jsf
and jstl jars in tomcat/lib and I would like to avoid to parse tld of these
jars N times since that's exactly the same
ones. tldResourcePathTaglibXmlMap seems intended to it but each webapp has
a different TldScanner so it doesn't work and that's not that easy to
switch it. Any mecanism I missed or something to add?

Otherwise classloading refactoring allowed us to kill several code so a big
thank you :)

Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


[GUMP@vmgump]: Project tomcat-tc7.0.x-validate (in module tomcat-7.0.x) failed

2014-07-25 Thread Bill Barker
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-tc7.0.x-validate has an issue affecting its community 
integration.
This issue affects 1 projects.
The current state of this project is 'Failed', with reason 'Build Failed'.
For reference only, the following projects are affected by this:
- tomcat-tc7.0.x-validate :  Tomcat 7.x, a web server implementing Java 
Servlet 3.0,
...


Full details are available at:

http://vmgump.apache.org/gump/public/tomcat-7.0.x/tomcat-tc7.0.x-validate/index.html

That said, some information snippets are provided here.

The following annotations (debug/informational/warning/error messages) were 
provided:
 -DEBUG- Dependency on checkstyle exists, no need to add for property 
checkstyle.jar.
 -INFO- Failed with reason build failed



The following work was performed:
http://vmgump.apache.org/gump/public/tomcat-7.0.x/tomcat-tc7.0.x-validate/gump_work/build_tomcat-7.0.x_tomcat-tc7.0.x-validate.html
Work Name: build_tomcat-7.0.x_tomcat-tc7.0.x-validate (Type: Build)
Work ended in a state of : Failed
Elapsed: 26 secs
Command Line: /usr/lib/jvm/java-7-oracle/bin/java -Djava.awt.headless=true 
-Dbuild.sysclasspath=only org.apache.tools.ant.Main 
-Dgump.merge=/srv/gump/public/gump/work/merge.xml 
-Dcheckstyle.jar=/srv/gump/public/workspace/checkstyle/target/checkstyle-5.8-SNAPSHOT.jar
 -Dexecute.validate=true validate 
[Working Directory: /srv/gump/public/workspace/tomcat-7.0.x]
CLASSPATH: 
/usr/lib/jvm/java-7-oracle/lib/tools.jar:/srv/gump/public/workspace/ant/dist/lib/ant.jar:/srv/gump/public/workspace/ant/dist/lib/ant-launcher.jar:/srv/gump/public/workspace/ant/dist/lib/ant-jmf.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit4.jar:/srv/gump/public/workspace/ant/dist/lib/ant-swing.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-resolver.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-xalan2.jar:/srv/gump/public/workspace/xml-commons/java/build/resolver.jar:/srv/gump/packages/antlr/antlr-3.1.3.jar:/srv/gump/public/workspace/checkstyle/target/checkstyle-5.8-SNAPSHOT.jar:/srv/gump/public/workspace/apache-commons/beanutils/dist/commons-beanutils-20140726.jar:/srv/gump/public/workspace/apache-commons/cli/target/commons-cli-1.3-SNAPSHOT.jar:/srv/gump/public/workspace/commons-collections-3.x/target/commons-collections-3.3-SNAPSHOT.jar:/srv/gump/public/workspace/apache-commons/exec/tar
 
get/commons-exec-1.3-SNAPSHOT.jar:/srv/gump/public/workspace/apache-commons/logging/target/commons-logging-20140726.jar:/srv/gump/public/workspace/apache-commons/logging/target/commons-logging-api-20140726.jar:/srv/gump/public/workspace/apache-commons/validator/dist/commons-validator-20140726.jar:/srv/gump/public/workspace/google-guava/guava/target/guava-18.0-SNAPSHOT.jar
-
Buildfile: /srv/gump/public/workspace/tomcat-7.0.x/build.xml

build-prepare:
   [delete] Deleting directory 
/srv/gump/public/workspace/tomcat-7.0.x/output/build/temp
[mkdir] Created dir: 
/srv/gump/public/workspace/tomcat-7.0.x/output/build/temp

compile-prepare:

download-validate:

proxyflags:

setproxy:

testexist:
 [echo] Testing  for 
/srv/gump/public/workspace/checkstyle/target/checkstyle-5.8-SNAPSHOT.jar

downloadzip:

validate:
[mkdir] Created dir: 
/srv/gump/public/workspace/tomcat-7.0.x/output/res/checkstyle
[checkstyle] Running Checkstyle 5.8-SNAPSHOT on 2600 files
[checkstyle] 
/srv/gump/public/workspace/tomcat-7.0.x/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug53367.java:1:
 Line does not match expected header line of '^(rem)?\W*Licensed to the Apache 
Software Foundation \(ASF\) under one or more$'.
[checkstyle] 
/srv/gump/public/workspace/tomcat-7.0.x/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug53367.java:6:
 Wrong order for 'org.junit.Assert' import.
[checkstyle] 
/srv/gump/public/workspace/tomcat-7.0.x/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug53367.java:7:
 'org.apache.tomcat.jdbc.pool.ConnectionPool' should be separated from previous 
imports.
[checkstyle] 
/srv/gump/public/workspace/tomcat-7.0.x/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug53367.java:11:
 Wrong order for 'org.junit.Test' import.
[checkstyle] 
/srv/gump/public/workspace/tomcat-7.0.x/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug53367.java:16:
 Wrong order for 'java.sql.Connection' import.
[checkstyle] 
/srv/gump/public/workspace/tomcat-7.0.x/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug53367.java:25:
 Wrong order for 'java.util.concurrent.ArrayBlockingQueue' import.

BUILD FAILED
/srv/gump/public/workspace/tomcat-7.0.x/build.xml:496: Got 6 errors and 0 
warnings.

Total time: 26 seconds

[GUMP@vmgump]: Project tomcat-trunk-validate (in module tomcat-trunk) failed

2014-07-25 Thread Bill Barker
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-trunk-validate has an issue affecting its community integration.
This issue affects 1 projects.
The current state of this project is 'Failed', with reason 'Build Failed'.
For reference only, the following projects are affected by this:
- tomcat-trunk-validate :  Tomcat 8.x, a web server implementing the Java 
Servlet 3.1,
...


Full details are available at:

http://vmgump.apache.org/gump/public/tomcat-trunk/tomcat-trunk-validate/index.html

That said, some information snippets are provided here.

The following annotations (debug/informational/warning/error messages) were 
provided:
 -DEBUG- Dependency on checkstyle exists, no need to add for property 
checkstyle.jar.
 -INFO- Failed with reason build failed



The following work was performed:
http://vmgump.apache.org/gump/public/tomcat-trunk/tomcat-trunk-validate/gump_work/build_tomcat-trunk_tomcat-trunk-validate.html
Work Name: build_tomcat-trunk_tomcat-trunk-validate (Type: Build)
Work ended in a state of : Failed
Elapsed: 27 secs
Command Line: /usr/lib/jvm/java-7-oracle/bin/java -Djava.awt.headless=true 
-Dbuild.sysclasspath=only org.apache.tools.ant.Main 
-Dgump.merge=/srv/gump/public/gump/work/merge.xml 
-Dcheckstyle.jar=/srv/gump/public/workspace/checkstyle/target/checkstyle-5.8-SNAPSHOT.jar
 -Dexecute.validate=true validate 
[Working Directory: /srv/gump/public/workspace/tomcat-trunk]
CLASSPATH: 
/usr/lib/jvm/java-7-oracle/lib/tools.jar:/srv/gump/public/workspace/ant/dist/lib/ant.jar:/srv/gump/public/workspace/ant/dist/lib/ant-launcher.jar:/srv/gump/public/workspace/ant/dist/lib/ant-jmf.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit4.jar:/srv/gump/public/workspace/ant/dist/lib/ant-swing.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-resolver.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-xalan2.jar:/srv/gump/public/workspace/xml-commons/java/build/resolver.jar:/srv/gump/packages/antlr/antlr-3.1.3.jar:/srv/gump/public/workspace/checkstyle/target/checkstyle-5.8-SNAPSHOT.jar:/srv/gump/public/workspace/apache-commons/beanutils/dist/commons-beanutils-20140726.jar:/srv/gump/public/workspace/apache-commons/cli/target/commons-cli-1.3-SNAPSHOT.jar:/srv/gump/public/workspace/commons-collections-3.x/target/commons-collections-3.3-SNAPSHOT.jar:/srv/gump/public/workspace/apache-commons/exec/tar
 
get/commons-exec-1.3-SNAPSHOT.jar:/srv/gump/public/workspace/apache-commons/logging/target/commons-logging-20140726.jar:/srv/gump/public/workspace/apache-commons/logging/target/commons-logging-api-20140726.jar:/srv/gump/public/workspace/apache-commons/validator/dist/commons-validator-20140726.jar:/srv/gump/public/workspace/google-guava/guava/target/guava-18.0-SNAPSHOT.jar
-
Buildfile: /srv/gump/public/workspace/tomcat-trunk/build.xml

build-prepare:
   [delete] Deleting directory 
/srv/gump/public/workspace/tomcat-trunk/output/build/temp
[mkdir] Created dir: 
/srv/gump/public/workspace/tomcat-trunk/output/build/temp

compile-prepare:

download-validate:

testexist:
 [echo] Testing  for 
/srv/gump/public/workspace/checkstyle/target/checkstyle-5.8-SNAPSHOT.jar

setproxy:

downloadzip:

validate:
[mkdir] Created dir: 
/srv/gump/public/workspace/tomcat-trunk/output/res/checkstyle
[checkstyle] Running Checkstyle 5.8-SNAPSHOT on 2905 files
[checkstyle] 
/srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java:247:17:
 File contains tab characters (this is the first instance).
[checkstyle] 
/srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug53367.java:1:
 Line does not match expected header line of '^(rem)?\W*Licensed to the Apache 
Software Foundation \(ASF\) under one or more$'.
[checkstyle] 
/srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug53367.java:6:
 Wrong order for 'org.junit.Assert' import.
[checkstyle] 
/srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug53367.java:7:
 'org.apache.tomcat.jdbc.pool.ConnectionPool' should be separated from previous 
imports.
[checkstyle] 
/srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug53367.java:11:
 Wrong order for 'org.junit.Test' import.
[checkstyle] 
/srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug53367.java:16:
 Wrong order for 'java.sql.Connection' import.
[checkstyle] 
/srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug53367.java:25:
 Wrong order for