Re: CATALINA_BASE vs CATALINA_HOME: What must be where?

2020-09-28 Thread Konstantin Kolinko
пн, 28 сент. 2020 г. в 23:04, Christopher Schultz
:
>
> Konstantin,
>
> On 9/27/20 14:33, Konstantin Kolinko wrote:
> > сб, 26 сент. 2020 г. в 18:12, Christopher Schultz
> > :
> >>
> >> All,
> >>
> >> I'm writing about the above topic for ApacheCon @ Home and I wanted to
> >> get some confirmation about a few statements. The code is ... large and
> >> complex and it will be easier to just ask for help from those who Know.
> >>
> >> "
> >> Many files in CATALINA_BASE are optional
> >> * Override those in CATALINA_HOME
> >>  - conf/context.xml
> >
> > I think you are wrong with the above one. By design it has to be in
> > CATALINA_BASE, it cannot be in CATALINA_HOME.
> > E.g.
> > - org.a.c.startup.HostConfig.addGlobalRedeployResources() assumes that
> > the file is in CATALINA_BASE.
> > - org.a.c.startup.CatalinaBaseConfigurationSource#getResources() loads
> > a file from catalinaBase.
>
> My CATALINA_BASE deployments never include a conf/context.xml file. So
> either it's never required or it's only required if the application
> doesn't supply one.

I think that it just is not required. The default file is essentially empty.
It contains just a number of WatchedResource elements. I have not
checked whether there are defaults for them, but as I always run with
 they just do not matter. Maybe that happens
in your use case as well.

(Note that it does not override the file of CATALINA_HOME. The file in
CATALINA_HOME is not read and does not matter.)


By the way, one more thing to mention:
The behaviour of the "lib" directories: According to the value of
property "common.loader" as configured in catalina.properties file,
the libraries and classes are loaded from both base and home. The base
does not overwide home here, but they are combined (in a certain order
- see the value of that property).

Best regards,
Konstantin Kolinko

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



Re: CATALINA_BASE vs CATALINA_HOME: What must be where?

2020-09-28 Thread Christopher Schultz
Konstantin,

On 9/27/20 14:33, Konstantin Kolinko wrote:
> сб, 26 сент. 2020 г. в 18:12, Christopher Schultz
> :
>>
>> All,
>>
>> I'm writing about the above topic for ApacheCon @ Home and I wanted to
>> get some confirmation about a few statements. The code is ... large and
>> complex and it will be easier to just ask for help from those who Know.
>>
>> "
>> Many files in CATALINA_BASE are optional
>> * Override those in CATALINA_HOME
>>  - conf/context.xml
> 
> I think you are wrong with the above one. By design it has to be in
> CATALINA_BASE, it cannot be in CATALINA_HOME.
> E.g.
> - org.a.c.startup.HostConfig.addGlobalRedeployResources() assumes that
> the file is in CATALINA_BASE.
> - org.a.c.startup.CatalinaBaseConfigurationSource#getResources() loads
> a file from catalinaBase.

My CATALINA_BASE deployments never include a conf/context.xml file. So
either it's never required or it's only required if the application
doesn't supply one.

>> * Some files are required in CATALINA_BASE
>>  - conf/server.xml
>>  - conf/catalina.policy
>>  - conf/web.xml
> 
> catalina.policy is not needed if you are not running with a
> SecurotyManager enabled.

Ack.

>> Some Exceptions may be Surprising
>> * Only in CATALINA_HOME
>>  - bin/setclasspath.sh
> .
> That is some helper script that should not be customized.
> 
> When people modify that file it usually means that they have not read
> the documentation and do not know about setenv.sh.

I agree, but it's worth pointing out (a) it must be in HOME and (b) you
shouldn't be changing it.

>>  - endorsed/ (special Java libraries)
> 
> The path to endorsed directory is settable in setenv.sh. The directory
> can be anywhere. I have experience of running several Tomcat 7
> instances where only some of them had an endorsed directory. And I am
> sure that you know that it is a technology that does not work with
> modern versions of Java.

Agreed. I'm talking about a "stock" Tomcat: where will tomcat look for
things unless you override them. Assuming you already know how to
override them, then you don't need to know where their defaults are :)

