[tomcat] branch 8.5.x updated: ws

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 150e2ce  ws
150e2ce is described below

commit 150e2cea71ec783087dbd644b97ab1f81a595d02
Author: Mark Thomas 
AuthorDate: Thu May 30 19:16:51 2019 +0100

ws
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 22ea45f..8abd92b 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -1435,7 +1435,6 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 }
 
 
-
 @Override
 public void endRequestBodyFrame(int streamId) throws Http2Exception {
 Stream stream = getStream(streamId, true);


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



[tomcat] branch master updated: ws

2019-05-30 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 e617628  ws
e617628 is described below

commit e61762848ea730d34326022b6058e17509498f99
Author: Mark Thomas 
AuthorDate: Thu May 30 19:16:51 2019 +0100

ws
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 8d858ff..de54556 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -1320,7 +1320,6 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 }
 
 
-
 @Override
 public void endRequestBodyFrame(int streamId) throws Http2Exception {
 Stream stream = getStream(streamId, true);


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



[tomcat] branch 8.5.x updated: Refactor unit tests to make it easier to configure the Http2Protocol

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 880c808  Refactor unit tests to make it easier to configure the 
Http2Protocol
880c808 is described below

commit 880c808ba19fa7eb08e1da280e156e7e645ca485
Author: Mark Thomas 
AuthorDate: Thu May 30 21:29:31 2019 +0100

Refactor unit tests to make it easier to configure the Http2Protocol
---
 test/org/apache/coyote/http2/Http2TestBase.java|  6 +-
 test/org/apache/coyote/http2/TestAbortedUpload.java|  2 --
 test/org/apache/coyote/http2/TestHttp2Limits.java  |  4 
 test/org/apache/coyote/http2/TestHttp2Section_6_8.java | 17 ++---
 test/org/apache/coyote/http2/TestHttp2Section_8_1.java |  2 --
 5 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/test/org/apache/coyote/http2/Http2TestBase.java 
b/test/org/apache/coyote/http2/Http2TestBase.java
index db5451b..0361296 100644
--- a/test/org/apache/coyote/http2/Http2TestBase.java
+++ b/test/org/apache/coyote/http2/Http2TestBase.java
@@ -78,6 +78,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
 protected static final String TRAILER_HEADER_NAME = "X-TrailerTest";
 protected static final String TRAILER_HEADER_VALUE = "test";
 
+// Client
 private Socket s;
 protected HpackEncoder hpackEncoder;
 protected Input input;
@@ -85,6 +86,9 @@ public abstract class Http2TestBase extends TomcatBaseTest {
 protected Http2Parser parser;
 protected OutputStream os;
 
+// Server
+protected Http2Protocol http2Protocol;
+
 private long pingAckDelayMillis = 0;
 
 
@@ -533,7 +537,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
 
 protected void enableHttp2(long maxConcurrentStreams) {
 Connector connector = getTomcatInstance().getConnector();
-Http2Protocol http2Protocol = new Http2Protocol();
+http2Protocol = new Http2Protocol();
 // Short timeouts for now. May need to increase these for CI systems.
 http2Protocol.setReadTimeout(6000);
 http2Protocol.setWriteTimeout(6000);
diff --git a/test/org/apache/coyote/http2/TestAbortedUpload.java 
b/test/org/apache/coyote/http2/TestAbortedUpload.java
index 403d0db..69e093b 100644
--- a/test/org/apache/coyote/http2/TestAbortedUpload.java
+++ b/test/org/apache/coyote/http2/TestAbortedUpload.java
@@ -37,8 +37,6 @@ public class TestAbortedUpload extends Http2TestBase {
 public void testAbortedRequest() throws Exception {
 http2Connect();
 
-Http2Protocol http2Protocol =
-(Http2Protocol) 
getTomcatInstance().getConnector().findUpgradeProtocols()[0];
 http2Protocol.setAllowedTrailerHeaders(TRAILER_HEADER_NAME);
 
 int bodySize = 8192;
diff --git a/test/org/apache/coyote/http2/TestHttp2Limits.java 
b/test/org/apache/coyote/http2/TestHttp2Limits.java
index 91b59b0..97f7b4e 100644
--- a/test/org/apache/coyote/http2/TestHttp2Limits.java
+++ b/test/org/apache/coyote/http2/TestHttp2Limits.java
@@ -193,8 +193,6 @@ public class TestHttp2Limits extends Http2TestBase {
 
 enableHttp2();
 
-Http2Protocol http2Protocol =
-(Http2Protocol) 
getTomcatInstance().getConnector().findUpgradeProtocols()[0];
 http2Protocol.setMaxHeaderCount(maxHeaderCount);
 http2Protocol.setMaxHeaderSize(maxHeaderSize);
 
@@ -432,8 +430,6 @@ public class TestHttp2Limits extends Http2TestBase {
 FailureMode failMode) throws Exception {
 enableHttp2();
 
-Http2Protocol http2Protocol =
-(Http2Protocol) 
getTomcatInstance().getConnector().findUpgradeProtocols()[0];
 http2Protocol.setAllowedTrailerHeaders(TRAILER_HEADER_NAME);
 http2Protocol.setMaxTrailerCount(maxTrailerCount);
 http2Protocol.setMaxTrailerSize(maxTrailerSize);
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java 
b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
index 7105bc1..c43a0b5 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
@@ -19,8 +19,6 @@ package org.apache.coyote.http2;
 import org.junit.Assert;
 import org.junit.Test;
 
-import org.apache.catalina.connector.Connector;
-
 /**
  * Unit tests for Section 6.8 of
  * https://tools.ietf.org/html/rfc7540";>RFC 7540.
@@ -40,20 +38,9 @@ public class TestHttp2Section_6_8 extends Http2TestBase {
 public void testGoawayIgnoreNewStreams() throws Exception {
 setPingAckDelayMillis(PING_ACK_DELAY_MS);
 
-// HTTP2 upgrade - need longer timeouts for this test
-Connector connector = getTomcatInstance().getConnector();
-Http2Protocol http2Protocol = new Http2Protocol();
-// Short timeouts for now. May need to increase these for CI systems.
-  

[tomcat] branch master updated: Refactor unit tests to make it easier to configure the Http2Protocol

2019-05-30 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 553922b  Refactor unit tests to make it easier to configure the 
Http2Protocol
553922b is described below

commit 553922beb209cae550b3871b4d4aa57eb911b4be
Author: Mark Thomas 
AuthorDate: Thu May 30 21:29:31 2019 +0100

Refactor unit tests to make it easier to configure the Http2Protocol
---
 test/org/apache/coyote/http2/Http2TestBase.java|  6 +-
 test/org/apache/coyote/http2/TestAbortedUpload.java|  2 --
 test/org/apache/coyote/http2/TestHttp2Limits.java  |  4 
 test/org/apache/coyote/http2/TestHttp2Section_6_8.java | 17 ++---
 test/org/apache/coyote/http2/TestHttp2Section_8_1.java |  2 --
 5 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/test/org/apache/coyote/http2/Http2TestBase.java 
b/test/org/apache/coyote/http2/Http2TestBase.java
index 29008f1..d618112 100644
--- a/test/org/apache/coyote/http2/Http2TestBase.java
+++ b/test/org/apache/coyote/http2/Http2TestBase.java
@@ -79,6 +79,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
 protected static final String TRAILER_HEADER_NAME = "x-trailertest";
 protected static final String TRAILER_HEADER_VALUE = "test";
 
+// Client
 private Socket s;
 protected HpackEncoder hpackEncoder;
 protected Input input;
@@ -86,6 +87,9 @@ public abstract class Http2TestBase extends TomcatBaseTest {
 protected Http2Parser parser;
 protected OutputStream os;
 
+// Server
+protected Http2Protocol http2Protocol;
+
 private long pingAckDelayMillis = 0;
 
 
@@ -534,7 +538,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
 
 protected void enableHttp2(long maxConcurrentStreams) {
 Connector connector = getTomcatInstance().getConnector();
-Http2Protocol http2Protocol = new Http2Protocol();
+http2Protocol = new Http2Protocol();
 // Short timeouts for now. May need to increase these for CI systems.
 http2Protocol.setReadTimeout(6000);
 http2Protocol.setWriteTimeout(6000);
diff --git a/test/org/apache/coyote/http2/TestAbortedUpload.java 
b/test/org/apache/coyote/http2/TestAbortedUpload.java
index 403d0db..69e093b 100644
--- a/test/org/apache/coyote/http2/TestAbortedUpload.java
+++ b/test/org/apache/coyote/http2/TestAbortedUpload.java
@@ -37,8 +37,6 @@ public class TestAbortedUpload extends Http2TestBase {
 public void testAbortedRequest() throws Exception {
 http2Connect();
 
-Http2Protocol http2Protocol =
-(Http2Protocol) 
getTomcatInstance().getConnector().findUpgradeProtocols()[0];
 http2Protocol.setAllowedTrailerHeaders(TRAILER_HEADER_NAME);
 
 int bodySize = 8192;
diff --git a/test/org/apache/coyote/http2/TestHttp2Limits.java 
b/test/org/apache/coyote/http2/TestHttp2Limits.java
index 91b59b0..97f7b4e 100644
--- a/test/org/apache/coyote/http2/TestHttp2Limits.java
+++ b/test/org/apache/coyote/http2/TestHttp2Limits.java
@@ -193,8 +193,6 @@ public class TestHttp2Limits extends Http2TestBase {
 
 enableHttp2();
 
-Http2Protocol http2Protocol =
-(Http2Protocol) 
getTomcatInstance().getConnector().findUpgradeProtocols()[0];
 http2Protocol.setMaxHeaderCount(maxHeaderCount);
 http2Protocol.setMaxHeaderSize(maxHeaderSize);
 
@@ -432,8 +430,6 @@ public class TestHttp2Limits extends Http2TestBase {
 FailureMode failMode) throws Exception {
 enableHttp2();
 
-Http2Protocol http2Protocol =
-(Http2Protocol) 
getTomcatInstance().getConnector().findUpgradeProtocols()[0];
 http2Protocol.setAllowedTrailerHeaders(TRAILER_HEADER_NAME);
 http2Protocol.setMaxTrailerCount(maxTrailerCount);
 http2Protocol.setMaxTrailerSize(maxTrailerSize);
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java 
b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
index 7105bc1..c43a0b5 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
@@ -19,8 +19,6 @@ package org.apache.coyote.http2;
 import org.junit.Assert;
 import org.junit.Test;
 
-import org.apache.catalina.connector.Connector;
-
 /**
  * Unit tests for Section 6.8 of
  * https://tools.ietf.org/html/rfc7540";>RFC 7540.
@@ -40,20 +38,9 @@ public class TestHttp2Section_6_8 extends Http2TestBase {
 public void testGoawayIgnoreNewStreams() throws Exception {
 setPingAckDelayMillis(PING_ACK_DELAY_MS);
 
-// HTTP2 upgrade - need longer timeouts for this test
-Connector connector = getTomcatInstance().getConnector();
-Http2Protocol http2Protocol = new Http2Protocol();
-// Short timeouts for now. May need to increase these for CI systems.
-

[tomcat] branch 8.5.x updated: Refactor int[] to class to improve maintainability # Conflicts: # java/org/apache/coyote/http2/Http2UpgradeHandler.java

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 67c4c72  Refactor int[] to class to improve maintainability # 
Conflicts: # java/org/apache/coyote/http2/Http2UpgradeHandler.java
67c4c72 is described below

commit 67c4c72f6e51bf1c0cfa1d10c115962be1a8fe0a
Author: Mark Thomas 
AuthorDate: Thu May 30 21:09:10 2019 +0100

Refactor int[] to class to improve maintainability
# Conflicts:
#   java/org/apache/coyote/http2/Http2UpgradeHandler.java
---
 .../apache/coyote/http2/Http2UpgradeHandler.java   | 150 ++---
 1 file changed, 99 insertions(+), 51 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index a1aa77c..22ea45f 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -138,26 +138,7 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 private final AtomicInteger nextLocalStreamId = new AtomicInteger(2);
 private final PingManager pingManager = new PingManager();
 private volatile int newStreamsSinceLastPrune = 0;
-// Tracking for when the connection is blocked (windowSize < 1)
-// The int array must have 3 elements. There are:
-//   [0] - The number of bytes the Stream requires from the connection
-// window. This excludes any allocation that has already been made.
-//   [1] - The number of bytes that has been allocated from the connection
-// window. This excludes any bytes that have been written since the
-// allocation was made.
-//   [2] - 1 if the stream thread has been notified that an allocation has
-// been made but has not yet consumed that allocation. 0 in all
-// other cases. The purpose of this is to avoid the incorrect
-// triggering of a timeout for the following sequence of events:
-// window update 1
-// allocation 1
-// notify 1
-// window update 2
-// allocation 2
-// act on notify 1 (using allocation 1 and 2)
-// notify 2
-// act on notify 2 (timeout due to no allocation)
-private final ConcurrentMap backLogStreams = new 
ConcurrentHashMap<>();
+private final ConcurrentMap backLogStreams 
= new ConcurrentHashMap<>();
 private long backLogSize = 0;
 
 // Stream concurrency control
@@ -785,21 +766,21 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 long windowSize = getWindowSize();
 if (windowSize < 1 || backLogSize > 0) {
 // Has this stream been granted an allocation
-int[] value = backLogStreams.get(stream);
-if (value == null) {
-value = new int[] { reservation, 0, 0 };
-backLogStreams.put(stream, value);
+BacklogTracker tracker = backLogStreams.get(stream);
+if (tracker == null) {
+tracker = new BacklogTracker(reservation);
+backLogStreams.put(stream, tracker);
 backLogSize += reservation;
 // Add the parents as well
 AbstractStream parent = stream.getParentStream();
-while (parent != null && 
backLogStreams.putIfAbsent(parent, new int[3]) == null) {
+while (parent != null && 
backLogStreams.putIfAbsent(parent, new BacklogTracker()) == null) {
 parent = parent.getParentStream();
 }
 } else {
-if (value[1] > 0) {
-allocation = value[1];
+if (tracker.getUnusedAllocation() > 0) {
+allocation = tracker.getUnusedAllocation();
 decrementWindowSize(allocation);
-if (value[0] == 0) {
+if (tracker.getRemainingReservation() == 0) {
 // The reservation has been fully allocated
 // so this stream can be removed from the
 // backlog.
@@ -808,10 +789,7 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 // This allocation has been used. Leave the
 // stream on the backlog as it still has

[tomcat] branch master updated: Refactor int[] to class to improve maintainability

2019-05-30 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 92910c4  Refactor int[] to class to improve maintainability
92910c4 is described below

commit 92910c46bc6d602ec370ab18c2a84e8ca3c9d0e8
Author: Mark Thomas 
AuthorDate: Thu May 30 21:09:10 2019 +0100

Refactor int[] to class to improve maintainability
---
 .../apache/coyote/http2/Http2UpgradeHandler.java   | 148 ++---
 1 file changed, 98 insertions(+), 50 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 4ecb642..8d858ff 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -132,26 +132,7 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 private final AtomicInteger nextLocalStreamId = new AtomicInteger(2);
 private final PingManager pingManager = getPingManager();
 private volatile int newStreamsSinceLastPrune = 0;
-// Tracking for when the connection is blocked (windowSize < 1)
-// The int array must have 3 elements. There are:
-//   [0] - The number of bytes the Stream requires from the connection
-// window. This excludes any allocation that has already been made.
-//   [1] - The number of bytes that has been allocated from the connection
-// window. This excludes any bytes that have been written since the
-// allocation was made.
-//   [2] - 1 if the stream thread has been notified that an allocation has
-// been made but has not yet consumed that allocation. 0 in all
-// other cases. The purpose of this is to avoid the incorrect
-// triggering of a timeout for the following sequence of events:
-// window update 1
-// allocation 1
-// notify 1
-// window update 2
-// allocation 2
-// act on notify 1 (using allocation 1 and 2)
-// notify 2
-// act on notify 2 (timeout due to no allocation)
-private final Map backLogStreams = new 
ConcurrentHashMap<>();
+private final Map backLogStreams = new 
ConcurrentHashMap<>();
 private long backLogSize = 0;
 
 // Stream concurrency control
@@ -781,21 +762,21 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 long windowSize = getWindowSize();
 if (windowSize < 1 || backLogSize > 0) {
 // Has this stream been granted an allocation
-int[] value = backLogStreams.get(stream);
-if (value == null) {
-value = new int[] { reservation, 0, 0 };
-backLogStreams.put(stream, value);
+BacklogTracker tracker = backLogStreams.get(stream);
+if (tracker == null) {
+tracker = new BacklogTracker(reservation);
+backLogStreams.put(stream, tracker);
 backLogSize += reservation;
 // Add the parents as well
 AbstractStream parent = stream.getParentStream();
-while (parent != null && 
backLogStreams.putIfAbsent(parent, new int[3]) == null) {
+while (parent != null && 
backLogStreams.putIfAbsent(parent, new BacklogTracker()) == null) {
 parent = parent.getParentStream();
 }
 } else {
-if (value[1] > 0) {
-allocation = value[1];
+if (tracker.getUnusedAllocation() > 0) {
+allocation = tracker.getUnusedAllocation();
 decrementWindowSize(allocation);
-if (value[0] == 0) {
+if (tracker.getRemainingReservation() == 0) {
 // The reservation has been fully allocated
 // so this stream can be removed from the
 // backlog.
@@ -804,10 +785,7 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 // This allocation has been used. Leave the
 // stream on the backlog as it still has
 // more bytes to write.
-// Reset the allocation to zero.
-value[1] = 0;
- 

Re: [tomcat] branch master updated: Additional h2 concurrency / timeout fix

2019-05-30 Thread Mark Thomas
> Mark,
> 
> On 5/30/19 08: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 0bebe66  Additional h2 concurrency / timeout fix 0bebe66
>> is described below
> 
>> commit 0bebe66d921072a3423cece63f3c2f8787d0342c Author: Mark Thomas
>>  AuthorDate: Thu May 30 13:39:05 2019 +0100
> 
>> Additional h2 concurrency / timeout fix --- 
>> .../apache/coyote/http2/Http2UpgradeHandler.java   | 37
>> ++ 1 file changed, 30 insertions(+), 7
>> deletions(-)
> 
>> diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
>> b/java/org/apache/coyote/http2/Http2UpgradeHandler.java index
>> 880d365..4ecb642 100644 ---
>> a/java/org/apache/coyote/http2/Http2UpgradeHandler.java +++
>> b/java/org/apache/coyote/http2/Http2UpgradeHandler.java @@ -133,6
>> +133,24 @@ class Http2UpgradeHandler extends AbstractStream
>> implements InternalHttpUpgradeH private final PingManager
>> pingManager = getPingManager(); private volatile int
>> newStreamsSinceLastPrune = 0; // Tracking for when the connection
>> is blocked (windowSize < 1) +// The int array must have 3
>> elements. There are: +//   [0] - The number of bytes the Stream
>> requires from the connection +// window. This excludes
>> any allocation that has already been made. +//   [1] - The
>> number of bytes that has been allocated from the connection +//
>> window. This excludes any bytes that have been written since the +
>> // allocation was made. +//   [2] - 1 if the stream
>> thread has been notified that an allocation has +//
>> been made but has not yet consumed that allocation. 0 in all +
>> // other cases. The purpose of this is to avoid the
>> incorrect +// triggering of a timeout for the following
>> sequence of events: +// window update 1 +//
>> allocation 1 +// notify 1 +// window update
>> 2 +// allocation 2 +// act on notify 1
>> (using allocation 1 and 2) +// notify 2 +//
>> act on notify 2 (timeout due to no allocation)
> 
> Maybe it's time for a real class instead of an int array that requires
> a half-page of documentation. We may still require the half-page of
> documentation, but using an int[] here seems like less and less of a
> good idea.
> 
> Binding the documentation to a class would be more readable,
> especially in an IDE where you can get javadoc for a method / class
> easily without even opening the file.

Fair point. I'll take a look at that.

Mark

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



[tomcat] branch master updated: NPE protection primarily for access log

2019-05-30 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 65fb1ee  NPE protection primarily for access log
65fb1ee is described below

commit 65fb1ee548111021edde247f3b3c409ec95a5183
Author: Mark Thomas 
AuthorDate: Thu May 30 17:31:47 2019 +0100

NPE protection primarily for access log
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 50 
 1 file changed, 34 insertions(+), 16 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 68f401a..d41898d 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1314,20 +1314,26 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 
 @Override
 protected void populateRemoteAddr() {
-InetAddress inetAddr = 
getSocket().getIOChannel().socket().getInetAddress();
-if (inetAddr != null) {
-remoteAddr = inetAddr.getHostAddress();
+SocketChannel sc = getSocket().getIOChannel();
+if (sc != null) {
+InetAddress inetAddr = sc.socket().getInetAddress();
+if (inetAddr != null) {
+remoteAddr = inetAddr.getHostAddress();
+}
 }
 }
 
 
 @Override
 protected void populateRemoteHost() {
-InetAddress inetAddr = 
getSocket().getIOChannel().socket().getInetAddress();
-if (inetAddr != null) {
-remoteHost = inetAddr.getHostName();
-if (remoteAddr == null) {
-remoteAddr = inetAddr.getHostAddress();
+SocketChannel sc = getSocket().getIOChannel();
+if (sc != null) {
+InetAddress inetAddr = sc.socket().getInetAddress();
+if (inetAddr != null) {
+remoteHost = inetAddr.getHostName();
+if (remoteAddr == null) {
+remoteAddr = inetAddr.getHostAddress();
+}
 }
 }
 }
@@ -1335,31 +1341,43 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 
 @Override
 protected void populateRemotePort() {
-remotePort = getSocket().getIOChannel().socket().getPort();
+SocketChannel sc = getSocket().getIOChannel();
+if (sc != null) {
+remotePort = sc.socket().getPort();
+}
 }
 
 
 @Override
 protected void populateLocalName() {
-InetAddress inetAddr = 
getSocket().getIOChannel().socket().getLocalAddress();
-if (inetAddr != null) {
-localName = inetAddr.getHostName();
+SocketChannel sc = getSocket().getIOChannel();
+if (sc != null) {
+InetAddress inetAddr = sc.socket().getInetAddress();
+if (inetAddr != null) {
+localName = inetAddr.getHostName();
+}
 }
 }
 
 
 @Override
 protected void populateLocalAddr() {
-InetAddress inetAddr = 
getSocket().getIOChannel().socket().getLocalAddress();
-if (inetAddr != null) {
-localAddr = inetAddr.getHostAddress();
+SocketChannel sc = getSocket().getIOChannel();
+if (sc != null) {
+InetAddress inetAddr = sc.socket().getInetAddress();
+if (inetAddr != null) {
+localAddr = inetAddr.getHostAddress();
+}
 }
 }
 
 
 @Override
 protected void populateLocalPort() {
-localPort = getSocket().getIOChannel().socket().getLocalPort();
+SocketChannel sc = getSocket().getIOChannel();
+if (sc != null) {
+localPort = sc.socket().getLocalPort();
+}
 }
 
 


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



Re: [tomcat] branch master updated: Additional h2 concurrency / timeout fix

2019-05-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Mark,

On 5/30/19 08: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 0bebe66  Additional h2 concurrency / timeout fix 0bebe66
> is described below
> 
> commit 0bebe66d921072a3423cece63f3c2f8787d0342c Author: Mark Thomas
>  AuthorDate: Thu May 30 13:39:05 2019 +0100
> 
> Additional h2 concurrency / timeout fix --- 
> .../apache/coyote/http2/Http2UpgradeHandler.java   | 37
> ++ 1 file changed, 30 insertions(+), 7
> deletions(-)
> 
> diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
> b/java/org/apache/coyote/http2/Http2UpgradeHandler.java index
> 880d365..4ecb642 100644 ---
> a/java/org/apache/coyote/http2/Http2UpgradeHandler.java +++
> b/java/org/apache/coyote/http2/Http2UpgradeHandler.java @@ -133,6
> +133,24 @@ class Http2UpgradeHandler extends AbstractStream
> implements InternalHttpUpgradeH private final PingManager
> pingManager = getPingManager(); private volatile int
> newStreamsSinceLastPrune = 0; // Tracking for when the connection
> is blocked (windowSize < 1) +// The int array must have 3
> elements. There are: +//   [0] - The number of bytes the Stream
> requires from the connection +// window. This excludes
> any allocation that has already been made. +//   [1] - The
> number of bytes that has been allocated from the connection +//
> window. This excludes any bytes that have been written since the +
> // allocation was made. +//   [2] - 1 if the stream
> thread has been notified that an allocation has +//
> been made but has not yet consumed that allocation. 0 in all +
> // other cases. The purpose of this is to avoid the
> incorrect +// triggering of a timeout for the following
> sequence of events: +// window update 1 +//
> allocation 1 +// notify 1 +// window update
> 2 +// allocation 2 +// act on notify 1
> (using allocation 1 and 2) +// notify 2 +//
> act on notify 2 (timeout due to no allocation)

Maybe it's time for a real class instead of an int array that requires
a half-page of documentation. We may still require the half-page of
documentation, but using an int[] here seems like less and less of a
good idea.

Binding the documentation to a class would be more readable,
especially in an IDE where you can get javadoc for a method / class
easily without even opening the file.

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

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlzwHnQACgkQHPApP6U8
pFilmw//eEpyj/Qu649nCxI+k3pFdoCXNedUgONW+Yy7MbMCGNT1IUgAH0I6CBqM
j8YGcv+cvVTmnPJT0M+KtV+j0F+fBZhHsHo00NjGrcP6GEGItpihq1QyLecJ6+gJ
yLRujdOKj8ij9w9pRJ50XcHlksKEEUOaU/Ou1AMnZ0OlHXjHAB7zSRnqKvYMbVmJ
ZrD3nzlJYP70CSUJYYJZTpLAeWTwFe50xbqHl7mvp2H1iWRj+Zdqbs5hUEg6AyTC
K+tGHWKlvHYlneRSTSBCm1MvDKLRpgzwyrKRViiSGnCG4C2QETExPWSPM0Ylz/fW
X/7kIhxOXVQsfDkjyt0Zl+r/u1U18m1UIEEndaTW/uOq0yoeWWeqqfHt+28gmbLK
RKcejI4sfQKvC4HC207h/nyzmqz0SwerzJKxd7NuXIlhozQ+jYxw33iHoqZI7eYJ
zQBYEIp4YgpqkvO3mzJN8NX4LsN+mSRj/Gxy/qoVEPdKNT9UqgFpzKTfwa/1W5ib
rjdlbjZvuNn7bCq6UXHlU3ceBSnWoj/uCiK1RDIrNdSWfx/G6vRLREyI8DHh8bE6
bn79WhAIOLISmZPyJraFRxHcTAzb7nncYH0vnymPPXmZBV85jd2O58RCCmSqr5dA
OyAOk1hwFlo99+aXR+a4R8IhC7cdk/InDAvDRRQzOpTdAD0sisM=
=ZpwO
-END PGP SIGNATURE-

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



Re: Question Regarding McastServiceImpl#setupSocket

2019-05-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Gurkan,

On Thursday, May 30th, 2019, Gurkan Erdogdu
 wrote:
> 
> In  macOS test server, when configuring the mcastBindAddress as 
> 192.168.1.139 and address as 228.0.0.4 , the code does not use 
> mcastBindAddress , instead it uses multicast  address for socket
> binding and throws exception when sending the datagram packet. Here
> is the exception:
> 
> Exception in thread "main"
> org.apache.catalina.tribes.ChannelException: java.io.IOException:
> Can't assign requested address (sendto failed); No faulty members
> identified. at
> org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(Chan
nelCoordinator.java:207)
>
> 
at
org.apache.catalina.tribes.group.ChannelCoordinator.start(ChannelCoordin
ator.java:111)
> at
> org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelI
nterceptorBase.java:165)
>
> 
at
org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor
.start(MessageDispatchInterceptor.java:228)
> at
> org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelI
nterceptorBase.java:165)
>
> 
at
org.apache.catalina.tribes.group.GroupChannel.start(GroupChannel.java:48
3)
> at test.MemberShipTest.main(MemberShipTest.java:44) Caused by:
> java.io.IOException: Can't assign requested address (sendto
> failed) at java.net.PlainDatagramSocketImpl.send(Native Method) at
> java.net.DatagramSocket.send(DatagramSocket.java:693) at
> org.apache.catalina.tribes.membership.McastServiceImpl.send(McastServi
ceImpl.java:505)
>
> 
at
org.apache.catalina.tribes.membership.McastServiceImpl.send(McastService
Impl.java:482)
> at
> org.apache.catalina.tribes.membership.McastServiceImpl.start(McastServ
iceImpl.java:268)
>
> 
at
org.apache.catalina.tribes.membership.McastService.start(McastService.ja
va:289)
> at
> org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(Chan
nelCoordinator.java:196)
>
> 
... 6 more
> 
> When I changed the address to mcastBindAddress while creating the
> socket, no more exception occurred.

I wonder if the problem is that everyone uses multicast on Linux (or
Windows?) and nobody noticed that the code was wrong for the
non-Linux(/Windows?) case. There is this note in setupSocket:

203 if (mcastBindAddress != null) {
204 try {
205 log.info(sm.getString("mcastServiceImpl.bind",
address, Integer.toString(port)));
206 socket = new MulticastSocket(new
InetSocketAddress(address,port));
207 } catch (BindException e) {
208 /*
209  * On some platforms (e.g. Linux) it is not possible
to bind
210  * to the multicast address. In this case only bind to t
he
211  * port.
212  */
213 log.info(sm.getString("mcastServiceImpl.bind.failed"));
214 socket = new MulticastSocket(port);
215 }
216 } else {
217 socket = new MulticastSocket(port);
218 }

So either nobody ever sets the mcastBindAddress, or nobody uses a
system where is actually uses that address.

I'd accept the patch as proposed, or a PR with your name on it, but I
don't have a good place to test it in other environments. Can you file
a BZ issue or make a pull-request with your changes? Others with
better familiarity with the multicast clustering can give it a better
review.

Could you write a unit-test for it?

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

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlzwHWQACgkQHPApP6U8
pFgHkxAAxqNGrVLq6G0NahXhKSYLcyF9X5OGv0bMjqg7DjFyOqAJK5X4NKpCqgox
6QUZRoS+3GWMv+uJYd8nQvV3/UBOFboD7NqKnrvgPOSTIG4IPCgp18aLec6+7W/C
mb9DfPqiANVKim5TxY7a+XctNYyN+3Rh0Zxy60SRnR4qJBzztbHBKBJlSHLgwNiG
/LGhmYlDbtOFQVuYOji4CRP3y4XnQ6LvhVLhwsbZ2q+NS0G5u2iQH3wo1fqbbFcQ
InKL2rFQJUBRQOla2f6nF8moedeEFtGbr19N8+2PqJPLJUmiBWkJhjepl/PBMvT8
rT1XUtfYMYUzByD1QwZI9SnX+HpwWn32uTue369+wsAzXMULwwlDgIuGVhIog5CV
UmU2MKWGpglWCWJK0UejV5xkhjzsdLxJD2a6RrNY8y683dL/PqwppGyGxI6uo9Ja
9Qe6MpM+qvAZHp1/7hB+KgH03HmLxXRBSl2DZbcVjmmQGhKTh3AHiI/D/8mrk8Ny
YqmkmWNTt4gTBPP9A3OQJYTsbV3MQBsLqyheYHquaHiLVdOsN9bfrXNfAV3bk9Ni
lxOE4LjAHwpXRALwtD+i3E1wGCjfeAqwMYxxZyHZGU6HXrQynQJITb11rhwo+NUN
y1615lCjNw076+bv67w3H4tjc8eewsNGPU5+8Uipq+2iXfe/pVU=
=f3l5
-END PGP SIGNATURE-

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



Re: Question Regarding McastServiceImpl#setupSocket

2019-05-30 Thread Gurkan Erdogdu
 Hi ChrisIn  macOS test server, when configuring the mcastBindAddress as 
192.168.1.139 and address as 228.0.0.4 , the code does not use mcastBindAddress 
, instead it uses multicast  address for socket binding and throws exception 
when sending the datagram packet. Here is the exception:
Exception in thread "main" org.apache.catalina.tribes.ChannelException: 
java.io.IOException: Can't assign requested address (sendto failed); No faulty 
members identified.
    at 
org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:207)
    at 
org.apache.catalina.tribes.group.ChannelCoordinator.start(ChannelCoordinator.java:111)
    at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:165)
    at 
org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor.start(MessageDispatchInterceptor.java:228)
    at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:165)
    at 
org.apache.catalina.tribes.group.GroupChannel.start(GroupChannel.java:483)
    at test.MemberShipTest.main(MemberShipTest.java:44)
Caused by: java.io.IOException: Can't assign requested address (sendto failed)
    at java.net.PlainDatagramSocketImpl.send(Native Method)
    at java.net.DatagramSocket.send(DatagramSocket.java:693)
    at 
org.apache.catalina.tribes.membership.McastServiceImpl.send(McastServiceImpl.java:505)
    at 
org.apache.catalina.tribes.membership.McastServiceImpl.send(McastServiceImpl.java:482)
    at 
org.apache.catalina.tribes.membership.McastServiceImpl.start(McastServiceImpl.java:268)
    at 
org.apache.catalina.tribes.membership.McastService.start(McastService.java:289)
    at 
org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:196)
    ... 6 more
When I changed the address to mcastBindAddress while creating the socket, no 
more exception occurred.Regards.Gurkan
On Thursday, May 30, 2019, 5:56:46 PM GMT+3, Christopher Schultz 
 wrote:  
 
 -BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Gurkan,

On 5/29/19 02:28, Gurkan Erdogdu wrote:
> Hi In an McastServiceImpl#setupSocket method, if the user
> configures the mcastBindAddress, it will use the socket to bind to
> this address. But, in the code below, it uses the "address" field
> while creating the socket. Is this correct ?
> 
> if (mcastBindAddress != null) { try { 
> log.info(sm.getString("mcastServiceImpl.bind", address, 
> Integer.toString(port))); socket = new MulticastSocket(new 
> InetSocketAddress(address,port)); } catch (BindException e) {

That definitely does look weird.

The constructor for McastServiceImpl is even more strange:

    /**
    * @param bind - the bind address (not sure this is used yet)
    * @param mcastAddress - the mcast address
    */
    public McastServiceImpl([...],
        InetAddress bind,
        InetAddress mcastAddress,
        [...])
    throws IOException {
        [...]
        this.address = mcastAddress;
        this.mcastBindAddress = bind;
        [...]
    }

There are two items, here:

1. An address to bind to (locally)
2. A multicast target address

The constructor takes these two and calls them:

1. bind
2. mcastAddress

But the class members are called:

1. mcastBindAddress
2. address

The mcastBindAddress appears to be ignored in all but one place, where
the socket's interface is changed to it at McastServiceImpl.java:223:

220    if (mcastBindAddress != null) {
221        if(log.isInfoEnabled())
222            log.info(sm.getString("mcastServiceImpl.setInterface",
mcastBindAddress));
223        socket.setInterface(mcastBindAddress);
224    } //end if

I don't know enough about multicast to know what is supposed to be
happening, here. AFAIK, mcast is a broadcast mechanism and so there is
no difference between the "target" address and the "bind" address: you
just throw packets at the interface:port and that's that.

The code could probably use some clean-up, or at least some better
in-code documentation by someone who has a good understanding of the
whole situation.

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

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlzv7ysACgkQHPApP6U8
pFjuNg/8DkSdnsKkoTmGS1N37IXVcdj5cyHlmPC+BdP3NWE4oky0j5uFrGUqcaRG
UJLsPMvtZwgSaQ/wxgin4maluAmK77Agt76r6tXJNbbpdglXVyz7ONWO8a5xmk9R
ltqLWnHVw4a/HB5vatxFgqWWc6L1qWnocJL7/sWUn1M9y9Ee43/+h5OYnaBn9bCM
R1jqVhZAodC2k1eD3HXedCMaVIA4k2fZF+TteOHNu2rDr01mJVZzPjNJ/zy4sNg7
L0P0uuqCp3ylh563c3t+slL/9XFoVDNytD46qJlmDDcOYczNjf5An6dyWBJEX348
d0FdWOw5h45lJKhMd1L9WNLymxj3gQ9a3okfhiEqyunsZA4SbMNCPgy4an8tzBsd
HsX1dNgD6P8aoy2umG6SvqgAoPb0mZxlVVT1NdbXN0uybdv/mUJgjDHNsbaCYOxG
UNBfT/p5VQxURhRuNqHsFYvHtA6pxt8mZBbwsHC6b/uOYgPXPrLbM4oQztF2YEzI
RDOr2kmA+JbEj5qKOeQa3BVGT5bUeLRWH+fDFiXq6ubdBdvHAifPJyGdYgAFLvZq
jm85WJJeNvluwB602JUJ/FFxCYe6sKL7jaqfZJClqZrscUDxve0Fckh9xLrQ/il2
0W1VqfxuWeFL6P0SgJOr7aZxbdA293o1/X10E9o6sMuWoCtHfk8=
=jSBA
-END PGP SIGNATURE-

[GitHub] [tomcat] markt-asf commented on issue #167: Use test -t command to check if STDOUT is opened on a terminal

2019-05-30 Thread GitBox
markt-asf commented on issue #167: Use test -t command to check if STDOUT is 
opened on a terminal
URL: https://github.com/apache/tomcat/pull/167#issuecomment-497367363
 
 
   Back-ported to 8.5.x and 7.0.x as well.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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



[tomcat] branch 7.0.x updated (86ab275 -> 5a8d441)

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

markt pushed a change to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 86ab275  Update the location of the Java EE schemas
 new 2f4246e  Use test -t command to check if STDOUT is opened on a terminal
 new 5a8d441  Update changelog for catalina.sh tty/test fix

The 2 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:
 bin/catalina.sh| 2 +-
 webapps/docs/changelog.xml | 5 +
 2 files changed, 6 insertions(+), 1 deletion(-)


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



[tomcat] 01/02: Use test -t command to check if STDOUT is opened on a terminal

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

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

commit 2f4246e8a428207073e68bd236d895e0d8e06346
Author: Radosław Józwik 
AuthorDate: Tue May 21 23:11:59 2019 +0200

Use test -t command to check if STDOUT is opened on a terminal
---
 bin/catalina.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/catalina.sh b/bin/catalina.sh
index 308dcce..d479c8e 100755
--- a/bin/catalina.sh
+++ b/bin/catalina.sh
@@ -212,7 +212,7 @@ fi
 
 # Bugzilla 37848: When no TTY is available, don't output to console
 have_tty=0
-if [ "`tty`" != "not a tty" ]; then
+if [ -t 1 ]; then
 have_tty=1
 fi
 


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



[tomcat] 01/02: Use test -t command to check if STDOUT is opened on a terminal

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

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

commit f1709cad1cffc3352cb440e69529e44e5473646c
Author: Radosław Józwik 
AuthorDate: Tue May 21 23:11:59 2019 +0200

Use test -t command to check if STDOUT is opened on a terminal
---
 bin/catalina.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/catalina.sh b/bin/catalina.sh
index 5a8c2b5..55fd90b 100755
--- a/bin/catalina.sh
+++ b/bin/catalina.sh
@@ -228,7 +228,7 @@ fi
 
 # Bugzilla 37848: When no TTY is available, don't output to console
 have_tty=0
-if [ "`tty`" != "not a tty" ]; then
+if [ -t 1 ]; then
 have_tty=1
 fi
 


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



[tomcat] 02/02: Update changelog for catalina.sh tty/test fix

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

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

commit 5a8d44100db2280058dc15d9e9cf9173f112dec0
Author: Mark Thomas 
AuthorDate: Thu May 30 16:08:10 2019 +0100

Update changelog for catalina.sh tty/test fix
---
 webapps/docs/changelog.xml | 5 +
 1 file changed, 5 insertions(+)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 5791513..015c77f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -165,6 +165,11 @@
 When using the OneLineFormatter, don't print a blank line
 in the log after printing a stack trace. (markt)
   
+  
+Use the test command to check for terminal availability
+rather than the tty command since the tty
+based test fails on non-Eglish locales. (markt)
+  
 
   
 


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



[tomcat] branch 8.5.x updated (187cba6 -> e5bedee)

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

markt pushed a change to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 187cba6  Additional h2 concurrency / timeout fix
 new f1709ca  Use test -t command to check if STDOUT is opened on a terminal
 new e5bedee  Update changelog for catalina.sh tty/test fix

The 2 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:
 bin/catalina.sh| 2 +-
 webapps/docs/changelog.xml | 5 +
 2 files changed, 6 insertions(+), 1 deletion(-)


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



[tomcat] 02/02: Update changelog for catalina.sh tty/test fix

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

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

commit e5bedee60b53994e4b05fb2b8c0abe0b14ccd55b
Author: Mark Thomas 
AuthorDate: Thu May 30 16:08:10 2019 +0100

Update changelog for catalina.sh tty/test fix
---
 webapps/docs/changelog.xml | 5 +
 1 file changed, 5 insertions(+)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index f016b00..e07bef4 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -129,6 +129,11 @@
 63403: Fix TestHttp2InitialConnection test failures when
 running with a non-English locale. (kkolinko)
   
+  
+Use the test command to check for terminal availability
+rather than the tty command since the tty
+based test fails on non-Eglish locales. (markt)
+  
 
   
 


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



[tomcat] 01/02: Merge branch 'fix-tty-check-in-catalina-sh' of https://github.com/rjozwik/tomcat into rjozwik-fix-tty-check-in-catalina-sh

2019-05-30 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

commit 5815f9f08c59b483583423a7928af8f1f80136ef
Merge: 0bebe66 bf894a0
Author: Mark Thomas 
AuthorDate: Thu May 30 15:38:52 2019 +0100

Merge branch 'fix-tty-check-in-catalina-sh' of 
https://github.com/rjozwik/tomcat into rjozwik-fix-tty-check-in-catalina-sh

 bin/catalina.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


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



[tomcat] branch master updated (0bebe66 -> 1fa57f5)

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

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


from 0bebe66  Additional h2 concurrency / timeout fix
 add bf894a0  Use test -t command to check if STDOUT is opened on a terminal
 new 5815f9f  Merge branch 'fix-tty-check-in-catalina-sh' of 
https://github.com/rjozwik/tomcat into rjozwik-fix-tty-check-in-catalina-sh
 new 1fa57f5  Update changelog for catalina.sh tty/test fix

The 2 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:
 bin/catalina.sh| 2 +-
 webapps/docs/changelog.xml | 5 +
 2 files changed, 6 insertions(+), 1 deletion(-)


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



[tomcat] 02/02: Update changelog for catalina.sh tty/test fix

2019-05-30 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

commit 1fa57f587e9154f2a69d806274c815abf5739360
Author: Mark Thomas 
AuthorDate: Thu May 30 16:08:10 2019 +0100

Update changelog for catalina.sh tty/test fix
---
 webapps/docs/changelog.xml | 5 +
 1 file changed, 5 insertions(+)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index fe4e7b4..f5e63cd 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -249,6 +249,11 @@
 Expand the coverage and quality of the Simplified Chinese translations
 provided with Apache Tomcat. Includes contributions by 諵. (markt)
   
+  
+Use the test command to check for terminal availability
+rather than the tty command since the tty
+based test fails on non-Eglish locales. (markt)
+  
 
   
 


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



[GitHub] [tomcat] markt-asf merged pull request #167: Use test -t command to check if STDOUT is opened on a terminal

2019-05-30 Thread GitBox
markt-asf merged pull request #167: Use test -t command to check if STDOUT is 
opened on a terminal
URL: https://github.com/apache/tomcat/pull/167
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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



Re: Question Regarding McastServiceImpl#setupSocket

2019-05-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Gurkan,

On 5/29/19 02:28, Gurkan Erdogdu wrote:
> Hi In an McastServiceImpl#setupSocket method, if the user
> configures the mcastBindAddress, it will use the socket to bind to
> this address. But, in the code below, it uses the "address" field
> while creating the socket. Is this correct ?
> 
> if (mcastBindAddress != null) { try { 
> log.info(sm.getString("mcastServiceImpl.bind", address, 
> Integer.toString(port))); socket = new MulticastSocket(new 
> InetSocketAddress(address,port)); } catch (BindException e) {

That definitely does look weird.

The constructor for McastServiceImpl is even more strange:

/**
 * @param bind - the bind address (not sure this is used yet)
 * @param mcastAddress - the mcast address
 */
public McastServiceImpl([...],
InetAddress bind,
InetAddress mcastAddress,
[...])
throws IOException {
[...]
this.address = mcastAddress;
this.mcastBindAddress = bind;
[...]
}

There are two items, here:

1. An address to bind to (locally)
2. A multicast target address

The constructor takes these two and calls them:

1. bind
2. mcastAddress

But the class members are called:

1. mcastBindAddress
2. address

The mcastBindAddress appears to be ignored in all but one place, where
the socket's interface is changed to it at McastServiceImpl.java:223:

220 if (mcastBindAddress != null) {
221 if(log.isInfoEnabled())
222 log.info(sm.getString("mcastServiceImpl.setInterface",
mcastBindAddress));
223 socket.setInterface(mcastBindAddress);
224 } //end if

I don't know enough about multicast to know what is supposed to be
happening, here. AFAIK, mcast is a broadcast mechanism and so there is
no difference between the "target" address and the "bind" address: you
just throw packets at the interface:port and that's that.

The code could probably use some clean-up, or at least some better
in-code documentation by someone who has a good understanding of the
whole situation.

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

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlzv7ysACgkQHPApP6U8
pFjuNg/8DkSdnsKkoTmGS1N37IXVcdj5cyHlmPC+BdP3NWE4oky0j5uFrGUqcaRG
UJLsPMvtZwgSaQ/wxgin4maluAmK77Agt76r6tXJNbbpdglXVyz7ONWO8a5xmk9R
ltqLWnHVw4a/HB5vatxFgqWWc6L1qWnocJL7/sWUn1M9y9Ee43/+h5OYnaBn9bCM
R1jqVhZAodC2k1eD3HXedCMaVIA4k2fZF+TteOHNu2rDr01mJVZzPjNJ/zy4sNg7
L0P0uuqCp3ylh563c3t+slL/9XFoVDNytD46qJlmDDcOYczNjf5An6dyWBJEX348
d0FdWOw5h45lJKhMd1L9WNLymxj3gQ9a3okfhiEqyunsZA4SbMNCPgy4an8tzBsd
HsX1dNgD6P8aoy2umG6SvqgAoPb0mZxlVVT1NdbXN0uybdv/mUJgjDHNsbaCYOxG
UNBfT/p5VQxURhRuNqHsFYvHtA6pxt8mZBbwsHC6b/uOYgPXPrLbM4oQztF2YEzI
RDOr2kmA+JbEj5qKOeQa3BVGT5bUeLRWH+fDFiXq6ubdBdvHAifPJyGdYgAFLvZq
jm85WJJeNvluwB602JUJ/FFxCYe6sKL7jaqfZJClqZrscUDxve0Fckh9xLrQ/il2
0W1VqfxuWeFL6P0SgJOr7aZxbdA293o1/X10E9o6sMuWoCtHfk8=
=jSBA
-END PGP SIGNATURE-

-
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

2019-05-30 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-trunk while 
building tomcat. Full details are available at:
https://ci.apache.org/builders/tomcat-trunk/builds/4402

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 master] 0bebe66d921072a3423cece63f3c2f8787d0342c
Blamelist: Mark Thomas 

Build succeeded!

Sincerely,
 -The Buildbot




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



[tomcat] branch master updated: Additional h2 concurrency / timeout fix

2019-05-30 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 0bebe66  Additional h2 concurrency / timeout fix
0bebe66 is described below

commit 0bebe66d921072a3423cece63f3c2f8787d0342c
Author: Mark Thomas 
AuthorDate: Thu May 30 13:39:05 2019 +0100

Additional h2 concurrency / timeout fix
---
 .../apache/coyote/http2/Http2UpgradeHandler.java   | 37 ++
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 880d365..4ecb642 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -133,6 +133,24 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 private final PingManager pingManager = getPingManager();
 private volatile int newStreamsSinceLastPrune = 0;
 // Tracking for when the connection is blocked (windowSize < 1)
+// The int array must have 3 elements. There are:
+//   [0] - The number of bytes the Stream requires from the connection
+// window. This excludes any allocation that has already been made.
+//   [1] - The number of bytes that has been allocated from the connection
+// window. This excludes any bytes that have been written since the
+// allocation was made.
+//   [2] - 1 if the stream thread has been notified that an allocation has
+// been made but has not yet consumed that allocation. 0 in all
+// other cases. The purpose of this is to avoid the incorrect
+// triggering of a timeout for the following sequence of events:
+// window update 1
+// allocation 1
+// notify 1
+// window update 2
+// allocation 2
+// act on notify 1 (using allocation 1 and 2)
+// notify 2
+// act on notify 2 (timeout due to no allocation)
 private final Map backLogStreams = new 
ConcurrentHashMap<>();
 private long backLogSize = 0;
 
@@ -765,12 +783,12 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 // Has this stream been granted an allocation
 int[] value = backLogStreams.get(stream);
 if (value == null) {
-value = new int[] { reservation, 0 };
+value = new int[] { reservation, 0, 0 };
 backLogStreams.put(stream, value);
 backLogSize += reservation;
 // Add the parents as well
 AbstractStream parent = stream.getParentStream();
-while (parent != null && 
backLogStreams.putIfAbsent(parent, new int[2]) == null) {
+while (parent != null && 
backLogStreams.putIfAbsent(parent, new int[3]) == null) {
 parent = parent.getParentStream();
 }
 } else {
@@ -783,11 +801,13 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 // backlog.
 backLogStreams.remove(stream);
 } else {
-// This allocation has been used. Reset the
-// allocation to zero. Leave the stream on
-// the backlog as it still has more bytes 
to
-// write.
+// This allocation has been used. Leave the
+// stream on the backlog as it still has
+// more bytes to write.
+// Reset the allocation to zero.
 value[1] = 0;
+// Clear the notify in progress marker
+value[2] = 0;
 }
 }
 }
@@ -931,7 +951,10 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 int allocation = entry.getValue()[1];
 if (allocation > 0) {
 backLogSize -= allocation;
-result.add(entry.getKey());
+if (entry.getValue()[2] == 0) {
+result.add(entry.getKey());
+entry.getValue()[2] = 1;
+}
 }
 }
 }


-

[tomcat] branch 8.5.x updated: Additional h2 concurrency / timeout fix

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 187cba6  Additional h2 concurrency / timeout fix
187cba6 is described below

commit 187cba6aa8e3e2b117748aa2d08b91fdf67fa653
Author: Mark Thomas 
AuthorDate: Thu May 30 13:39:05 2019 +0100

Additional h2 concurrency / timeout fix
---
 .../apache/coyote/http2/Http2UpgradeHandler.java   | 37 ++
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index ffb0919..a1aa77c 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -139,6 +139,24 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 private final PingManager pingManager = new PingManager();
 private volatile int newStreamsSinceLastPrune = 0;
 // Tracking for when the connection is blocked (windowSize < 1)
+// The int array must have 3 elements. There are:
+//   [0] - The number of bytes the Stream requires from the connection
+// window. This excludes any allocation that has already been made.
+//   [1] - The number of bytes that has been allocated from the connection
+// window. This excludes any bytes that have been written since the
+// allocation was made.
+//   [2] - 1 if the stream thread has been notified that an allocation has
+// been made but has not yet consumed that allocation. 0 in all
+// other cases. The purpose of this is to avoid the incorrect
+// triggering of a timeout for the following sequence of events:
+// window update 1
+// allocation 1
+// notify 1
+// window update 2
+// allocation 2
+// act on notify 1 (using allocation 1 and 2)
+// notify 2
+// act on notify 2 (timeout due to no allocation)
 private final ConcurrentMap backLogStreams = new 
ConcurrentHashMap<>();
 private long backLogSize = 0;
 
@@ -769,12 +787,12 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 // Has this stream been granted an allocation
 int[] value = backLogStreams.get(stream);
 if (value == null) {
-value = new int[] { reservation, 0 };
+value = new int[] { reservation, 0, 0 };
 backLogStreams.put(stream, value);
 backLogSize += reservation;
 // Add the parents as well
 AbstractStream parent = stream.getParentStream();
-while (parent != null && 
backLogStreams.putIfAbsent(parent, new int[2]) == null) {
+while (parent != null && 
backLogStreams.putIfAbsent(parent, new int[3]) == null) {
 parent = parent.getParentStream();
 }
 } else {
@@ -787,11 +805,13 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 // backlog.
 backLogStreams.remove(stream);
 } else {
-// This allocation has been used. Reset the
-// allocation to zero. Leave the stream on
-// the backlog as it still has more bytes 
to
-// write.
+// This allocation has been used. Leave the
+// stream on the backlog as it still has
+// more bytes to write.
+// Reset the allocation to zero.
 value[1] = 0;
+// Clear the notify in progress marker
+value[2] = 0;
 }
 }
 }
