[tomcat] branch master updated: Fix test which would also match NIO2

2021-02-08 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new b02e7fd  Fix test which would also match NIO2
b02e7fd is described below

commit b02e7fddf65440699cb66211a584cfe63fce8e3f
Author: remm 
AuthorDate: Mon Feb 8 11:24:59 2021 +0100

Fix test which would also match NIO2
---
 test/org/apache/tomcat/util/net/TestXxxEndpoint.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/org/apache/tomcat/util/net/TestXxxEndpoint.java 
b/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
index bc9b1f3..d77132f 100644
--- a/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
+++ b/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
@@ -217,7 +217,7 @@ public class TestXxxEndpoint extends TomcatBaseTest {
 Tomcat tomcat = getTomcatInstance();
 Connector c = tomcat.getConnector();
 Assume.assumeTrue("NIO Unix domain sockets have to be supported for 
this test",
-c.getProtocolHandlerClassName().contains("Nio")
+c.getProtocolHandlerClassName().contains("NioProtocol")
 && JreCompat.isJre16Available());
 
 final String unixDomainSocketPath = "/tmp/testUnixDomainSocket";


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



[tomcat] branch master updated: Fix test failure when running under cobertura

2021-02-02 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 5e719fe  Fix test failure when running under cobertura
5e719fe is described below

commit 5e719fec5b04676b79a4e57d1f55c1732d8323a2
Author: Mark Thomas 
AuthorDate: Tue Feb 2 17:56:30 2021 +

Fix test failure when running under cobertura
---
 test/org/apache/catalina/loader/TestVirtualWebappLoader.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/org/apache/catalina/loader/TestVirtualWebappLoader.java 
b/test/org/apache/catalina/loader/TestVirtualWebappLoader.java
index 11d840e..8a158a9 100644
--- a/test/org/apache/catalina/loader/TestVirtualWebappLoader.java
+++ b/test/org/apache/catalina/loader/TestVirtualWebappLoader.java
@@ -54,6 +54,8 @@ public class TestVirtualWebappLoader extends TomcatBaseTest {
 loader.setContext(ctx);
 ctx.setLoader(loader);
 
+ctx.setResources(new StandardRoot(ctx));
+ctx.resourcesStart();
 
 loader.start();
 Assert.assertSame(cl, loader.getClassLoader());


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



[tomcat] branch master updated: Fix test broken by BZ 56181

2020-11-26 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new abab1a4  Fix test broken by BZ 56181
abab1a4 is described below

commit abab1a48e0d4bab8a1508a88aa09cf72d2e20e7d
Author: Mark Thomas 
AuthorDate: Thu Nov 26 21:10:54 2020 +

Fix test broken by BZ 56181
---
 test/org/apache/catalina/valves/TestRemoteIpValve.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/catalina/valves/TestRemoteIpValve.java 
b/test/org/apache/catalina/valves/TestRemoteIpValve.java
index 286a18c..e95b30b 100644
--- a/test/org/apache/catalina/valves/TestRemoteIpValve.java
+++ b/test/org/apache/catalina/valves/TestRemoteIpValve.java
@@ -28,6 +28,7 @@ import org.junit.Test;
 
 import org.apache.catalina.AccessLog;
 import org.apache.catalina.Globals;
+import org.apache.catalina.connector.Connector;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 
@@ -94,7 +95,7 @@ public class TestRemoteIpValve {
 public static class MockRequest extends Request {
 
 public MockRequest() {
-super(null);
+super(new Connector());
 }
 
 @Override


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



[tomcat] branch master updated: Fix test failure - don't try and connect to an i/f that is down

2020-10-01 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 127e85e  Fix test failure - don't try and connect to an i/f that is 
down
127e85e is described below

commit 127e85e7b3989701ced95ccc1f4793112b92e38f
Author: Mark Thomas 
AuthorDate: Thu Oct 1 14:15:49 2020 +0100

Fix test failure - don't try and connect to an i/f that is down
---
 .../jni/TestSocketServerAnyLocalAddress.java   | 30 --
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java 
b/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java
index 0023db2..c983608 100644
--- a/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java
+++ b/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java
@@ -182,21 +182,23 @@ public class TestSocketServerAnyLocalAddress extends 
AbstractJniTest {
 Enumeration networkInterfaces = 
NetworkInterface.getNetworkInterfaces();
 while (networkInterfaces.hasMoreElements()) {
 NetworkInterface networkInterface = 
networkInterfaces.nextElement();
-Enumeration inetAddresses = 
networkInterface.getInetAddresses();
-while (inetAddresses.hasMoreElements()) {
-InetAddress inetAddress = inetAddresses.nextElement();
-if 
(localAddress.getAddress().getClass().isAssignableFrom(inetAddress.getClass())) 
{
-if (inetAddress.isLoopbackAddress()) {
-if (loopbackConnectAddress == null) {
-loopbackConnectAddress = inetAddress;
+if (networkInterface.isUp()) {
+Enumeration inetAddresses = 
networkInterface.getInetAddresses();
+while (inetAddresses.hasMoreElements()) {
+InetAddress inetAddress = inetAddresses.nextElement();
+if 
(localAddress.getAddress().getClass().isAssignableFrom(inetAddress.getClass())) 
{
+if (inetAddress.isLoopbackAddress()) {
+if (loopbackConnectAddress == null) {
+loopbackConnectAddress = inetAddress;
+}
+} else if (inetAddress.isLinkLocalAddress()) {
+if (linkLocalConnectAddress == null) {
+linkLocalConnectAddress = inetAddress;
+}
+} else {
+// Use a non-link local, non-loop back address 
by default
+return new InetSocketAddress(inetAddress, 
localAddress.getPort());
 }
-} else if (inetAddress.isLinkLocalAddress()) {
-if (linkLocalConnectAddress == null) {
-linkLocalConnectAddress = inetAddress;
-}
-} else {
-// Use a non-link local, non-loop back address by 
default
-return new InetSocketAddress(inetAddress, 
localAddress.getPort());
 }
 }
 }


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



[tomcat] branch master updated: Fix test

2019-11-19 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 9d7cb54  Fix test
9d7cb54 is described below

commit 9d7cb5468fbf2df4709c222b472bd86a26c9d4b6
Author: remm 
AuthorDate: Tue Nov 19 23:25:09 2019 +0100

Fix test
---
 test/org/apache/catalina/filters/TestCsrfPreventionFilter.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/org/apache/catalina/filters/TestCsrfPreventionFilter.java 
b/test/org/apache/catalina/filters/TestCsrfPreventionFilter.java
index 6d0c81d..1e74313 100644
--- a/test/org/apache/catalina/filters/TestCsrfPreventionFilter.java
+++ b/test/org/apache/catalina/filters/TestCsrfPreventionFilter.java
@@ -37,7 +37,7 @@ public class TestCsrfPreventionFilter extends TomcatBaseTest {
 
 private final HttpServletResponse wrapper =
 new CsrfPreventionFilter.CsrfResponseWrapper(
-new NonEncodingResponse(), "TESTNONCE");
+new NonEncodingResponse(), 
Constants.CSRF_NONCE_SESSION_ATTR_NAME, "TESTNONCE");
 
 @Test
 public void testAddNonceNoQueryNoAnchor() throws Exception {


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



Re: [tomcat] branch master updated: Fix test fallout of BZ 63905

2019-11-13 Thread Michael Osipov

Am 2019-11-13 um 17:48 schrieb Christopher Schultz:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Michael,

On 11/9/19 05:58, micha...@apache.org wrote:

This is an automated email from the ASF dual-hosted git
repository.

michaelo pushed a commit to branch master in repository
https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this
push: new ccd6518  Fix test fallout of BZ 63905 ccd6518 is
described below

commit ccd6518024ab4f8c0add42eb2b20941a6b237f5d Author: Michael
Osipov  AuthorDate: Sat Nov 9 11:35:22 2019
+0100

Fix test fallout of BZ 63905 ---
test/org/apache/coyote/http2/TestHttp2InitialConnection.java | 2
+- 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git
a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
index 2157eae..a362a19 100644 ---
a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java +++
b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java @@
-127,7 +127,7 @@ public class TestHttp2InitialConnection extends
Http2TestBase { int statusHeaderLength = sm
.getString("errorReportValve.statusHeader", "", "")
.getBytes(StandardCharsets.UTF_8).length; -int len =
1073 + serverInfoLength + statusHeaderLength * 2; +int
len = 708 + serverInfoLength + statusHeaderLength * 2;


Why not fix this properly with:

int len =
org.apache.catalina.util.TomcatCSS.TOMCAT_CSS.getBytes(StandardCharsets.
UTF_8).length
+ serverInfoLength + statusHeaderLength * 2;

??

It's just going to happen again when someone changes the CSS.


I have now pushed a change which should address this properly.


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



Re: [tomcat] branch master updated: Fix test fallout of BZ 63905

2019-11-13 Thread Michael Osipov

Am 2019-11-13 um 17:48 schrieb Christopher Schultz:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Michael,

On 11/9/19 05:58, micha...@apache.org wrote:

This is an automated email from the ASF dual-hosted git
repository.

michaelo pushed a commit to branch master in repository
https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this
push: new ccd6518  Fix test fallout of BZ 63905 ccd6518 is
described below

commit ccd6518024ab4f8c0add42eb2b20941a6b237f5d Author: Michael
Osipov  AuthorDate: Sat Nov 9 11:35:22 2019
+0100

Fix test fallout of BZ 63905 ---
test/org/apache/coyote/http2/TestHttp2InitialConnection.java | 2
+- 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git
a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
index 2157eae..a362a19 100644 ---
a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java +++
b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java @@
-127,7 +127,7 @@ public class TestHttp2InitialConnection extends
Http2TestBase { int statusHeaderLength = sm
.getString("errorReportValve.statusHeader", "", "")
.getBytes(StandardCharsets.UTF_8).length; -int len =
1073 + serverInfoLength + statusHeaderLength * 2; +int
len = 708 + serverInfoLength + statusHeaderLength * 2;


Why not fix this properly with:

int len =
org.apache.catalina.util.TomcatCSS.TOMCAT_CSS.getBytes(StandardCharsets.
UTF_8).length
+ serverInfoLength + statusHeaderLength * 2;

??


Thanks for raising, but simply this won't work. You have to calculate 
the length of:



HTTP Status 400 – Bad Requestbody {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 
{font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}HTTP Status 400 – Bad RequestType Status ReportDescription The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, 
invalid request message framing, or deceptive request routing).Apache Tomcat/9.0.x-dev


What confuses me here for the test, why is

> sm.getString("errorReportValve.statusHeader", "", "")

performed instead of getting the real strings for HTTP 400?!
If you remove all calculatable bits and add them on the code, you have left:


 
 


So one should add 196 static bytes.

I will look into it.

Michael




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



Re: [tomcat] branch master updated: Fix test fallout of BZ 63905

2019-11-13 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Michael,

On 11/9/19 05:58, micha...@apache.org wrote:
> This is an automated email from the ASF dual-hosted git
> repository.
> 
> michaelo pushed a commit to branch master in repository
> https://gitbox.apache.org/repos/asf/tomcat.git
> 
> 
> The following commit(s) were added to refs/heads/master by this
> push: new ccd6518  Fix test fallout of BZ 63905 ccd6518 is
> described below
> 
> commit ccd6518024ab4f8c0add42eb2b20941a6b237f5d Author: Michael
> Osipov  AuthorDate: Sat Nov 9 11:35:22 2019
> +0100
> 
> Fix test fallout of BZ 63905 --- 
> test/org/apache/coyote/http2/TestHttp2InitialConnection.java | 2
> +- 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git
> a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
> b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java 
> index 2157eae..a362a19 100644 ---
> a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java +++
> b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java @@
> -127,7 +127,7 @@ public class TestHttp2InitialConnection extends
> Http2TestBase { int statusHeaderLength = sm 
> .getString("errorReportValve.statusHeader", "", "") 
> .getBytes(StandardCharsets.UTF_8).length; -int len =
> 1073 + serverInfoLength + statusHeaderLength * 2; +int
> len = 708 + serverInfoLength + statusHeaderLength * 2;

Why not fix this properly with:

int len =
org.apache.catalina.util.TomcatCSS.TOMCAT_CSS.getBytes(StandardCharsets.
UTF_8).length
+ serverInfoLength + statusHeaderLength * 2;

??

It's just going to happen again when someone changes the CSS.

- -chris
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl3MM/kACgkQHPApP6U8
pFhkUw//VSKrL5DFR+mtxdDlzsPmnMWYJQ6hKNfuuq6borShwI9smOIBaUmnBWWu
jmA+qWJ0zoQaWwOsc0mmixDzMO1Ck5/B5HVdWcwtSlif1YUK7MSEqlCIELkwvqgA
TYxiA6CLf4SQc7X3cipZvhqJQ+5tVBjS9Irc3tQ86p6Ojly3h83c3gAAKncYXLWO
nI07wIUI5uC8jh/s5lmq0fUcIvmWgwzU4vOEH2ZvCPDnfja5HYfp3JOMPkwUXD43
/FP/dewd/trDy2vYBu0StKn6Ft0fhVQzXCvMDzWUVdyMJGHUQ+gh3D4rCwpRs0p4
X1lI6pogK0GNE1mtokNcqtkIg6W4z8QWGyKK0i2zFsk3gaVLoV5K0Bhoao3LUvZ/
oFSJnQaYdhe7QQrftkXw0NlEdMKkt6kHVMbiV/GSlvcL8ERH8mBlyIUfEKLIb43n
3iXxaJqTnFXYjYqiRiZezZxHhB2OyEs3eCshxP4lxSXmL8HQOEHnAvwadW16xwA4
WDYaL31AeYqxl206ku2fQFCm5Lb+Gt6EEI9wHXc9g+oLgzcw8aLo4zr/0FgWq5US
TxcjgNfJqSF65a86oLvwx1BE545FPFctgck/lXVcKTVYgeDsfgr6V8S2cif0812H
3Tf5RtHVsmUEsML2+Ge3kIfObZioqCCaeBwdQxLE4NNkKHgfKzs=
=RvAv
-END PGP SIGNATURE-

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



[tomcat] branch master updated: Fix test fallout of BZ 63905

2019-11-09 Thread michaelo
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new ccd6518  Fix test fallout of BZ 63905
ccd6518 is described below

commit ccd6518024ab4f8c0add42eb2b20941a6b237f5d
Author: Michael Osipov 
AuthorDate: Sat Nov 9 11:35:22 2019 +0100

Fix test fallout of BZ 63905
---
 test/org/apache/coyote/http2/TestHttp2InitialConnection.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java 
b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
index 2157eae..a362a19 100644
--- a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
+++ b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
@@ -127,7 +127,7 @@ public class TestHttp2InitialConnection extends 
Http2TestBase {
 int statusHeaderLength = sm
 .getString("errorReportValve.statusHeader", "", "")
 .getBytes(StandardCharsets.UTF_8).length;
-int len = 1073 + serverInfoLength + statusHeaderLength * 2;
+int len = 708 + serverInfoLength + statusHeaderLength * 2;
 String contentLength = String.valueOf(len);
 return getResponseBodyFrameTrace(streamId,
 testData.getExpectedStatus(), "text/html;charset=utf-8",


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



Re: [tomcat] branch master updated: Fix test failures with APR/native.

2019-09-25 Thread Mark Thomas
On 25/09/2019 21:39, ma...@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
> 
> markt pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
> 
> 
> The following commit(s) were added to refs/heads/master by this push:
>  new bfff085  Fix test failures with APR/native.
> bfff085 is described below

My ideas with the blocking status locks didn't work as well as I hoped.
I could only fix the error if shutdown waited for all in-progress
blocking reads to complete or timeout. Given there are some WebSocket
scenarios that have very long blocking reads that didnlt seem like a
good idea.

I think the best thing to do is aim to minimise the chances of this
crash as much as practical. Given the tentative plan to remove native
I/O in Tomcat 10 I don't think it is worth spending time on the
significant refactoring that would be required for a more reliable solution.

Mark

> 
> commit bfff085526f4c3625316be311ca5b3dee41d83b3
> Author: Mark Thomas 
> AuthorDate: Wed Sep 25 21:39:30 2019 +0100
> 
> Fix test failures with APR/native.
> ---
>  test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git 
> a/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java 
> b/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
> index 86e574e..a3a22d9 100644
> --- a/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
> +++ b/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
> @@ -404,6 +404,7 @@ public class TestChunkedInputFilter extends 
> TomcatBaseTest {
>  client.connect();
>  try {
>  client.processRequest();
> +client.disconnect();
>  } catch (Exception e) {
>  // Socket was probably closed before client had a chance to read
>  // response
> 
> 
> -
> 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



[tomcat] branch master updated: Fix test failures with APR/native.

2019-09-25 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new bfff085  Fix test failures with APR/native.
bfff085 is described below

commit bfff085526f4c3625316be311ca5b3dee41d83b3
Author: Mark Thomas 
AuthorDate: Wed Sep 25 21:39:30 2019 +0100

Fix test failures with APR/native.
---
 test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java 
b/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
index 86e574e..a3a22d9 100644
--- a/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
+++ b/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
@@ -404,6 +404,7 @@ public class TestChunkedInputFilter extends TomcatBaseTest {
 client.connect();
 try {
 client.processRequest();
+client.disconnect();
 } catch (Exception e) {
 // Socket was probably closed before client had a chance to read
 // response


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



Re: [tomcat] branch master updated: Fix test failures caused by APR crash during shutdown

2019-09-20 Thread Mark Thomas
On 19/09/2019 20:39, Mark Thomas wrote:
> On 19/09/2019 19:57, ma...@apache.org wrote:
>> This is an automated email from the ASF dual-hosted git repository.
>>
>> markt pushed a commit to branch master
>> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>>
>>
>> The following commit(s) were added to refs/heads/master by this push:
>>  new 9825246  Fix test failures caused by APR crash during shutdown
>> 9825246 is described below
>>
>> commit 9825246d0ce833552a3745ac3b02a44551789caa
>> Author: Mark Thomas 
>> AuthorDate: Thu Sep 19 19:56:23 2019 +0100
>>
>> Fix test failures caused by APR crash during shutdown
>> 
>> When a request thread was still trying to read/write from/to the socket,
>> the socket wrapper was not marked as closed so the thread tried to use
>> an APR socket that the POller then closed. Trying to read/write from a
>> closed APR socket will nearly always trigger a crash.
> 
> Hmm. Maybe not as successful as I had hoped. The chances of a crash
> appear to have reduced but crashes do still occur. It looks like one
> root cause has been fixed but that there is still at least one more root
> cause to track down. I'll take another look.

Looking at this more closely, this isn't fixing a root cause it is just
altering the timing slightly - enough to reduce the chance of the issue
occurring.

I intend to revert the above fix and work on an alternative.

Mark

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



Re: [tomcat] branch master updated: Fix test failures caused by APR crash during shutdown

2019-09-19 Thread Mark Thomas
On 19/09/2019 19:57, ma...@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
> 
> markt pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
> 
> 
> The following commit(s) were added to refs/heads/master by this push:
>  new 9825246  Fix test failures caused by APR crash during shutdown
> 9825246 is described below
> 
> commit 9825246d0ce833552a3745ac3b02a44551789caa
> Author: Mark Thomas 
> AuthorDate: Thu Sep 19 19:56:23 2019 +0100
> 
> Fix test failures caused by APR crash during shutdown
> 
> When a request thread was still trying to read/write from/to the socket,
> the socket wrapper was not marked as closed so the thread tried to use
> an APR socket that the POller then closed. Trying to read/write from a
> closed APR socket will nearly always trigger a crash.

Hmm. Maybe not as successful as I had hoped. The chances of a crash
appear to have reduced but crashes do still occur. It looks like one
root cause has been fixed but that there is still at least one more root
cause to track down. I'll take another look.

Mark


> ---
>  java/org/apache/tomcat/util/net/AprEndpoint.java | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java 
> b/java/org/apache/tomcat/util/net/AprEndpoint.java
> index 46c7047..6dde69c 100644
> --- a/java/org/apache/tomcat/util/net/AprEndpoint.java
> +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
> @@ -1126,8 +1126,11 @@ public class AprEndpoint extends 
> AbstractEndpoint implements SNICallB
>  // Close all sockets in the add queue
>  info = addList.get();
>  while (info != null) {
> -// Make sure the  socket isn't in the poller before we close 
> it
> +// Make sure the socket isn't in the poller before we close 
> it
>  removeFromPoller(info.socket);
> +// Close the SocketWrapper to prevent any still running 
> application
> +// threads from trying to use the socket
> +connections.get(Long.valueOf(info.socket)).close();
>  // Poller isn't running at this point so use destroySocket()
>  // directly
>  destroySocket(info.socket);
> 
> 
> -
> 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



[tomcat] branch master updated: Fix test failures caused by APR crash during shutdown

2019-09-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 9825246  Fix test failures caused by APR crash during shutdown
9825246 is described below

commit 9825246d0ce833552a3745ac3b02a44551789caa
Author: Mark Thomas 
AuthorDate: Thu Sep 19 19:56:23 2019 +0100

Fix test failures caused by APR crash during shutdown

When a request thread was still trying to read/write from/to the socket,
the socket wrapper was not marked as closed so the thread tried to use
an APR socket that the POller then closed. Trying to read/write from a
closed APR socket will nearly always trigger a crash.
---
 java/org/apache/tomcat/util/net/AprEndpoint.java | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java 
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 46c7047..6dde69c 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -1126,8 +1126,11 @@ public class AprEndpoint extends 
AbstractEndpoint implements SNICallB
 // Close all sockets in the add queue
 info = addList.get();
 while (info != null) {
-// Make sure the  socket isn't in the poller before we close it
+// Make sure the socket isn't in the poller before we close it
 removeFromPoller(info.socket);
+// Close the SocketWrapper to prevent any still running 
application
+// threads from trying to use the socket
+connections.get(Long.valueOf(info.socket)).close();
 // Poller isn't running at this point so use destroySocket()
 // directly
 destroySocket(info.socket);


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



[tomcat] branch master updated: Fix test failure on Windows

2019-09-13 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new f3af77e  Fix test failure on Windows
f3af77e is described below

commit f3af77e465381489dafe4946bc1fe7d86bf4067a
Author: Mark Thomas 
AuthorDate: Fri Sep 13 18:05:47 2019 +0100

Fix test failure on Windows
---
 test/org/apache/coyote/http2/TestStreamProcessor.java | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/test/org/apache/coyote/http2/TestStreamProcessor.java 
b/test/org/apache/coyote/http2/TestStreamProcessor.java
index 5f9651a..a4dd5f1 100644
--- a/test/org/apache/coyote/http2/TestStreamProcessor.java
+++ b/test/org/apache/coyote/http2/TestStreamProcessor.java
@@ -35,6 +35,7 @@ import org.junit.Test;
 import org.apache.catalina.Context;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.startup.Tomcat;
+import org.apache.tomcat.util.compat.JrePlatform;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 
 public class TestStreamProcessor extends Http2TestBase {
@@ -150,11 +151,19 @@ public class TestStreamProcessor extends Http2TestBase {
 
 parser.readFrame(true);
 
-Assert.assertEquals("3-HeadersStart\n" +
-"3-Header-[:status]-[304]\n" +
-"3-Header-[etag]-[W/\"934-1447269522000\"]\n" +
-"3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-"3-HeadersEnd\n", output.getTrace());
+StringBuilder expected = new StringBuilder();
+expected.append("3-HeadersStart\n");
+expected.append("3-Header-[:status]-[304]\n");
+// Different line-endings -> different files size -> different weak 
eTag
+if (JrePlatform.IS_WINDOWS) {
+expected.append("3-Header-[etag]-[W/\"957-1447269522000\"]\n");
+} else {
+expected.append("3-Header-[etag]-[W/\"934-1447269522000\"]\n");
+}
+expected.append("3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n");
+expected.append("3-HeadersEnd\n");
+
+Assert.assertEquals(expected.toString(), output.getTrace());
 }
 
 


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



[tomcat] branch master updated: Fix test observed to fail consistently with NIO2 + Win + Java 8u212

2019-08-14 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 8a81e7a  Fix test observed to fail consistently with NIO2 + Win + Java 
8u212
8a81e7a is described below

commit 8a81e7a8db4337190464240e7e72fa3314356a40
Author: Mark Thomas 
AuthorDate: Wed Aug 14 08:24:53 2019 +0100

Fix test observed to fail consistently with NIO2 + Win + Java 8u212
---
 test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java 
b/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
index 91ec506..86e574e 100644
--- a/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
+++ b/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
@@ -392,8 +392,12 @@ public class TestChunkedInputFilter extends TomcatBaseTest 
{
 request += SimpleHttpClient.CRLF + chunks + "0" + SimpleHttpClient.CRLF
 + SimpleHttpClient.CRLF;
 
-TrailerClient client = new TrailerClient(tomcat.getConnector()
-.getLocalPort());
+TrailerClient client = new 
TrailerClient(tomcat.getConnector().getLocalPort());
+// Need to use the content length here as variations in Connector and
+// JVM+OS behaviour mean that in some circumstances the client may see
+// an IOException rather than the response body when the server closes
+// the connection.
+client.setUseContentLength(true);
 client.setRequest(new String[] { request });
 
 Exception processException = null;


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



[tomcat] branch master updated: Fix test for running onm platforms with different line endings

2019-06-25 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new c848a3a  Fix test for running onm platforms with different line endings
c848a3a is described below

commit c848a3ab65e48725d1dcb63ec3a90de0f116cfe6
Author: Mark Thomas 
AuthorDate: Tue Jun 25 19:21:19 2019 +0100

Fix test for running onm platforms with different line endings
---
 .../servlets/TestDefaultServletRangeRequests.java  | 45 --
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git 
a/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java 
b/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java
index 14675b1..c25a037 100644
--- a/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java
+++ b/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java
@@ -41,35 +41,40 @@ public class TestDefaultServletRangeRequests extends 
TomcatBaseTest {
 @Parameterized.Parameters(name = "{index} rangeHeader [{0}]")
 public static Collection parameters() {
 
-// Note: The index page used by this test has a content-length of 934 
bytes
+// Get the length of the file used for this test
+// It varies by platform due to line-endings
+File index = new File("test/webapp/index.html");
+long len = index.length();
+String strLen = Long.toString(len);
+
 List parameterSets = new ArrayList<>();
 
-parameterSets.add(new Object[] { "", Integer.valueOf(200), "934", "" 
});
+parameterSets.add(new Object[] { "", Integer.valueOf(200), strLen, "" 
});
 // Invalid
-parameterSets.add(new Object[] { "bytes", Integer.valueOf(416), "", 
"*/934" });
-parameterSets.add(new Object[] { "bytes=", Integer.valueOf(416), "", 
"*/934" });
+parameterSets.add(new Object[] { "bytes", Integer.valueOf(416), "", 
"*/" + len });
+parameterSets.add(new Object[] { "bytes=", Integer.valueOf(416), "", 
"*/" + len });
 // Invalid with unknown type
-parameterSets.add(new Object[] { "unknown", Integer.valueOf(416), "", 
"*/934" });
-parameterSets.add(new Object[] { "unknown=", Integer.valueOf(416), "", 
"*/934" });
+parameterSets.add(new Object[] { "unknown", Integer.valueOf(416), "", 
"*/" + len });
+parameterSets.add(new Object[] { "unknown=", Integer.valueOf(416), "", 
"*/" + len });
 // Invalid ranges
-parameterSets.add(new Object[] { "bytes=-", Integer.valueOf(416), "", 
"*/934" });
-parameterSets.add(new Object[] { "bytes=10-b", Integer.valueOf(416), 
"", "*/934" });
-parameterSets.add(new Object[] { "bytes=b-10", Integer.valueOf(416), 
"", "*/934" });
+parameterSets.add(new Object[] { "bytes=-", Integer.valueOf(416), "", 
"*/" + len });
+parameterSets.add(new Object[] { "bytes=10-b", Integer.valueOf(416), 
"", "*/" + len });
+parameterSets.add(new Object[] { "bytes=b-10", Integer.valueOf(416), 
"", "*/" + len });
 // Invalid no equals
-parameterSets.add(new Object[] { "bytes 1-10", Integer.valueOf(416), 
"", "*/934" });
-parameterSets.add(new Object[] { "bytes1-10", Integer.valueOf(416), 
"", "*/934" });
-parameterSets.add(new Object[] { "bytes10-", Integer.valueOf(416), "", 
"*/934" });
-parameterSets.add(new Object[] { "bytes-10", Integer.valueOf(416), "", 
"*/934" });
+parameterSets.add(new Object[] { "bytes 1-10", Integer.valueOf(416), 
"", "*/" + len });
+parameterSets.add(new Object[] { "bytes1-10", Integer.valueOf(416), 
"", "*/" + len });
+parameterSets.add(new Object[] { "bytes10-", Integer.valueOf(416), "", 
"*/" + len });
+parameterSets.add(new Object[] { "bytes-10", Integer.valueOf(416), "", 
"*/" + len });
 // Unknown types
-parameterSets.add(new Object[] { "unknown=1-2", Integer.valueOf(416), 
"", "*/934" });
-parameterSets.add(new Object[] { "bytesX=1-2", Integer.valueOf(416), 
"", "*/934" });
+parameterSets.add(new Object[] { "unknown=1-2", Integer.valueOf(416), 
"", "*/" + len });
+parameterSets.add(new Object[] { "bytesX=1-2", Integer.valueOf(416), 
"", "*/" + len });
 // Valid range
-parameterSets.add(new Object[] { "bytes=0-9", Integer.valueOf(206), 
"10", "0-9/934" });
-parameterSets.add(new Object[] { "bytes=-100", Integer.valueOf(206), 
"100", "834-933/934" });
-parameterSets.add(new Object[] { "bytes=100-", Integer.valueOf(206), 
"834", "100-933/934" });
+parameterSets.add(new Object[] { "bytes=0-9", Integer.valueOf(206), 
"10", "0-9/" + len });
+parameterSets.add(new Object[] { "bytes=-100", Integer.valueOf(206), 
"100", "834-" + (len - 1) + "/" + len });
+parameterSets.add(new Object[] { "bytes=100-", Integer.valu

[tomcat] branch master updated: Fix test failure on MacOS

2019-05-03 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 95c1cc9  Fix test failure on MacOS
95c1cc9 is described below

commit 95c1cc9ddff6da65bd43de9c3557a9c9f4887bfc
Author: Mark Thomas 
AuthorDate: Fri May 3 22:17:28 2019 +0100

Fix test failure on MacOS
---
 test/org/apache/catalina/core/TestStandardService.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/org/apache/catalina/core/TestStandardService.java 
b/test/org/apache/catalina/core/TestStandardService.java
index cdb7d7d..0ec93ce 100644
--- a/test/org/apache/catalina/core/TestStandardService.java
+++ b/test/org/apache/catalina/core/TestStandardService.java
@@ -16,6 +16,8 @@
  */
 package org.apache.catalina.core;
 
+import java.net.InetAddress;
+
 import org.junit.Test;
 
 import org.apache.catalina.connector.Connector;
@@ -47,6 +49,7 @@ public class TestStandardService extends TomcatBaseTest {
 Connector c2 = new Connector("HTTP/1.1");
 c2.setThrowOnFailure(throwOnFailure);
 
+c2.setAttribute("address", ((InetAddress) 
connector.getAttribute("address")).getHostAddress());
 c2.setPort(connector.getLocalPort());
 
 tomcat.getService().addConnector(c2);


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



[tomcat] branch master updated: Fix test failures. Handle full allocation case.

2019-05-03 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new ada725a  Fix test failures. Handle full allocation case.
ada725a is described below

commit ada725a50a60867af3422c8e612aecaeea856a9a
Author: Mark Thomas 
AuthorDate: Fri May 3 21:52:41 2019 +0100

Fix test failures. Handle full allocation case.
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 58620fd..170e6c9 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -811,8 +811,10 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 stream.wait(writeTimeout);
 }
 // Has this stream been granted an allocation
+// Note: If the stream in not in this Map then the
+//   requested write has been fully allocated
 int[] value = backLogStreams.get(stream);
-if (value[1] == 0) {
+if (value != null && value[1] == 0) {
 // No allocation
 // Close the connection. Do this first since
 // closing the stream will raise an exception


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