>>  - bin/bootstrap.jar
>> "
>>
>> Is this all correct?
>>
>> Am I missing anything?
> 
> There may be some "last resort" defaults, e.g. I see that a copy of
> catalina.properties is present in catalina.jar. I also see that
> CatalinaBaseConfigurationSource#getResources() tries to load a
> resource from a ClassLoader, but it would be odd to put configuration
> there.
> 
> From the docs I know that a system property "catalina.config" may be
> used to override the path to the "catalina.properties" file, but I
> personally have not used that feature and do not know whether it is
> useful. As documentation for that property is improved in Tomcat 10 vs
> Tomcat 7, I think there was some discussion.
> 
> http://tomcat.apache.org/tomcat-10.0-doc/config/systemprops.html#Other
> http://tomcat.apache.org/tomcat-7.0-doc/config/systemprops.html#Other
> 
> I know that path to server.xml may be specified at the command line.
> See o.a.startup.Catalina#arguments() for "-config".
> I have not tested whether it works, and I do not see "-config" being
> documented in RUNNING.txt or elsewhere in the docs.

Ack.

Thanks for the review.

-chris

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



[Bug 64775] mod_jk is sending both Content-Length and Transfer-Encoding

2020-09-28 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64775

Sam Horrocks  changed:

   What|Removed |Added

 CC||s...@daemoninc.com

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 64775] New: mod_jk is sending both Content-Length and Transfer-Encoding

2020-09-28 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64775

Bug ID: 64775
   Summary: mod_jk is sending both Content-Length and
Transfer-Encoding
   Product: Tomcat Connectors
   Version: unspecified
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: mod_jk
  Assignee: dev@tomcat.apache.org
  Reporter: s...@daemoninc.com
  Target Milestone: ---

Our application uses "Transfer Encoding: chunked" and it started to hang after
upgrading mod_jk from 1.2.37 to 1.2.39. It's still broken in 1.2.48.  Looking
at the headers it's because mod_jk is sending both of the following:

  Transfer-Encoding: chunked
  Content-Length: 0

Our app is assuming the content is zero-length and stops reading. In 1.2.37
both headers were present but Content-Length was empty instead of zero, which
our app had been ignoring.

  Transfer-Encoding: chunked
  Content-Length:

According to the HTTP spec the web server should never send both of these
headers in the same response.  It looks like the patch in r1549202 started
sending a numeric Content-Length instead of an empty one which is when it broke
for us.

The following patch checks if the Content-Length is empty and if so doesn't
sent the header at all.  With this patch I only see the Transfer-Encoding
header and no Content-Length.