@@ -922,7 +942,10 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 int allocation = entry.getValue()[1];
 if (allocation > 0) {
 backLogSize -= allocation;
-result.add(entry.getKey());
+if (entry.getValue()[2] == 0) {
+result.add(entry.getKey());
+entry.getValue()[2] = 1;
+}
 }
 }
 }



Re: CDI support improvements

2019-05-30 Thread Romain Manni-Bucau
Hello Rémy,

Few precisions inline

Le jeu. 30 mai 2019 à 00:34, Rémy Maucherat  a écrit :

> Hi,
>
> On Wed, May 29, 2019 at 11:35 PM Romain Manni-Bucau 
> wrote:
>
>> Hi Rémy,
>>
>> Openwebbeans has a tomcat integration module - mainly standalone case,
>> and meecrowave subproject - embedded or ready to run fatjar. It looks like
>> it covers what you target. Where I am loosing track is why not improving
>> openwebbeans and forking the code in tomcat? At least i would expect to
>> discuss to move over tomcat the code on dev@owb - and I would support it
>> ;).
>>
>
> There's not a lot of code, so I don't call that a fork. The problem is
> that I need to make changes and adjustments in Tomcat, so in the end it
> can't be in owb. I used the code from webbeans-tomcat7, and didn't see any
> other modules (maybe you're referring to the ones in samples I just found).
>


Once done it can be hosted on both side.
Owb has the advantage to be know by users, tomcat to be a more natural home
for an integration. At the end it is mainly synchronizing both projects for
a consistent communication and code "move" IMHO.

For deep tomcat/cxf integration, you can use
http://svn.apache.org/repos/asf/openwebbeans/meecrowave/trunk/ - core
module. Technically it uses an embedded flavor but it would be easy to move
to a standalone one through a listener based on a small refactoring in
Meecrowave#start. The good part are the lifecycle and scanning integrations
+ the tooling to make testing and dev simple -
http://openwebbeans.apache.org/meecrowave/.


>> More technically: openwebbeans does not need properties files you can
>> pass Properties when you create the WebBeansContext, this is what tomee
>> does. Same for cxf and its bus ;).
>>
>
> Ok, I'll have a look at that, it's better than properties files (but
> similar).
>

