Plans for 9.0.0.M24 / 8.5.18

2017-07-17 Thread Mark Thomas
Hi,

I plan to check that the unit tests pass for the current trunks and then
tag these. If everything goes well, this should happen later today.

Mark

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



Re: Plans for 9.0.0.M24 / 8.5.18

2017-07-17 Thread Rémy Maucherat
On Mon, Jul 17, 2017 at 9:59 AM, Mark Thomas  wrote:

> Hi,
>
> I plan to check that the unit tests pass for the current trunks and then
> tag these. If everything goes well, this should happen later today.
>
> +1

Should we continue cleaning up findbugs after that ?

Rémy


[Bug 61311] New: Invalid Exception-catching flow

2017-07-17 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61311

Bug ID: 61311
   Summary: Invalid Exception-catching flow
   Product: Tomcat 8
   Version: 8.5.13
  Hardware: PC
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: bartoszarciemow...@gmail.com
  Target Milestone: 

Request.java, lines 2876-2895:
After catching e.g. SizeException and setting the reason to POST_TOO_LARGE, in
the following finally-block the reason is set to UNKNOWN. 
So, the only reason that is ever set up is UNKNOWN.

The problem is with the if-statement in finally-block.

-- 
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 61312] New: NullPointerException in StatementCache.isCached

2017-07-17 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61312

Bug ID: 61312
   Summary: NullPointerException in StatementCache.isCached
   Product: Tomcat Modules
   Version: unspecified
  Hardware: PC
Status: NEW
  Severity: normal
  Priority: P2
 Component: jdbc-pool
  Assignee: dev@tomcat.apache.org
  Reporter: holger.su...@bodo-peters.de
  Target Milestone: ---

Hallo,

I somehow got a NPE in StatementCache.isCached method  with Apache Tomcat
8.5.14:

The private PooledConnection pcon is null in this situation:

Caused by: java.lang.NullPointerException: null
at
org.apache.tomcat.jdbc.pool.interceptor.StatementCache.isCached(StatementCache.java:202)
~[tomcat-jdbc.jar:na]
at
org.apache.tomcat.jdbc.pool.interceptor.StatementCache.invoke(StatementCache.java:175)
~[tomcat-jdbc.jar:na]
at
org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)
~[tomcat-jdbc.jar:na]
at
org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:75)
~[tomcat-jdbc.jar:na]
at
org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)
~[tomcat-jdbc.jar:na]
at
org.apache.tomcat.jdbc.pool.interceptor.ConnectionState.invoke(ConnectionState.java:152)
~[tomcat-jdbc.jar:na]
at
org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)
~[tomcat-jdbc.jar:na]
at
org.apache.tomcat.jdbc.pool.TrapException.invoke(TrapException.java:40)
~[tomcat-jdbc.jar:na]
... 136 common frames omitted

-- 
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 61311] Invalid Exception-catching flow

2017-07-17 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61311

Remy Maucherat  changed:

   What|Removed |Added

 OS||All

--- Comment #1 from Remy Maucherat  ---
I agree the algorithm looks weird.
Probably something like: if (!success && !parameters.isParseFailed()) would do
what's needed there, and set UNKNOWN only if no reason was set before.

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



Re: Plans for 9.0.0.M24 / 8.5.18

2017-07-17 Thread Mark Thomas
On 17/07/17 11:20, Rémy Maucherat wrote:
> On Mon, Jul 17, 2017 at 9:59 AM, Mark Thomas  wrote:
> 
>> Hi,
>>
>> I plan to check that the unit tests pass for the current trunks and then
>> tag these. If everything goes well, this should happen later today.
>>
> +1
> 
> Should we continue cleaning up findbugs after that ?

I thought I had fixed all of those...

Ah, I always run FindBugs from the IDE rather than the command line.
I've just run it from the command line. Ouch.

Looks like the command line is configured to report Low confidence
issues and above whereas my IDE reports Medium confidence issues and
above by default.