--- tomcat-connectors-1.2.48-src.orig/native/apache-2.0/mod_jk.c   
2020-02-20 11:43:15.0 -0500
+++ tomcat-connectors-1.2.48-src/native/apache-2.0/mod_jk.c 2020-09-18
10:56:14.564911842 -0400
@@ -395,7 +395,9 @@
 apr_table_set(r->headers_out, header_names[h], header_values[h]);
 }
 else if (!strcasecmp(header_names[h], "Content-Length")) {
-ap_set_content_length(r, apr_atoi64(header_values[h]));
+   if (strlen(header_values[h]) > 0) {
+   ap_set_content_length(r, apr_atoi64(header_values[h]));
+   }
 }
 else if (!strcasecmp(header_names[h], "Transfer-Encoding")) {
 apr_table_set(r->headers_out, header_names[h], header_values[h]);

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: [tomcat] branch master updated (519f6f8 -> 18e0e3f)

2020-09-28 Thread Martin Grigorov
On Mon, Sep 28, 2020 at 11:59 AM Mark Thomas  wrote:

> On 28/09/2020 09:13, Martin Grigorov wrote:
>
> 
>
> > Good news: there are no regressions!
>
> So far, so good.
>
> > Neutral news: there are no performance improvements according to my
> tests.
> > I use
> >
> https://github.com/martin-g/http2-server-perf-tests/blob/128f24e27ef96ee31740db4130855bea2c021793/java/tomcat/src/main/java/info/mgsolutions/tomcat/Main.java
> > to test HTTP2, h2c, HTTP and HTTPS
> > HTTP: 28K reqs/s
> > H2C: 14K reqs/s
> > HTTP2: 11K req/s
> >
> > I still use Vegeta as a test client + my patch to ignore CANCEL errors
>
> You might want to try without that CANCEL error patch. The Tomcat code
> should be more robust against that sort of error now as it retains state
> for at least 5x max concurrent streams now.
>

Confirmed!
Now Tomcat does not complain about the late CANCEL!


>
> I see slightly different figures when testing locally with Vegeta:
>
> HTTP:   30.5k req/s
> HTTPS:  18.0k req/s
> h2c:20.7k req/s
> h2: 17.2k req/s
>
> There are a couple of unexpected things there:
> - large drop from HTTP to HTTPS
> - similar HTTP figures for your test and mine but very different h2/h2c
>   figures
>
> Given how unrepresentative local testing is I'm not entirely surprised.
>
> I'm not planning on spending any time digging into these differences.
>

Thank you for the improvements !


>
> Running load tests with a profiler shows the biggest bottleneck is
> around I/O. There might be some small gains to be made with better
> buffering to reduce the number of network writes but implementing that
> change is more complex for the async HTTP/2 implementation.
>

Yes, I also see only network IO operations in the profiler now.


>
> 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 (519f6f8 -> 18e0e3f)

2020-09-28 Thread Rémy Maucherat
On Mon, Sep 28, 2020 at 10:59 AM Mark Thomas  wrote:

> On 28/09/2020 09:13, Martin Grigorov wrote:
>
> 
>
> > Good news: there are no regressions!
>
> So far, so good.
>
> > Neutral news: there are no performance improvements according to my
> tests.
> > I use
> >
> https://github.com/martin-g/http2-server-perf-tests/blob/128f24e27ef96ee31740db4130855bea2c021793/java/tomcat/src/main/java/info/mgsolutions/tomcat/Main.java
> > to test HTTP2, h2c, HTTP and HTTPS
> > HTTP: 28K reqs/s
> > H2C: 14K reqs/s
> > HTTP2: 11K req/s
> >
> > I still use Vegeta as a test client + my patch to ignore CANCEL errors
>
> You might want to try without that CANCEL error patch. The Tomcat code
> should be more robust against that sort of error now as it retains state
> for at least 5x max concurrent streams now.
>
> I see slightly different figures when testing locally with Vegeta:
>
> HTTP:   30.5k req/s
> HTTPS:  18.0k req/s
> h2c:20.7k req/s
> h2: 17.2k req/s
>
> There are a couple of unexpected things there:
> - large drop from HTTP to HTTPS
> - similar HTTP figures for your test and mine but very different h2/h2c
>   figures
>
> Given how unrepresentative local testing is I'm not entirely surprised.
>
> I'm not planning on spending any time digging into these differences.
>
> Running load tests with a profiler shows the biggest bottleneck is
> around I/O. There might be some small gains to be made with better
> buffering to reduce the number of network writes but implementing that
> change is more complex for the async HTTP/2 implementation.
>

I was planning to do a buffer queue at one point but then it didn't look so
nice and useful in practice.

Rémy


[tomcat] branch master updated: Optimize the iteration when closing idle streams

2020-09-28 Thread mgrigorov
This is an automated email from the ASF dual-hosted git repository.

mgrigorov 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 31cab22  Optimize the iteration when closing idle streams
31cab22 is described below

commit 31cab22e6a8071f8e29c9d2a63650087f6d0a65c
Author: Martin Tzvetanov Grigorov 
AuthorDate: Mon Sep 28 14:53:25 2020 +0300

Optimize the iteration when closing idle streams
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 49115d3..972a709 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -29,7 +29,7 @@ import java.util.Set;
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentNavigableMap;
 import java.util.concurrent.ConcurrentSkipListMap;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
@@ -124,7 +124,7 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 private HpackDecoder hpackDecoder;
 private HpackEncoder hpackEncoder;
 
-private final ConcurrentMap streams = new 
ConcurrentSkipListMap<>();
+private final ConcurrentNavigableMap 
streams = new ConcurrentSkipListMap<>();
 protected final AtomicInteger activeRemoteStreamCount = new 
AtomicInteger(0);
 // Start at -1 so the 'add 2' logic in closeIdleStreams() works
 private volatile int maxActiveRemoteStreamId = -1;
@@ -1530,12 +1530,12 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 
 
 private void closeIdleStreams(int newMaxActiveRemoteStreamId) {
-for (Entry entry : streams.entrySet()) {
-int id = entry.getKey().intValue();
-if (id > maxActiveRemoteStreamId && id < 
newMaxActiveRemoteStreamId) {
-if (entry.getValue() instanceof Stream) {
-((Stream) entry.getValue()).closeIfIdle();
-}
+final ConcurrentNavigableMap subMap = 
streams.subMap(
+Integer.valueOf(maxActiveRemoteStreamId), false,
+Integer.valueOf(newMaxActiveRemoteStreamId), false);
+for (AbstractNonZeroStream stream : subMap.values()) {
+if (stream instanceof Stream) {
+((Stream)stream).closeIfIdle();
 }
 }
 maxActiveRemoteStreamId = newMaxActiveRemoteStreamId;


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



[Bug 64771] Windows CPU processor always running by a thread reading request body from https connection

2020-09-28 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64771

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |NEEDINFO

--- Comment #4 from Mark Thomas  ---
There is insufficient information in the stack trace to identify a bug in
Tomcat.

I suspect that the application is retaining references to request/response
objects beyond the completion of the response.

I'd recommend re-testing without the Tomcat Native library. If you can
reproduce the issue with a pure Java stack it will be easier to debug.

What we really need is a *minimal* test case that reproduces this issue on a
clean install of the latest 9.0.x release.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: [tomcat] branch master updated (519f6f8 -> 18e0e3f)

2020-09-28 Thread Mark Thomas
On 28/09/2020 09:13, Martin Grigorov wrote:



> Good news: there are no regressions!

So far, so good.

> Neutral news: there are no performance improvements according to my tests.
> I use
> https://github.com/martin-g/http2-server-perf-tests/blob/128f24e27ef96ee31740db4130855bea2c021793/java/tomcat/src/main/java/info/mgsolutions/tomcat/Main.java
> to test HTTP2, h2c, HTTP and HTTPS
> HTTP: 28K reqs/s
> H2C: 14K reqs/s
> HTTP2: 11K req/s
> 
> I still use Vegeta as a test client + my patch to ignore CANCEL errors

You might want to try without that CANCEL error patch. The Tomcat code
should be more robust against that sort of error now as it retains state
for at least 5x max concurrent streams now.

I see slightly different figures when testing locally with Vegeta:

HTTP:   30.5k req/s
HTTPS:  18.0k req/s
h2c:20.7k req/s
h2: 17.2k req/s

There are a couple of unexpected things there:
- large drop from HTTP to HTTPS
- similar HTTP figures for your test and mine but very different h2/h2c
  figures

Given how unrepresentative local testing is I'm not entirely surprised.

I'm not planning on spending any time digging into these differences.

Running load tests with a profiler shows the biggest bottleneck is
around I/O. There might be some small gains to be made with better
buffering to reduce the number of network writes but implementing that
change is more complex for the async HTTP/2 implementation.

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 (519f6f8 -> 18e0e3f)

2020-09-28 Thread Martin Grigorov
On Mon, Sep 28, 2020 at 9:28 AM Martin Grigorov 
wrote:

> Hi,
>
> On Fri, Sep 25, 2020 at 4:40 PM Mark Thomas  wrote:
>
>> On 25/09/2020 14:34, ma...@apache.org wrote:
>> > 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 519f6f8  Fix a typo in changelog
>> >  new ee25710  Reduce memory footprint of closed http/2 streams
>> >  new f6e656e  Reduce memory footprint of closed http/2 streams
>> >  new 0f66705  Reduce memory footprint of closed http/2 streams
>> >  new fa6df26  Reduce memory footprint of closed http/2 streams
>> >  new 9ee7d6a  Reduce memory footprint of closed http/2 streams
>> >  new 30df6a0  Reduce memory footprint of closed http/2 streams
>> >  new 0a78ae9  Fully replace Stream with RecycledStream
>> >  new 954cbff  Refactor the pruning so more stream info is retained
>> for longer
>> >  new 18e0e3f  Update changelog
>>
>> All,
>>
>> This set of changes provided multiple improvements to the HTTP/2
>> implementation:
>>
>> 1. The memory used by closed streams is significantly reduced (hopefully
>>without the NPEs triggered by my previous attempt).
>> 2. We retain information on more streams in the priority tree. This
>>enables greater latitude for clients that send frames for streams
>>that have been closed (while not increasing memory).
>> 3. We no longer aggressively prune the priority tree to just active
>>streams (this was causing problems in some usage patterns).
>>
>> My plan is to let this run on the CI for a few days and then - assuming
>> no issues - back-port it early next week.
>>
>
> I will cherry-pick these commits to a branch [1] that I use for testing
> and profiling.
> I'll report back with the results!
>

Good news: there are no regressions!
Neutral news: there are no performance improvements according to my tests.
I use
https://github.com/martin-g/http2-server-perf-tests/blob/128f24e27ef96ee31740db4130855bea2c021793/java/tomcat/src/main/java/info/mgsolutions/tomcat/Main.java
to test HTTP2, h2c, HTTP and HTTPS
HTTP: 28K reqs/s
H2C: 14K reqs/s
HTTP2: 11K req/s

I still use Vegeta as a test client + my patch to ignore CANCEL errors
because I haven't found a better load client.
I've reported a bug against Golang net package:
https://github.com/golang/go/issues/41570


>
> 1.
> https://github.com/martin-g/tomcat/tree/http2/use-navigateable-map-for-http2-streams
>
>
>
>>
>> Mark
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: dev-h...@tomcat.apache.org
>>
>>


[Bug 64478] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header

2020-09-28 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64478

--- Comment #12 from Md. Adnan Rashidul Islam  ---
Hi,

Please check the following,

01) Monitoring parent profile on LTM. Also you can check the send string on the
parent profile. on the Parent profile the default should be GET /\r\n

02) Check if any extra space in the send string.

03) Additionally you can check if the correct output of /HealthInfo is set in
the F5 monitoring (I assume it's already checked)

If the above steps are all good then you may look into F5 devcentral for
specific F5 version's instruction.

Thanks,
Adnan

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Don't send the Keep-Alive response header is the connection is closed

2020-09-28 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 fe040cf  Don't send the Keep-Alive response header is the connection 
is closed
fe040cf is described below

commit fe040cf853aeb859653a24dbac13297abd1f6ba2
Author: Mark Thomas 
AuthorDate: Mon Sep 28 09:07:00 2020 +0100

Don't send the Keep-Alive response header is the connection is closed
---
 java/org/apache/coyote/http11/Http11Processor.java | 10 +++--
 .../org/apache/catalina/startup/TesterServlet.java | 17 
 .../apache/coyote/http11/TestHttp11Processor.java  | 51 ++
 webapps/docs/changelog.xml |  4 ++
 4 files changed, 70 insertions(+), 12 deletions(-)

diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index 13057c4..5d27a8d 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -1161,9 +1161,13 @@ public class Http11Processor extends AbstractProcessor {
 
 // FIXME: Add transfer encoding header
 
-if ((entityBody) && (!contentDelimitation)) {
-// Mark as close the connection after the request, and add the
-// connection: close header
+if ((entityBody) && (!contentDelimitation) || connectionClosePresent) {
+// Disable keep-alive if:
+// - there is a response body but way for the client to determine
+//   the content length information; or
+// - there is a "connection: close" header present
+// This will cause the "connection: close" header to be added if it
+// is not already present.
 keepAlive = false;
 }
 
diff --git a/test/org/apache/catalina/startup/TesterServlet.java 
b/test/org/apache/catalina/startup/TesterServlet.java
index 324d3f4..59851c9 100644
--- a/test/org/apache/catalina/startup/TesterServlet.java
+++ b/test/org/apache/catalina/startup/TesterServlet.java
@@ -28,6 +28,19 @@ public class TesterServlet extends HttpServlet {
 
 private static final long serialVersionUID = 1L;
 
+private final boolean explicitClose;
+
+
+public TesterServlet() {
+this(false);
+}
+
+
+public TesterServlet(boolean explicitClose) {
+this.explicitClose = explicitClose;
+}
+
+
 @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
 throws ServletException, IOException {
@@ -35,5 +48,9 @@ public class TesterServlet extends HttpServlet {
 resp.setContentType("text/plain");
 PrintWriter out = resp.getWriter();
 out.print("OK");
+
+if (explicitClose) {
+resp.setHeader("Connection", "close");
+}
 }
 }
diff --git a/test/org/apache/coyote/http11/TestHttp11Processor.java 
b/test/org/apache/coyote/http11/TestHttp11Processor.java
index 174793e..48a843b 100644
--- a/test/org/apache/coyote/http11/TestHttp11Processor.java
+++ b/test/org/apache/coyote/http11/TestHttp11Processor.java
@@ -1529,36 +1529,66 @@ public class TestHttp11Processor extends TomcatBaseTest 
{
 
 @Test
 public void testKeepAliveHeader01() throws Exception {
-doTestKeepAliveHeader(false, 3000, 10);
+doTestKeepAliveHeader(false, 3000, 10, false);
 }
 
 @Test
 public void testKeepAliveHeader02() throws Exception {
-doTestKeepAliveHeader(true, 5000, 1);
+doTestKeepAliveHeader(true, 5000, 1, false);
 }
 
 @Test
 public void testKeepAliveHeader03() throws Exception {
-doTestKeepAliveHeader(true, 5000, 10);
+doTestKeepAliveHeader(true, 5000, 10, false);
 }
 
 @Test
 public void testKeepAliveHeader04() throws Exception {
-doTestKeepAliveHeader(true, -1, 10);
+doTestKeepAliveHeader(true, -1, 10, false);
 }
 
 @Test
 public void testKeepAliveHeader05() throws Exception {
-doTestKeepAliveHeader(true, -1, 1);
+doTestKeepAliveHeader(true, -1, 1, false);
 }
 
 @Test
 public void testKeepAliveHeader06() throws Exception {
-doTestKeepAliveHeader(true, -1, -1);
+doTestKeepAliveHeader(true, -1, -1, false);
+}
+
+@Test
+public void testKeepAliveHeader07() throws Exception {
+doTestKeepAliveHeader(false, 3000, 10, true);
+}
+
+@Test
+public void testKeepAliveHeader08() throws Exception {
+doTestKeepAliveHeader(true, 5000, 1, true);
+}
+
+@Test
+public void testKeepAliveHeader09() throws Exception {
+doTestKeepAliveHeader(true, 5000, 10, true);
+}
+
+@Test
+public void testKeepAliveHeader10() throws Exception {
+doTestKeepAliveHeader(true, -1, 10, true);
+}
+
+@Test
+public void testKeepAliveHeader11() throws Exce

[Bug 64478] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header

2020-09-28 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64478

--- Comment #11 from Md. Adnan Rashidul Islam  ---
Hi,

Please check the following,

01) Monitoring parent profile on LTM. Also you can check the send string on the
parent profile. on the Parent profile the default should be GET /\r\n

02) Check if any extra space in the send string.

03) Additionally you can check if the correct output of /HealthInfo is set in
the F5 monitoring (I assume it's already checked)

If the above steps are all good then you may look into F5 devcentral for
specific F5 version's instruction.

Thanks,
Adnan

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Don't send the Keep-Alive response header is the connection is closed

2020-09-28 Thread markt
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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new c41d07e  Don't send the Keep-Alive response header is the connection 
is closed
c41d07e is described below

commit c41d07eced661c8a3eb94008dd30d4274a30b177
Author: Mark Thomas 
AuthorDate: Mon Sep 28 09:07:00 2020 +0100

Don't send the Keep-Alive response header is the connection is closed
---
 java/org/apache/coyote/http11/Http11Processor.java | 10 +++--
 .../org/apache/catalina/startup/TesterServlet.java | 17 
 .../apache/coyote/http11/TestHttp11Processor.java  | 51 ++
 webapps/docs/changelog.xml |  4 ++
 4 files changed, 70 insertions(+), 12 deletions(-)

diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index 1c72c33..fa9b290 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -924,9 +924,13 @@ public class Http11Processor extends AbstractProcessor {
 
 // FIXME: Add transfer encoding header
 
-if ((entityBody) && (!contentDelimitation)) {
-// Mark as close the connection after the request, and add the
-// connection: close header
+if ((entityBody) && (!contentDelimitation) || connectionClosePresent) {
+// Disable keep-alive if:
+// - there is a response body but way for the client to determine
+//   the content length information; or
+// - there is a "connection: close" header present
+// This will cause the "connection: close" header to be added if it
+// is not already present.
 keepAlive = false;
 }
 
diff --git a/test/org/apache/catalina/startup/TesterServlet.java 
b/test/org/apache/catalina/startup/TesterServlet.java
index 324d3f4..59851c9 100644
--- a/test/org/apache/catalina/startup/TesterServlet.java
+++ b/test/org/apache/catalina/startup/TesterServlet.java
@@ -28,6 +28,19 @@ public class TesterServlet extends HttpServlet {
 
 private static final long serialVersionUID = 1L;
 
+private final boolean explicitClose;
+
+
+public TesterServlet() {
+this(false);
+}
+
+
+public TesterServlet(boolean explicitClose) {
+this.explicitClose = explicitClose;
+}
+
+
 @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
 throws ServletException, IOException {
@@ -35,5 +48,9 @@ public class TesterServlet extends HttpServlet {
 resp.setContentType("text/plain");
 PrintWriter out = resp.getWriter();
 out.print("OK");
+
+if (explicitClose) {
+resp.setHeader("Connection", "close");
+}
 }
 }
diff --git a/test/org/apache/coyote/http11/TestHttp11Processor.java 
b/test/org/apache/coyote/http11/TestHttp11Processor.java
index b2107b0..ce4892e 100644
--- a/test/org/apache/coyote/http11/TestHttp11Processor.java
+++ b/test/org/apache/coyote/http11/TestHttp11Processor.java
@@ -1513,36 +1513,66 @@ public class TestHttp11Processor extends TomcatBaseTest 
{
 
 @Test
 public void testKeepAliveHeader01() throws Exception {
-doTestKeepAliveHeader(false, 3000, 10);
+doTestKeepAliveHeader(false, 3000, 10, false);
 }
 
 @Test
 public void testKeepAliveHeader02() throws Exception {
-doTestKeepAliveHeader(true, 5000, 1);
+doTestKeepAliveHeader(true, 5000, 1, false);
 }
 
 @Test
 public void testKeepAliveHeader03() throws Exception {
-doTestKeepAliveHeader(true, 5000, 10);
+doTestKeepAliveHeader(true, 5000, 10, false);
 }
 
 @Test
 public void testKeepAliveHeader04() throws Exception {
-doTestKeepAliveHeader(true, -1, 10);
+doTestKeepAliveHeader(true, -1, 10, false);
 }
 
 @Test
 public void testKeepAliveHeader05() throws Exception {
-doTestKeepAliveHeader(true, -1, 1);
+doTestKeepAliveHeader(true, -1, 1, false);
 }
 
 @Test
 public void testKeepAliveHeader06() throws Exception {
-doTestKeepAliveHeader(true, -1, -1);
+doTestKeepAliveHeader(true, -1, -1, false);
+}
+
+@Test
+public void testKeepAliveHeader07() throws Exception {
+doTestKeepAliveHeader(false, 3000, 10, true);
+}
+
+@Test
+public void testKeepAliveHeader08() throws Exception {
+doTestKeepAliveHeader(true, 5000, 1, true);
+}
+
+@Test
+public void testKeepAliveHeader09() throws Exception {
+doTestKeepAliveHeader(true, 5000, 10, true);
+}
+
+@Test
+public void testKeepAliveHeader10() throws Exception {
+doTestKeepAliveHeader(true, -1, 10, true);
+}
+
+@Test
+public void testKeepAliveHeader11() throws Except

[tomcat] branch master updated: Don't send the Keep-Alive response header is the connection is closed

2020-09-28 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 a20f6f3  Don't send the Keep-Alive response header is the connection 
is closed
a20f6f3 is described below

commit a20f6f3f209441013996abe7f8049f1c8793841a
Author: Mark Thomas 
AuthorDate: Mon Sep 28 09:07:00 2020 +0100

Don't send the Keep-Alive response header is the connection is closed
---
 java/org/apache/coyote/http11/Http11Processor.java | 10 +++--
 .../org/apache/catalina/startup/TesterServlet.java | 17 
 .../apache/coyote/http11/TestHttp11Processor.java  | 51 ++
 webapps/docs/changelog.xml |  4 ++
 4 files changed, 70 insertions(+), 12 deletions(-)

diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index 98b1f23..22f8787 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -924,9 +924,13 @@ public class Http11Processor extends AbstractProcessor {
 
 // FIXME: Add transfer encoding header
 
-if ((entityBody) && (!contentDelimitation)) {
-// Mark as close the connection after the request, and add the
-// connection: close header
+if ((entityBody) && (!contentDelimitation) || connectionClosePresent) {
+// Disable keep-alive if:
+// - there is a response body but way for the client to determine
+//   the content length information; or
+// - there is a "connection: close" header present
+// This will cause the "connection: close" header to be added if it
+// is not already present.
 keepAlive = false;
 }
 
diff --git a/test/org/apache/catalina/startup/TesterServlet.java 
b/test/org/apache/catalina/startup/TesterServlet.java
index 79e7328..219c08a 100644
--- a/test/org/apache/catalina/startup/TesterServlet.java
+++ b/test/org/apache/catalina/startup/TesterServlet.java
@@ -28,6 +28,19 @@ public class TesterServlet extends HttpServlet {
 
 private static final long serialVersionUID = 1L;
 
+private final boolean explicitClose;
+
+
+public TesterServlet() {
+this(false);
+}
+
+
+public TesterServlet(boolean explicitClose) {
+this.explicitClose = explicitClose;
+}
+
+
 @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
 throws ServletException, IOException {
@@ -35,5 +48,9 @@ public class TesterServlet extends HttpServlet {
 resp.setContentType("text/plain");
 PrintWriter out = resp.getWriter();
 out.print("OK");
+
+if (explicitClose) {
+resp.setHeader("Connection", "close");
+}
 }
 }
diff --git a/test/org/apache/coyote/http11/TestHttp11Processor.java 
b/test/org/apache/coyote/http11/TestHttp11Processor.java
index 0ef395e..346f264 100644
--- a/test/org/apache/coyote/http11/TestHttp11Processor.java
+++ b/test/org/apache/coyote/http11/TestHttp11Processor.java
@@ -1513,36 +1513,66 @@ public class TestHttp11Processor extends TomcatBaseTest 
{
 
 @Test
 public void testKeepAliveHeader01() throws Exception {
-doTestKeepAliveHeader(false, 3000, 10);
+doTestKeepAliveHeader(false, 3000, 10, false);
 }
 
 @Test
 public void testKeepAliveHeader02() throws Exception {
-doTestKeepAliveHeader(true, 5000, 1);
+doTestKeepAliveHeader(true, 5000, 1, false);
 }
 
 @Test
 public void testKeepAliveHeader03() throws Exception {
-doTestKeepAliveHeader(true, 5000, 10);
+doTestKeepAliveHeader(true, 5000, 10, false);
 }
 
 @Test
 public void testKeepAliveHeader04() throws Exception {
-doTestKeepAliveHeader(true, -1, 10);
+doTestKeepAliveHeader(true, -1, 10, false);
 }
 
 @Test
 public void testKeepAliveHeader05() throws Exception {
-doTestKeepAliveHeader(true, -1, 1);
+doTestKeepAliveHeader(true, -1, 1, false);
 }
 
 @Test
 public void testKeepAliveHeader06() throws Exception {
-doTestKeepAliveHeader(true, -1, -1);
+doTestKeepAliveHeader(true, -1, -1, false);
+}
+
+@Test
+public void testKeepAliveHeader07() throws Exception {
+doTestKeepAliveHeader(false, 3000, 10, true);
+}
+
+@Test
+public void testKeepAliveHeader08() throws Exception {
+doTestKeepAliveHeader(true, 5000, 1, true);
+}
+
+@Test
+public void testKeepAliveHeader09() throws Exception {
+doTestKeepAliveHeader(true, 5000, 10, true);
+}
+
+@Test
+public void testKeepAliveHeader10() throws Exception {
+doTestKeepAliveHeader(true, -1, 10, true);
+}
+
+@Test
+public void testKeepAliveHeader11() throws Exce

[Bug 64478] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header

2020-09-28 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64478

--- Comment #10 from Deviduttapanda  ---
Hi Adnan,
yes we have recently upgraded to Tomcat 9.0.36

the previous version was 9.0.29 and it was working fine.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 64478] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header

2020-09-28 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64478

--- Comment #9 from Md. Adnan Rashidul Islam  ---
Hi Deviduttapanda,

have you recently upgraded to Tomcat version 9.0.36? Is the issue occurred in
the previous version? what was the previous version of Tomcat?

Thanks.

(In reply to Deviduttapanda from comment #7)
> Hi Md. Adnan Rashidul.
> 
> Need your support here, I am also facing the same issue as we are using
> Tomcat 9.0.36 behind F5 and F5 sendstring is GET /HealthInfo /r/n
> 
> 
> 
> 
> (In reply to Md. Adnan Rashidul Islam from comment #5)
> > Hi Mark,
> > 
> > Thanks. We have resolved the issue. The http request has been sent by
> > reverse proxy from HTTP/0.9 protocol with the tailing double pair of RCFL
> > which is not supported by HTTP/1.1. So we have changed the RCFL and then it
> > works. Thanks.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org