>> Biggest short term challenge is to align scanners but it is very doable,
>> long term it is to drop big core jars in all 3 libs for smaller bundles ;).
>>
>
> Ok.
>
>>
>> Feel free to shout if you need help or more precise pointers.
>>
>
> Rémy
>
>>
>>
>> Le mer. 29 mai 2019 à 18:26, Rémy Maucherat  a écrit :
>>
>>> Hi,
>>>
>>> This was on my hackaton todo list, I guess I'm a bit late, but getting
>>> to it now ...
>>>
>>> CDI is the building brick for many other popular libraries and
>>> frameworks, including JAX-RS (Apache CXF), Eclipse Microprofile, etc.
>>> Looking at the CDI implementation from the ASF, I am not fully satisfied
>>> with the integration or packaging of OWB in the context of Tomcat. Since
>>> it's such an important building block, I wanted to do something about it
>>> and be able to have something that played better with Tomcat standalone, in
>>> addition to embedded (that is well covered !). As a result, I took on the
>>> task to take over the Tomcat(7 ;) ) integration that was in OWB.
>>>
>>> I'm working on it here: https://github.com/rmaucher/tomcat-owb
>>>
>>> The packaging is a big jar that is not done yet (the APIs would of
>>> course be separate JARs, but the goal is to have a big-OWB JAR tuned for
>>> Tomcat with the rest). Eventually if it works well enough, I would move it
>>> to https://github.com/apache/tomcat/tree/master/modules
>>>
>>> Note: I'm not a fan of the OWB configuration, it looks rather cryptic to
>>> me (properties files spread across all the JARs, I guess that's pluggable -
>>> even though it's not really needed here). I will look at that area for
>>> Tomcat specific improvements (the main listener could be used for
>>> configuration).
>>>
>>> Note 2: Apache CXF is quite the same first impression, when I download
>>> it I find a "lib/WHICH_JARS" file, which kind of says it all. So after OWB,
>>> it's possible there would be another tomcat-cxf module, which would be
>>> packaging only (I hope/expect the integration, which uses CDI and Servlets,
>>> will not need any real improvements).
>>>
>>> Comments ?
>>>
>>> Rémy
>>>
>>>