The first handful of issues I looked at seemed valid but of (very) low
severity so it looks like there is some work to do there :(

I'm currently thinking that I'll look at these after tagging. Given the
number of issues, it might be a couple of releases before they are all
resolved.

On a related note, I think I've found the root cause of some of the
intermittent HTTP/2 test failures. I'm investigating a possible fix.

Of course, there is nothing stopping anyone starting on the FindBugs
issues now if they feel the urge to scratch that itch.

Mark

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



JDK 9 EA Build 178 & JDK 8u152 b05 are available on jdk.java.net

2017-07-17 Thread Rory O'Donnell

Hi Mark, *
*

*JDK 9 Early Access*  build 178  is available at : - jdk.java.net/9/

A summary of all the changes in this build are listed here 
.


Changes which were introduced since the last availability email that may 
be of interest :


 * b175 - Module system implementation refresh**(6/2017 update)
 * b175 - no longer has "-ea" in the version string and the system
   property "java version" is now simply "9"
 o

   *java -version*

>java version "9"
>Java(TM) SE Runtime Environment (build 9+175)
>Java HotSpot(TM) 64-Bit Server VM (build 9+175, mixed mode)
 o

   *Bundle name changes:*  e.g. jdk-9+175_linux-x86_bin.tar.gz


*JDK 8u152 Early Access*  build 05 is available at : - jdk.java.net/8/ 



A summary of all the changes in this build are listed here 
.


Rgds,Rory

--
Rgds,Rory O'Donnell
Quality Engineering Manager
Oracle EMEA , Dublin, Ireland



Re: Plans for 9.0.0.M24 / 8.5.18

2017-07-17 Thread Rémy Maucherat
On Mon, Jul 17, 2017 at 1:43 PM, Mark Thomas  wrote:

> On 17/07/17 11:20, Rémy Maucherat wrote:
> > On Mon, Jul 17, 2017 at 9:59 AM, Mark Thomas  wrote:
> >
> >> Hi,
> >>
> >> I plan to check that the unit tests pass for the current trunks and then
> >> tag these. If everything goes well, this should happen later today.
> >>
> > +1
> >
> > Should we continue cleaning up findbugs after that ?
>
> I thought I had fixed all of those...
>
> Ah, I always run FindBugs from the IDE rather than the command line.
> I've just run it from the command line. Ouch.
>
> Looks like the command line is configured to report Low confidence
> issues and above whereas my IDE reports Medium confidence issues and
> above by default.
>
> The first handful of issues I looked at seemed valid but of (very) low
> severity so it looks like there is some work to do there :(
>
> I'm currently thinking that I'll look at these after tagging. Given the
> number of issues, it might be a couple of releases before they are all
> resolved.
>

I was looking at the report produced from the command line. Coty was
looking at beginner stuff, so there's plenty of that here (when the issues
are valid enough) :)

>
> On a related note, I think I've found the root cause of some of the
> intermittent HTTP/2 test failures. I'm investigating a possible fix.
>
> Of course, there is nothing stopping anyone starting on the FindBugs
> issues now if they feel the urge to scratch that itch.
>
> Rémy


[Bug 61313] New: JNDIRealm LDAP server failover to alternateURL takes very long 15m32s

2017-07-17 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61313

Bug ID: 61313
   Summary: JNDIRealm LDAP server failover to alternateURL takes
very long 15m32s
   Product: Tomcat 8
   Version: 8.5.16
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: peter.malo...@brockmann-consult.de
  Target Milestone: 

Created attachment 35146
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35146&action=edit
my hacky patch

I have worked with ‎csutherl‎ on #tomcat on irc.freenode.net who decided this
is a bug and should be reported here rather than the ML.

JDK version tested was oracle JDK 1.8.0_66.

I have set connectionURL and alternateURL to try to get LDAP server failover to
work.

