You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/04/03 08:23:13 UTC
[tomcat] branch 9.0.x updated (34eefd0 -> f8da18d)
This is an automated email from the ASF dual-hosted git repository.
markt pushed a change to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.
from 34eefd0 Improve code coverage
new 89db088 Log exceptions when closing the server socket and don't re-throw
new a494c8b Expand SSL POST test to exercise the poller more
new 536315b Fix IDE warning
new f8da18d Failed test on Windows. Expand logging to aid debugging of failures.
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
java/org/apache/tomcat/util/net/NioEndpoint.java | 6 +-
test/org/apache/tomcat/util/net/TestSsl.java | 92 +++++++++++++++---------
2 files changed, 65 insertions(+), 33 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[tomcat] 03/04: Fix IDE warning
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 536315b9f321fc296da90ec07c55bfe8bf198aca
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Sat Mar 7 10:14:45 2020 +0000
Fix IDE warning
---
test/org/apache/tomcat/util/net/TestSsl.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/org/apache/tomcat/util/net/TestSsl.java b/test/org/apache/tomcat/util/net/TestSsl.java
index 91598fb..1736b49 100644
--- a/test/org/apache/tomcat/util/net/TestSsl.java
+++ b/test/org/apache/tomcat/util/net/TestSsl.java
@@ -94,6 +94,7 @@ public class TestSsl extends TomcatBaseTest {
AtomicInteger errorCount = new AtomicInteger(0);
for (int i = 0; i < iterations; i++) {
new Thread() {
+ @Override
public void run() {
try {
SSLSocket socket = (SSLSocket) socketFactory.createSocket("localhost",
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[tomcat] 04/04: Failed test on Windows. Expand logging to aid
debugging of failures.
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit f8da18d362b8a773afd557fdda0fe50a3748c90c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Apr 2 21:37:48 2020 +0100
Failed test on Windows. Expand logging to aid debugging of failures.
---
test/org/apache/tomcat/util/net/TestSsl.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/test/org/apache/tomcat/util/net/TestSsl.java b/test/org/apache/tomcat/util/net/TestSsl.java
index 1736b49..ae23179 100644
--- a/test/org/apache/tomcat/util/net/TestSsl.java
+++ b/test/org/apache/tomcat/util/net/TestSsl.java
@@ -128,14 +128,17 @@ public class TestSsl extends TomcatBaseTest {
}
}
- for (byte c : bytes) {
+ for (int i = 0; i < bytes.length; i++) {
int read = is.read();
- if (c != read) {
+ if (bytes[i] != read) {
+ System.err.print("Byte in position [" + i + "] had value [" + read +
+ "] rather than " + Byte.toString(bytes[i]));
errorCount.incrementAndGet();
break;
}
}
} catch (Exception e) {
+ e.printStackTrace();
errorCount.incrementAndGet();
} finally {
latch.countDown();
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[tomcat] 02/04: Expand SSL POST test to exercise the poller more
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit a494c8b34262957d0aa53420aced429bda7ffd8d
Author: remm <re...@apache.org>
AuthorDate: Fri Mar 6 16:55:39 2020 +0100
Expand SSL POST test to exercise the poller more
No issue found so far.
---
test/org/apache/tomcat/util/net/TestSsl.java | 88 ++++++++++++++++++----------
1 file changed, 56 insertions(+), 32 deletions(-)
diff --git a/test/org/apache/tomcat/util/net/TestSsl.java b/test/org/apache/tomcat/util/net/TestSsl.java
index f167c6c..91598fb 100644
--- a/test/org/apache/tomcat/util/net/TestSsl.java
+++ b/test/org/apache/tomcat/util/net/TestSsl.java
@@ -24,6 +24,8 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.util.Arrays;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicInteger;
import javax.net.SocketFactory;
import javax.net.ssl.HandshakeCompletedEvent;
@@ -87,39 +89,61 @@ public class TestSsl extends TomcatBaseTest {
Tomcat.addServlet(ctxt, "post", new SimplePostServlet());
ctxt.addServletMappingDecoded("/post", "post");
tomcat.start();
-
- SSLSocket socket = (SSLSocket) socketFactory.createSocket("localhost",
- getPort());
-
- OutputStream os = socket.getOutputStream();
-
- byte[] bytes = new byte[1024 * 1024]; // 1MB
- Arrays.fill(bytes, (byte) 1);
-
- os.write("POST /post HTTP/1.1\r\n".getBytes());
- os.write("Host: localhost\r\n".getBytes());
- os.write("Content-Length: 1048576\r\n\r\n".getBytes());
- os.write(bytes);
- os.flush();
-
- InputStream is = socket.getInputStream();
-
- // Skip to the end of the headers
- byte[] endOfHeaders = "\r\n\r\n".getBytes();
- int found = 0;
- while (found != endOfHeaders.length) {
- if (is.read() == endOfHeaders[found]) {
- found++;
- } else {
- found = 0;
- }
- }
-
- for (byte c : bytes) {
- int read = is.read();
- Assert.assertEquals(c, read);
+ int iterations = 8;
+ CountDownLatch latch = new CountDownLatch(iterations);
+ AtomicInteger errorCount = new AtomicInteger(0);
+ for (int i = 0; i < iterations; i++) {
+ new Thread() {
+ public void run() {
+ try {
+ SSLSocket socket = (SSLSocket) socketFactory.createSocket("localhost",
+ getPort());
+
+ OutputStream os = socket.getOutputStream();
+
+ byte[] bytes = new byte[16 * 1024 * 1024]; // 16MB
+ Arrays.fill(bytes, (byte) 1);
+
+ os.write("POST /post HTTP/1.1\r\n".getBytes());
+ os.write("Host: localhost\r\n".getBytes());
+ os.write(("Content-Length: " + Integer.valueOf(bytes.length) + "\r\n\r\n").getBytes());
+ // Write in 128KB blocks
+ for (int i = 0; i < bytes.length / (128 * 1024); i++) {
+ os.write(bytes, 0, 1024 * 128);
+ Thread.sleep(10);
+ }
+ os.flush();
+
+ InputStream is = socket.getInputStream();
+
+ // Skip to the end of the headers
+ byte[] endOfHeaders = "\r\n\r\n".getBytes();
+ int found = 0;
+ while (found != endOfHeaders.length) {
+ if (is.read() == endOfHeaders[found]) {
+ found++;
+ } else {
+ found = 0;
+ }
+ }
+
+ for (byte c : bytes) {
+ int read = is.read();
+ if (c != read) {
+ errorCount.incrementAndGet();
+ break;
+ }
+ }
+ } catch (Exception e) {
+ errorCount.incrementAndGet();
+ } finally {
+ latch.countDown();
+ }
+ }
+ }.start();
}
-
+ latch.await();
+ Assert.assertEquals(0, errorCount.get());
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[tomcat] 01/04: Log exceptions when closing the server socket and
don't re-throw
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 89db08869ba51ad608c5c4dcb924e0bde7b2fc6b
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Apr 2 21:23:51 2020 +0100
Log exceptions when closing the server socket and don't re-throw
Running the unit tests on MacOS I saw a test failure caused by an
exception as this point. I've never seen an exception here before. It
certainly isn't repeatable. On balance, logging the exception and
completing the rest of the Connector shutdown cleanly looks to be the
better option.
---
java/org/apache/tomcat/util/net/NioEndpoint.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 3e82123..9f6654f 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -332,7 +332,11 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
if (running) {
stop();
}
- doCloseServerSocket();
+ try {
+ doCloseServerSocket();
+ } catch (IOException ioe) {
+ getLog().warn(sm.getString("endpoint.serverSocket.closeFailed", getName()), ioe);
+ }
destroySsl();
super.unbind();
if (getHandler() != null ) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org