If both servers are up, it "works well".
If only the connectionURL server is down (firewall is set to REJECT) then a
newly restarted tomcat works fine, but if it goes down while tomcat is already
running, the next LDAP lookup takes 15m32s.
If only the alternateURL server is down (firewall is set to REJECT) then a
newly restarted tomcat works fine, but if it goes down while tomcat is already
running, and the connectionURL server was down before but up again now (so the
JNDIRealm's instance variable "context" is currently set using alternateURL)
the next LDAP lookup takes 15m32s.

Setting connectionTimeout has no effect on the time. I have verified it ends up
in the Hashtable returned by getDirectoryContextEnvironment().

And if I apply my hacky patch (attached, applies to tomcat85 git repo, tag
TOMCAT_8_5_16) for the method "JNDIRealm.open()" so it works like a fresh
tomcat startup, and never returns the old context (closes it and sets it to
null, then lets the rest of the code run), it always "works well", taking 4-7s
on a fresh tomcat, or less than 0.1s on a warmed up tomcat.

server.xml snippets:




ldap://auth1:389";
connectionTimeout="1000"
connectionAttempt="0"
alternateURL="ldap://auth2:389";
userPattern="uid={0},ou=People,dc=example,dc=com"
userRoleAttribute="gidNumber"
roleBase="ou=Group,dc=example,dc=com"
roleName="cn"
roleSearch="(|(gidNumber={2})(memberUid={1}))"
/>

an example webapp that can be used for testing is attached

firewall test code (assuming otherwise blank firewall with policy ACCEPT):
t() { iptables -D INPUT 1 ; iptables -I INPUT 1 -p tcp -s 10.3.0.21 -j "$1"
; iptables -nvL; }

# run this on machines that should work
t LOG
# run this on machines that should fail
t REJECT

the test:
# prerequisite for the test is a server named "auth1" and another "auth2"
which run on port 389. In our case it's slapd, and they have start_tls enabled
but not required.
# on both LDAP servers:
t LOG

# then start tomcat, then
# on the first LDAP server:
t REJECT

# on a test machine (content of the user and password here shouldn't
matter... we aren't testing authentication, only time taken)
time curl --user someuser:somepassword
http://exampledomain:8080/dummy-service/test/ldap

(ignore response, but look at time taken)

result:
Almost always takes 15m32.4s plus up to 4s or so, but usually within a few
ms.
When it "works well" (described in detail above), the first run takes about
4-7s, and after that it takes around 0.02s to 0.1s.

expected:
It should always be quick, within some small multiple of the connection
timeout, preferrably 1x. So in this case, it should take about 1s extra, or at
most a few seconds, so 1.1s on a warmed up tomcat.

Side comment: other LDAP clients support an arbitrary number of urls, or one
line with all the urls together... I find it limiting to have only 2 that you
can set here. We have 3 LDAP servers.

-- 
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 61313] JNDIRealm LDAP server failover to alternateURL takes very long 15m32s

2017-07-17 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61313

--- Comment #1 from Peter  ---
Created attachment 35147
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35147&action=edit
an example webapp that can be used for testing

If it says "The origin server did not find a current representation for the
target resource or is not willing to disclose that one exists." that's fine...
it just means the user doesn't exist or something, but it got to the LDAP
server. I have verified it is fast with my patch and slow without it.

If it says "The request has not been applied because it lacks valid
authentication credentials for the target resource." it means it can't contact
any LDAP server, which is probably fine as long as it's fast. I verified that
it's fast with my patch and slow without it.

-- 
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 61313] JNDIRealm LDAP server failover to alternateURL takes very long 15m32s

2017-07-17 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61313

Felix Schumacher  changed:

   What|Removed |Added

  Attachment #35146|0   |1
is obsolete||

--- Comment #2 from Felix Schumacher  ---
Created attachment 35148
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35148&action=edit
Add an option to set a read timeout to ldap connections used by JNDI Realm

Java LDAP API seems to have an option for read timeouts. This should shorten
the timeouts that you see when the firewall looses the connection state and
starts dropping the packets.

I haven't tested the patch yet and I think it would be even better to have an
timeout on connections that aren't used for a long time, too. If the LDAP API
has no such timeout, we could emulate it by keeping a timestamp up to date in
close and open calls.

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



svn commit: r1802195 - in /tomcat/trunk: java/org/apache/coyote/http2/ test/org/apache/coyote/http2/ webapps/docs/

2017-07-17 Thread markt
Author: markt
Date: Mon Jul 17 19:33:11 2017
New Revision: 1802195

URL: http://svn.apache.org/viewvc?rev=1802195&view=rev
Log:
Improve the handling of HTTP/2 stream resets due to excessive headers when a 
continuation frame is used.

Modified:
tomcat/trunk/java/org/apache/coyote/http2/HeaderSink.java
tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java
tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java
tomcat/trunk/java/org/apache/coyote/http2/Stream.java
tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
tomcat/trunk/test/org/apache/coyote/http2/TestHpack.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/coyote/http2/HeaderSink.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/HeaderSink.java?rev=1802195&r1=1802194&r2=1802195&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http2/HeaderSink.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/HeaderSink.java Mon Jul 17 
19:33:11 2017
@@ -34,4 +34,11 @@ class HeaderSink implements HeaderEmitte
 public void validateHeaders() throws StreamException {
 // NO-OP
 }
+
+@Override
+public void setHeaderException(StreamException streamException) {
+// NO-OP
+// The connection is already closing so no need to process additional
+// errors
+}
 }

Modified: tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java?rev=1802195&r1=1802194&r2=1802195&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java Mon Jul 17 
19:33:11 2017
@@ -356,6 +356,16 @@ public class HpackDecoder {
 void emitHeader(String name, String value) throws HpackException;
 
 /**
+ * Inform the recipient of the headers that a stream error needs to be
+ * triggered using the given message when {@link #validateHeaders()} is
+ * called. This is used when the Parser becomes aware of an error that
+ * is not visible to the recipient.
+ *
+ * @param streamException The exception to use when resetting the 
stream
+ */
+void setHeaderException(StreamException streamException);
+
+/**
  * Are the headers pass to the recipient so far valid? The decoder 
needs
  * to process all the headers to maintain state even if there is a
  * problem. In addition, it is easy for the the intended recipient to

Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java?rev=1802195&r1=1802194&r2=1802195&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java Mon Jul 17 
19:33:11 2017
@@ -45,7 +45,6 @@ class Http2Parser {
 ByteBuffer.allocate(Constants.DEFAULT_HEADER_READ_BUFFER_SIZE);
 private volatile int headersCurrentStream = -1;
 private volatile boolean headersEndStream = false;
-private volatile boolean streamReset = false;
 
 Http2Parser(String connectionId, Input input, Output output) {
 this.connectionId = connectionId;
@@ -379,8 +378,8 @@ class Http2Parser {
 readHeaderPayload(streamId, payloadSize);
 
 if (Flags.isEndOfHeaders(flags)) {
-onHeadersComplete(streamId);
 headersCurrentStream = -1;
+onHeadersComplete(streamId);
 }
 }
 
@@ -427,16 +426,18 @@ class Http2Parser {
 headerReadBuffer.compact();
 remaining -= toRead;
 
-if (hpackDecoder.isHeaderCountExceeded() && !streamReset) {
-streamReset = true;
-throw new 
StreamException(sm.getString("http2Parser.headerLimitCount", connectionId,
-Integer.valueOf(streamId)), 
Http2Error.ENHANCE_YOUR_CALM, streamId);
+if (hpackDecoder.isHeaderCountExceeded()) {
+StreamException headerException = new 
StreamException(sm.getString(
+"http2Parser.headerLimitCount", connectionId, 
Integer.valueOf(streamId)),
+Http2Error.ENHANCE_YOUR_CALM, streamId);
+
hpackDecoder.getHeaderEmitter().setHeaderException(headerException);
 }
 
-if (hpackDecoder.isHeaderSizeExceeded(headerReadBuffer.position()) 
&& !streamReset) {
-streamReset = true;
-throw new 
StreamException(sm.getString("http

Re: Plans for 9.0.0.M24 / 8.5.18

2017-07-17 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Rémy,

On 7/17/17 8:41 AM, Rémy Maucherat wrote:
> On Mon, Jul 17, 2017 at 1:43 PM, Mark Thomas 
> wrote:
> 
>> On 17/07/17 11:20, Rémy Maucherat wrote:
>>> On Mon, Jul 17, 2017 at 9:59 AM, Mark Thomas 
>>> wrote:
>>> 
 Hi,
 
 I plan to check that the unit tests pass for the current
 trunks and then tag these. If everything goes well, this
 should happen later today.
 
>>> +1
>>> 
>>> Should we continue cleaning up findbugs after that ?
>> 
>> I thought I had fixed all of those...
>> 
>> Ah, I always run FindBugs from the IDE rather than the command
>> line. I've just run it from the command line. Ouch.
>> 
>> Looks like the command line is configured to report Low
>> confidence issues and above whereas my IDE reports Medium
>> confidence issues and above by default.
>> 
>> The first handful of issues I looked at seemed valid but of
>> (very) low severity so it looks like there is some work to do
>> there :(
>> 
>> I'm currently thinking that I'll look at these after tagging.
>> Given the number of issues, it might be a couple of releases
>> before they are all resolved.
>> 
> 
> I was looking at the report produced from the command line. Coty
> was looking at beginner stuff, so there's plenty of that here (when
> the issues are valid enough) :)

There are a lot of things in the Coverty scan, too -- many of which
are either non-issues or false-positives.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJZbRO7AAoJEBzwKT+lPKRYPZ8QALSPEQrECeNITwuMD1h4bS3T
9KRv+Gterxv5UEQIbb95DZsFTSMDCCYqxl2dnoruCay/AZekUuEmYQP30ot+yQ13
2OhL3/3WiKsG5HhQFl2ZbKjqOz9YK59xddSjRFtm0McKveNvWx5dHrz7G4DoFYfc
Sxbq9Giqh19g9lL7XJHlOyCEkATQ2kst3eS7qViqO4k/HDMdiW+5tQoODyIkhMfK
dZUNe5sMD6dVHguxCYKlAulFco6Lov1+h154J+O4gMO6dpi384oL7+DJ7qWMrBV/
AJEoiyR/RNaxg+yneUMUh9oYKTcgU8AabXlpmGo8tJ2V6HPSMtY8jKh+kH08nS67
O6PjG5dwjmdr6mHDfG2hYJgvUKW1R73S2Xv35zwAqT9wl0L/sa5yiCU8DjzCw6Nc
pIIr4HwPfBEJdW8PuWjwlWnv0jackKwMxatTjTATIGdwwaq7qYy4rf337b5QcHUu
PAC45pmtc+pvZAwzeEEUuOadIvWTQceFpM/zkiZsM5ld87DwAVJ4sZ8UcXaaWfhq
2vfpnxFsCg3kNNKAfcRjXcJEO2FEBZkMxy4wt3c4053+lo9MzTUDRPaBFSLV/Cz7
7OniJ69/Dr/w8k4AySTjPI1QNHdiITHkG0UPhWz54xEbY4GyvOmOh1VW/of/uBfT
kUy/ciR18T2WgwmvWrCx
=1x7M
-END PGP SIGNATURE-

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



svn commit: r1802204 - /tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java

2017-07-17 Thread markt
Author: markt
Date: Mon Jul 17 19:59:07 2017
New Revision: 1802204

URL: http://svn.apache.org/viewvc?rev=1802204&view=rev
Log:
Handle earlier visibility of closed connection on some platforms.

Modified:
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java

Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java?rev=1802204&r1=1802203&r2=1802204&view=diff
==
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java Mon Jul 17 
19:59:07 2017
@@ -17,6 +17,7 @@
 package org.apache.coyote.http2;
 
 import java.io.IOException;
+import java.net.SocketException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
@@ -250,10 +251,16 @@ public class TestHttp2Limits extends Htt
 }
 case CONNECTION_RESET: {
 // Connection reset. Connection ID will vary so use a pattern
-parser.readFrame(true);
-Assert.assertThat(output.getTrace(), RegexMatcher.matchesRegex(
-"0-Goaway-\\[1\\]-\\[11\\]-\\[Connection \\[\\d++\\], 
Stream \\[3\\], .*"));
-// e may or may not be null here
+// On some platforms (e.g. Windows), the TCP connection close will
+// be processed before the client gets a chance to read the
+// connection close frame
+try {
+parser.readFrame(true);
+Assert.assertThat(output.getTrace(), RegexMatcher.matchesRegex(
+"0-Goaway-\\[1\\]-\\[11\\]-\\[Connection \\[\\d++\\], 
Stream \\[3\\], .*"));
+} catch (SocketException se) {
+// Expected on Windows
+}
 break;
 }
 }



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



svn commit: r1802205 - /tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java

2017-07-17 Thread markt
Author: markt
Date: Mon Jul 17 20:00:15 2017
New Revision: 1802205

URL: http://svn.apache.org/viewvc?rev=1802205&view=rev
Log:
Better comment

Modified:
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java

Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java?rev=1802205&r1=1802204&r2=1802205&view=diff
==
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java Mon Jul 17 
20:00:15 2017
@@ -251,9 +251,9 @@ public class TestHttp2Limits extends Htt
 }
 case CONNECTION_RESET: {
 // Connection reset. Connection ID will vary so use a pattern
-// On some platforms (e.g. Windows), the TCP connection close will
-// be processed before the client gets a chance to read the
-// connection close frame
+// On some platform / Connector combinations (e.g. Windows / APR),
+// the TCP connection close will be processed before the client 
gets
+// a chance to read the connection close frame
 try {
 parser.readFrame(true);
 Assert.assertThat(output.getTrace(), RegexMatcher.matchesRegex(



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



svn commit: r1802210 - in /tomcat/trunk/test/org/apache/coyote/http2: TestHttp2Section_4_2.java TestHttp2Section_5_1.java TestHttp2Section_6_2.java

2017-07-17 Thread markt
Author: markt
Date: Mon Jul 17 20:53:20 2017
New Revision: 1802210

URL: http://svn.apache.org/viewvc?rev=1802210&view=rev
Log:
Add handling for are now, hopefully, consistent connection reset results for 
NIO2 on Windows.

Modified:
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_2.java

Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java?rev=1802210&r1=1802209&r2=1802210&view=diff
==
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java 
(original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java Mon Jul 
17 20:53:20 2017
@@ -16,9 +16,15 @@
  */
 package org.apache.coyote.http2;
 
+import java.net.SocketException;
+
 import org.junit.Assert;
+import org.junit.Assume;
 import org.junit.Test;
 
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.startup.Tomcat;
+
 /**
  * Unit tests for Section 4.2 of
  * https://tools.ietf.org/html/rfc7540";>RFC 7540.
@@ -55,11 +61,22 @@ public class TestHttp2Section_4_2 extend
 
 os.write(settings);
 
-// Read GOAWAY frame
-parser.readFrame(true);
+try {
+// Read GOAWAY frame
+parser.readFrame(true);
+
+Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
+"0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + 
"]-["));
+} catch (SocketException se) {
+// On some platform / Connector combinations (e.g. Windows / NIO2),
+// the TCP connection close will be processed before the client 
gets
+// a chance to read the connection close frame.
+Tomcat tomcat = getTomcatInstance();
+Connector connector = tomcat.getConnector();
 
-Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
-"0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + 
"]-["));
+Assume.assumeTrue("This test is only expected to trigger an 
exception with NIO2",
+connector.getProtocolHandlerClassName().contains("Nio2"));
+}
 }
 
 @Test

Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_1.java?rev=1802210&r1=1802209&r2=1802210&view=diff
==
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
(original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_1.java Mon Jul 
17 20:53:20 2017
@@ -16,11 +16,16 @@
  */
 package org.apache.coyote.http2;
 
+import java.net.SocketException;
 import java.nio.ByteBuffer;
 
 import org.junit.Assert;
+import org.junit.Assume;
 import org.junit.Test;
 
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.startup.Tomcat;
+
 /**
  * Unit tests for Section 5.§ of
  * https://tools.ietf.org/html/rfc7540";>RFC 7540.
@@ -135,11 +140,22 @@ public class TestHttp2Section_5_1 extend
 buildSimpleGetRequestPart1(frameHeader, headersPayload, 4);
 writeFrame(frameHeader, headersPayload);
 
-// headers
-parser.readFrame(true);
-
-Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
-"0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + 
"]-["));
+try {
+// headers
+parser.readFrame(true);
+
+Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
+"0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + 
"]-["));
+} catch (SocketException se) {
+// On some platform / Connector combinations (e.g. Windows / NIO2),
+// the TCP connection close will be processed before the client 
gets
+// a chance to read the connection close frame.
+Tomcat tomcat = getTomcatInstance();
+Connector connector = tomcat.getConnector();
+
+Assume.assumeTrue("This test is only expected to trigger an 
exception with NIO2",
+connector.getProtocolHandlerClassName().contains("Nio2"));
+}
 }
 
 

Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_2.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_2.java?rev=1802210&r1=1802209&r2=1802210&view=diff
==
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_2.java 
(original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Sec

svn commit: r1802225 - /tomcat/trunk/test/org/apache/coyote/http2/

2017-07-17 Thread markt
Author: markt
Date: Mon Jul 17 22:12:53 2017
New Revision: 1802225

URL: http://svn.apache.org/viewvc?rev=1802225&view=rev
Log:
Connection reset exceptions are not consistent. Roll out special handling for 
Windows + NIO2 more widely.

Modified:
tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_3.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_5.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_1.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_2.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_3.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_4.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_5.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_7.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_9.java

Modified: tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==
--- tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java Mon Jul 17 
22:12:53 2017
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.Socket;
+import java.net.SocketException;
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
@@ -36,6 +37,7 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.junit.Assert;
+import org.junit.Assume;
 
 import org.apache.catalina.Context;
 import org.apache.catalina.LifecycleException;
@@ -805,6 +807,34 @@ public abstract class Http2TestBase exte
 }
 
 
+void handleGoAwayResponse(int lastStream) throws Http2Exception, 
IOException {
+handleGoAwayResponse(lastStream, Http2Error.PROTOCOL_ERROR);
+}
+
+
+void handleGoAwayResponse(int lastStream, Http2Error expectedError)
+throws Http2Exception, IOException {
+try {
+parser.readFrame(true);
+
+Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
+"0-Goaway-[" + lastStream + "]-[" + 
expectedError.getCode() + "]-["));
+} catch (SocketException se) {
+// On some platform / Connector combinations (e.g. Windows / NIO2),
+// the TCP connection close will be processed before the client 
gets
+// a chance to read the connection close frame.
+Tomcat tomcat = getTomcatInstance();
+Connector connector = tomcat.getConnector();
+
+Assume.assumeTrue("This test is only expected to trigger an 
exception with NIO2",
+connector.getProtocolHandlerClassName().contains("Nio2"));
+
+Assume.assumeTrue("This test is only expected to trigger an 
exception on Windo9ws",
+System.getProperty("os.name").startsWith("Windows"));
+}
+}
+
+
 static void setOneBytes(byte[] output, int firstByte, int value) {
 output[firstByte] = (byte) (value & 0xFF);
 }

Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java 
(original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java Mon Jul 
17 22:12:53 2017
@@ -16,15 +16,9 @@
  */
 package org.apache.coyote.http2;
 
-import java.net.SocketException;
-
 import org.junit.Assert;
-import org.junit.Assume;
 import org.junit.Test;
 
-import org.apache.catalina.connector.Connector;
-import org.apache.catalina.startup.Tomcat;
-
 /**
  * Unit tests for Section 4.2 of
  * https://tools.ietf.org/html/rfc7540";>RFC 7540.
@@ -61,22 +55,7 @@ public class TestHttp2Section_4_2 extend
 
 os.write(settings);
 
-try {
-// Read GOAWAY frame
-parser.readFrame(true);
-
-Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
-"0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + 
"]-["));
-} catch (SocketException se) {
-// On some platform / Connector combinations (e.g. Windows / NIO2),
-// the TCP connection close will be processed before 

[Bug 61311] Invalid Exception-catching flow

2017-07-17 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61311

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from Mark Thomas  ---
It looks weird but it is correct. The implementation of setParseFailedReason()
only updates the reason if no reason is set.

A more efficient finally block is almost certainly possible but the current
code is intended to be robust with respect to changes in the rest of the
method.

I'll add a comment for future reference.

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



svn commit: r1802226 - /tomcat/trunk/java/org/apache/catalina/connector/Request.java

2017-07-17 Thread markt
Author: markt
Date: Mon Jul 17 22:42:16 2017
New Revision: 1802226

URL: http://svn.apache.org/viewvc?rev=1802226&view=rev
Log:
Add clarifying comment

Modified:
tomcat/trunk/java/org/apache/catalina/connector/Request.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=1802226&r1=1802225&r2=1802226&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Mon Jul 17 
22:42:16 2017
@@ -2857,6 +2857,10 @@ public class Request implements HttpServ
 partsParseException = e;
 }
 } finally {
+// This might look odd but is correct. setParseFailedReason() only
+// sets the failure reason if none is currently set. This code 
could
+// be more efficient but it is written this way to be robust with
+// respect to changes in the remainder of the method.
 if (partsParseException != null || !success) {
 parameters.setParseFailedReason(FailReason.UNKNOWN);
 }



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



[Bug 61313] JNDIRealm LDAP server failover to alternateURL takes very long 15m32s

2017-07-17 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61313

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |NEEDINFO

--- Comment #3 from Mark Thomas  ---
Please test Felix's proposed patch and report back.

Note: if it works, the documentation will need to be updated as well.

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



buildbot failure in on tomcat-trunk

2017-07-17 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-trunk while building 
. Full details are available at:
https://ci.apache.org/builders/tomcat-trunk/builds/2551

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch tomcat/trunk] 1802226
Blamelist: markt

BUILD FAILED: failed compile_1

Sincerely,
 -The Buildbot




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



svn commit: r1802229 - /tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java

2017-07-17 Thread markt
Author: markt
Date: Mon Jul 17 23:22:02 2017
New Revision: 1802229

URL: http://svn.apache.org/viewvc?rev=1802229&view=rev
Log:
Another NIO2 robustness change

Modified:
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java

Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java?rev=1802229&r1=1802228&r2=1802229&view=diff
==
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java Mon Jul 17 
23:22:02 2017
@@ -487,8 +487,15 @@ public class TestHttp2Limits extends Htt
 break;
 }
 case CONNECTION_RESET: {
-// Connection reset. Connection ID will vary so use a pattern
-parser.readFrame(true);
+// Connection reset
+do {
+// NIO2 can sometimes send window updates depending on the
+// timing of the connection close
+output.clearTrace();
+parser.readFrame(true);
+} while (output.getTrace().contains("WindowSize"));
+
+// Connection ID will vary so use a pattern
 Assert.assertThat(output.getTrace(), RegexMatcher.matchesRegex(
 "0-Goaway-\\[3\\]-\\[11\\]-\\[Connection \\[\\d++\\], 
Stream \\[3\\], .*"));
 break;



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



buildbot success in on tomcat-trunk

2017-07-17 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-trunk while 
building . Full details are available at:
https://ci.apache.org/builders/tomcat-trunk/builds/2552

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch tomcat/trunk] 1802229
Blamelist: markt

Build succeeded!

Sincerely,
 -The Buildbot




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