Re: [SECURITY] CVE-2017-12617 Apache Tomcat Remote Code Execution via JSP upload

2017-10-04 Thread Michael Smith
Mark,

Do you know if tomcat 5.x and 6.x are vulnerable to this issue? I know they
are not supported, but are they exploitable by this vulnerability?

Thx

Mike

On 3 October 2017 at 11:55, Mark Thomas  wrote:

> CVE-2017-12617 Apache Tomcat Remote Code Execution via JSP Upload
>
> Severity: Important
>
> Vendor: The Apache Software Foundation
>
> Versions Affected:
> Apache Tomcat 9.0.0.M1 to 9.0.0
> Apache Tomcat 8.5.0 to 8.5.22
> Apache Tomcat 8.0.0.RC1 to 8.0.46
> Apache Tomcat 7.0.0 to 7.0.81
>
> Description:
> When running with HTTP PUTs enabled (e.g. via setting the readonly
> initialisation parameter of the Default servlet to false) it was
> possible to upload a JSP file to the server via a specially crafted
> request. This JSP could then be requested and any code it contained
> would be executed by the server.
>
> Mitigation:
> Users of the affected versions should apply one of the following
> mitigations:
> - Upgrade to Apache Tomcat 9.0.1 or later
> - Upgrade to Apache Tomcat 8.5.23 or later
> - Upgrade to Apache Tomcat 8.0.47 or later
> - Upgrade to Apache Tomcat 7.0.82 or later
>
> Credit:
> This issue was first reported publicly followed by multiple reports to
> the Apache Tomcat Security Team.
>
> History:
> 2017-10-03 Original advisory
>
> References:
> [1] http://tomcat.apache.org/security-9.html
> [2] http://tomcat.apache.org/security-8.html
> [3] http://tomcat.apache.org/security-7.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


RE: JMX currentThreadsBusy less than connections/requests when use APR connector

2017-03-08 Thread smith
Our production usage also has same phenomenon that my "currentThreadsBusy" 
always not high (3-5), but my "currentThreadCount" will go to 200-300 
sometimes. I know that at some busy time, more threads will be created, so the 
thread pool get high, but at the same time, the busy threads will also 
increase, but I never catch when it also went high.

-Original Message-
From: Suvendu Sekhar Mondal [mailto:suv3...@gmail.com] 
Sent: Wednesday, March 08, 2017 1:43 PM
To: Tomcat Users List
Subject: Re: JMX currentThreadsBusy less than connections/requests when use APR 
connector

Linbo,

"currentThreadsBusy" is number of busy threads. These are the threads are being 
actively use. If you are seeing this count > 0 for long time(depending on your 
application type), then most likely you have "hung thread". In that case thread 
dump analysis will show you root of the problem.

"currentThreadCount" is current threads in thread pool. To track thread pool 
usage, you can use this counter.

Thanks!
Suvendu

On Wed, Mar 8, 2017 at 8:44 AM, linbo liao  wrote:
> Hi,
>
> I setup local environment to test Tomcat monitor.
>
> The Environment:
>
> Tomcat: 8.5.5
> VM: Ubuntu 14.04.1 LTS
> HTTP PORT: 8080
> IP: 10.211.55.4
>
> Tomcat use APR connector, I test the tomcat via ab command, find JMX 
> currentThreadsBusy < 10 all of the time.
>
> ab -n 10 -c 100 10.211.55.4:8080/
>>
>
> I tried to search the reason but without the result. For BIO each 
> thread to handle one connection, so currentThreadsBusy can show the 
> performance of tomcat.
>
> But for APR connector, what's the meaning of currentThreadsBusy?
>
> Thanks in advance.
>
> Thanks,
> Linbo

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



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



RE: FW: tomcat 8080 thread not reduced

2017-01-21 Thread smith
Hi, Chris

We don't just care about free, we care about active too. We know how many free 
also means how many are active

We are using HTTP

Let's me take one example from manager status: (this is the manager output)
Max threads: 200 Current thread count: 23 Current thread busy: 1 Keeped alive 
sockets count: 1

Current thread count: 23 I want to know if these 23 threads are free to use, or 
they are active, cannot accept new connection? Here are Keeped alive sockets 
count, it's only 1, is this 1 for the busy thread or a thread in 23?

-Smith

-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: Friday, January 20, 2017 10:29 PM
To: Tomcat Users List
Subject: Re: FW: tomcat 8080 thread not reduced

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Smith,

On 1/19/17 9:59 PM, smith wrote:
>> "busy" is the same as "active".
> 
> When not use , our busy thread always keep under 10 while 
> the currentThreadCount keeps high (these are get from tomcat manager), 
> So we really don't know how many threads are truly free.

Why do you care how many are free? Isn't it more important to know how many are 
active? For example, I run my app servers with maxThreads="150" for the most 
part. Then, I have Nagios notify me if the "active count" goes above 135 
(that's 90% of my maxThreads).

Nagios, like many monitoring systems, won't scream the first time it sees 
something. Instead, it will check again a few times before complaining. That 
means that as long as I don't see any significant duration where the active 
thread count exceeds 135, I don't get any alarms going off.

And I don't care how many "free" threads I have. I've decided that I want "150 
and NO MORE". Nothing else matters except the active count.
I don't happen to allow the thread pool to re-size downward (fewer threads), 
but if I did, I wouldn't have to change my monitoring at all. What? The active 
count is 10 and the total pool size is 20? I don't care. Wake me up when the 
active thread count stays high for a while, indicating to me that we are 
getting hammered.

> How many are in keepAlivedStatus

Use NIO and forget about it.

Besides, you are using *AJP*. Every thread is *always* in a keepalive state. So 
keepalive == idle as far as Tomcat is concerned.

If you were using HTTP, then keepalive would be an issue (and NIO would be the 
answer), but you aren't, so it's not.

- -chris

> -Original Message- From: Christopher Schultz 
> [mailto:ch...@christopherschultz.net] Sent: Thursday, January 19,
> 2017 4:38 PM To: Tomcat Users List Subject: Re: FW: tomcat 8080 thread 
> not reduced
> 
> Smith,
> 
> On 1/18/17 8:25 PM, smith wrote:
>> I don't care if the threads will be reduced, I just want to know why.
> 
> Okay.
> 
>> And we want to use the account to determine when the tomcat capacity 
>> is not enough that we need to add max configuration or add new tomcat 
>> servers.
> 
> Set your initial and max threads to the same value (pool size =
> constant) and then monitor the "active count" with a Nagios warning at 
> e.g. 80% usage.
> 
>> Since not use the , the busy thread account also cannot 
>> tell us the correct active threads count.
> 
> "busy" is the same as "active".
> 
>> In another email thread, you said if use , it will tell us 
>> the right active thread count not just busy count, right?
> 
> I would always use an  for at least two different
> reasons:
> 
> 1. Thread management (e.g. reducing threads if necessary) 2. Shared 
> thread-pools (no need to have port 8080 and 8443 with separate
> pools)
> 
> -chris
> 
>> -----Original Message- From: Christopher Schultz 
>> [mailto:ch...@christopherschultz.net] Sent: Wednesday, January 18, 
>> 2017 3:28 PM To: Tomcat Users List Subject: Re: FW: tomcat
>> 8080 thread not reduced
> 
>> Smith,
> 
>> On 1/18/17 12:47 AM, smith wrote:
>>> So the tomcat default executor will not reduce the thread count 
>>> until it reach to the max configuration?
> 
>> By default, you get a thread pool that isn't as smart as an executor.
> 
>>> Will it reduce when it reach to max?
> 
>> Not unless you use an .
> 
>>> And why the default not reduce the thread?
> 
>> Because it didn't do so in the past, before  was 
>> introduced.
> 
>> I'm curious: if you are willing to have e.g. 200 threads available at 
>> any time during the life of the JVM, why does it matter if those 
>> threads are reduced during times of inactivity?
> 
>> I think of threads as a resource like memory, where if you are going 
>> to allocate X resources, you may as well allocate X resources an

RE: FW: tomcat 8080 thread not reduced

2017-01-19 Thread smith
Hi, chris:

>"busy" is the same as "active".
When not use , our busy thread always keep under 10 while the 
currentThreadCount keeps high (these are get from tomcat manager), So we really 
don't know how many threads are truly free. How many are in keepAlivedStatus


-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: Thursday, January 19, 2017 4:38 PM
To: Tomcat Users List
Subject: Re: FW: tomcat 8080 thread not reduced

-BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Smith,

On 1/18/17 8:25 PM, smith wrote:
> I don't care if the threads will be reduced, I just want to know why.

Okay.

> And we want to use the account to determine when the tomcat capacity 
> is not enough that we need to add max configuration or add new tomcat 
> servers.

Set your initial and max threads to the same value (pool size =
constant) and then monitor the "active count" with a Nagios warning at e.g. 80% 
usage.

> Since not use the , the busy thread account also cannot tell 
> us the correct active threads count.

"busy" is the same as "active".

> In another email thread, you said if use , it will tell us 
> the right active thread count not just busy count, right?

I would always use an  for at least two different reasons:

1. Thread management (e.g. reducing threads if necessary) 2. Shared 
thread-pools (no need to have port 8080 and 8443 with separate pools)

- -chris

> -Original Message- From: Christopher Schultz 
> [mailto:ch...@christopherschultz.net] Sent: Wednesday, January 18,
> 2017 3:28 PM To: Tomcat Users List Subject: Re: FW: tomcat 8080 thread 
> not reduced
> 
> Smith,
> 
> On 1/18/17 12:47 AM, smith wrote:
>> So the tomcat default executor will not reduce the thread count until 
>> it reach to the max configuration?
> 
> By default, you get a thread pool that isn't as smart as an executor.
> 
>> Will it reduce when it reach to max?
> 
> Not unless you use an .
> 
>> And why the default not reduce the thread?
> 
> Because it didn't do so in the past, before  was introduced.
> 
> I'm curious: if you are willing to have e.g. 200 threads available at 
> any time during the life of the JVM, why does it matter if those 
> threads are reduced during times of inactivity?
> 
> I think of threads as a resource like memory, where if you are going 
> to allocate X resources, you may as well allocate X resources and be 
> done with it. Growing and shrinking pools of things just adds 
> complexity and reduces performance.
> 
> Idle threads are "free" other than using a little bit of memory.
> So why is it so important for those threads to stop when they don't 
> have any work for a while?
> 
> -chris
> 
>> -Original Message- From: Christopher Schultz 
>> [mailto:ch...@christopherschultz.net] Sent: Tuesday, January 17,
>>  2017 7:18 PM To: Tomcat Users List Subject: Re: FW: tomcat 8080 
>> thread not reduced
> 
>> Smith,
> 
>> On 1/16/17 8:22 PM, smith wrote:
>>> Yes, I think thread count should be reduced when those threads are 
>>> idle
> 
>>> Is this right? Or it will not reduced?
> 
>> Id you want Tomcat to reduce the number of idle threads, you'll need 
>> to explicitly configure an  and use that with your  
>>  .
> 
>> -chris
> 
>>> -Original Message- From: Christopher Schultz 
>>> [mailto:ch...@christopherschultz.net] Sent: Monday, January 16,
>>>  2017 2:20 PM To: Tomcat Users List Subject: Re: FW: tomcat
>>> 8080 thread not reduced
> 
>>> Smith,
> 
>>> There are your only active s:
> 
>>> On 1/14/17 1:30 AM, smith wrote:
>>>> >>> connectionTimeout="2" redirectPort="8443" />
> 
>>>> [snip]
> 
>>>> >>>  />
> 
>>> You have not changed any settings from the default. What makes you 
>>> think that your thread count should be reduced when those threads 
>>> are idle?
> 
>>> -chris
> 
>>> 
- -
>
>>>
>>> 
>>> 
> 
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 
>>> 
- -
>
>>>
>>> 
>>> 
> 
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
>

RE: FW: tomcat 8080 thread not reduced

2017-01-18 Thread smith
Hi, Christopher

I don't care if the threads will be reduced, I just want to know why. And we 
want to use the account to determine when the tomcat capacity is not enough 
that we need to add max configuration or add new tomcat servers.

Since not use the , the busy thread account also cannot tell us the 
correct active threads count. In another email thread, you said if use 
, it will tell us the right active thread count not just busy count, 
right?

-smith

-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: Wednesday, January 18, 2017 3:28 PM
To: Tomcat Users List
Subject: Re: FW: tomcat 8080 thread not reduced

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Smith,

On 1/18/17 12:47 AM, smith wrote:
> So the tomcat default executor will not reduce the thread count until 
> it reach to the max configuration?

By default, you get a thread pool that isn't as smart as an executor.

> Will it reduce when it reach to max?

Not unless you use an .

> And why the default not reduce the thread?

Because it didn't do so in the past, before  was introduced.

I'm curious: if you are willing to have e.g. 200 threads available at any time 
during the life of the JVM, why does it matter if those threads are reduced 
during times of inactivity?

I think of threads as a resource like memory, where if you are going to 
allocate X resources, you may as well allocate X resources and be done with it. 
Growing and shrinking pools of things just adds complexity and reduces 
performance.

Idle threads are "free" other than using a little bit of memory. So why is it 
so important for those threads to stop when they don't have any work for a 
while?

- -chris

> -Original Message- From: Christopher Schultz 
> [mailto:ch...@christopherschultz.net] Sent: Tuesday, January 17,
> 2017 7:18 PM To: Tomcat Users List Subject: Re: FW: tomcat 8080 thread 
> not reduced
> 
> Smith,
> 
> On 1/16/17 8:22 PM, smith wrote:
>> Yes, I think thread count should be reduced when those threads are 
>> idle
> 
>> Is this right? Or it will not reduced?
> 
> Id you want Tomcat to reduce the number of idle threads, you'll need 
> to explicitly configure an  and use that with your 
>  .
> 
> -chris
> 
>> -Original Message- From: Christopher Schultz 
>> [mailto:ch...@christopherschultz.net] Sent: Monday, January 16,
>> 2017 2:20 PM To: Tomcat Users List Subject: Re: FW: tomcat 8080 
>> thread not reduced
> 
>> Smith,
> 
>> There are your only active s:
> 
>> On 1/14/17 1:30 AM, smith wrote:
>>> >> connectionTimeout="2" redirectPort="8443" />
> 
>>> [snip]
> 
>>> >> />
> 
>> You have not changed any settings from the default. What makes you 
>> think that your thread count should be reduced when those threads are 
>> idle?
> 
>> -chris
> 
>> -
>
>> 
> 
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 
>> -
>
>> 
> 
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> -
>
> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 
> -
>
> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYf4mVAAoJEBzwKT+lPKRYE1cQALnUh2se9iXDJB3r/1TiHfiy
RCEnqgjeYKaVyO0wBvG5PqyXGwedsh2i2TzuUW5zHXEi5qZhr91oZ/sEG8yOpdfv
zOb9ZeFpWJpkVuj/pa2kjszEs+gpUhth4+45ou7N9WAAkDsl4oWpHzC2aEWbNByf
u9gkt8yq5ZSccFP7/Xb7GhcjIKYpK+qK/1/U+vD9eC6sFuzpewC7+aZ1FwpQ7/6L
DlbqGRM3Uj0Yvft6YNfrmN5SY8VY4shv0f/b83tmaH8Bz2bgGhhqddAm/vSpDu44
67YU55m36NL9hTbiS4E/CnLCnZxsY7+RtR4Xz2g51KN7+OoKZIgQN7XzHYhQbTZS
NPZG1ejkE6s0R8oIjYHAO8cucSGshD7de42mdq6wrrxDrSodm29zUWS8TEgOkUBp
kuX7MzpmZt0s5YjSjwMLWXpWlmrVvbxawGNgZCFmz/At9FPt+BboymzsWQSEA+wQ
QgJHjXzp5iSskYxYdIPFCb+nhAk0AAqWG4NQs0KMRsGTqnwYYnCVT/YF2Se2kTpv
eUqlwI2rjPXiW2tKuDm+ZMENu6EbySSyngq7Ad0paIq4qXXp0QcGCN9SWSRgt6/g
YePmBR37SLKOrrkfWPFS/NRLEZg/pWhEcKVMuCDJSF/kGOca4AytQsJiZ66k0ecM
Jklop2vxVLIm1rEdO/m2
=ks8D
-END PGP SIGNATURE-

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



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



Re[2]: FW: tomcat 8080 thread not reduced

2017-01-18 Thread Smith Hua

thanks, 
our monitor is getting the result from the tomcat manager page which provides 
the busy threads count and totol threads count, i'm not sure if tomcat manager 
treat the keepAlived thread as free.
if the tomcat manager treat the keepAlived thread as free, seems we can't kown 
what's the concurrent work threads, when we need to add the max threads or add 
more tomcat servers.
shall we use current total threads to judge this? if it reaches to max 
configured threads, need to add max threads or add tomcat servers?
--
从myMail的Android专用app所发送 星期三, 18 一月 2017, 06:08下午 +08:00 发件人 André Warnier 
(tomcat)  a...@ice-sa.com :

>On 18.01.2017 10:56, smith wrote:
>> Hi, André
>>
>> Thanks for the great explanation. So the current thread count will grow 
>> always until it reaches to the max configuration.
>>
>> I have another strange thing:
>> We never monitored tomcat busy thread count high (we monitored one minutes 
>> interval through Nagios to get tomcat manager result, not high than 10). So 
>> if the threads grows, it should monitored the busy thread count reach that 
>> high(or some lower). So I'm still not understand when the current thread 
>> count will grow while current busy thread has not change a lot.
>>
>
>I think that if you combine my explanation of the KeepAlive effect, with 
>Philippe's notes, 
>you may get the explanation.
>I would personally guess that your monitoring agent does not consider a thread 
>that is 
>idle in KeepAlive state, as "busy".  So it only counts as busy, the threads 
>which are 
>effectively in the state of processing a request.
>(This is just a guess; I think you may want to draw a little time-dependent 
>diagram, to 
>see what really happens, with a KeepAlive of 20 seconds, and ping or heartbeat 
>requests 
>coming in regularly.)
>In any case, if you want to avoid this phenomenon altogether, try configuring 
>an Executor. 
>You need to configure the  itself, and then in your , 
>refer to that 
>Executor).
>
>
>
>
>>
>>
>> -Original Message-
>> From: André Warnier (tomcat) [mailto:a...@ice-sa.com]
>> Sent: Wednesday, January 18, 2017 9:41 AM
>> To:  users@tomcat.apache.org
>> Subject: Re: FW: tomcat 8080 thread not reduced
>>
>> Hi.
>>
>> I believe that what Philippe mentions below is somewhat different : in his 
>> configuration, there is apparently a front-end httpd server, which 
>> communicates with Tomcat via AJP and the tomcat AJP Connector.
>> In such a case, the "mod_jk" or "mod_proxy_ajp" connector module inside of 
>> httpd, creates a series of connections to the back-end tomcat, and keeps 
>> these connections alive in a pool of connections, according to rules which 
>> are different, than what applies to your case (which consists of direct HTTP 
>> connections from browsers, to the tomcat HTTP connector).
>> So Philippe's case introduces probably an additional level of complexity 
>> into the equation.
>> semi-graphically :
>>
>> smith case :
>>
>> client <- HTTP -> tomcat HTTP connector - tomcat thread
>>
>> Philippe's case :
>>
>> client <- HTTP -> apache httpd + ajp module <- AJP -> tomcat AJP connector - 
>> tomcat thread
>>
>> The real question is :
>>
>> The tomcat 8.0 HTTP Connector documentation
>> ( http://tomcat.apache.org/tomcat-8.0-doc/config/http.html ) mentions a 
>> series of attributes/parameters (maxThreads, minSpareThreads, 
>> connectionTimeout,
>> keepAliveTimeout,..) which, together, would lead one to believe that tomcat 
>> is managing the number of threads dynamically (increasing the number of 
>> threads (up to maxThreads) when needed to process simultaneous requests, and 
>> decreasing the number of threads again (down to minSpareThreads) when less 
>> requests are being processed).
>>
>> According to observations however (and to Chris' comments), that does not 
>> seem to be the case : once the number of threads has grown to a certain 
>> number, it never goes down back down again.
>> It has to be said that the above interpretation was mine, and the current 
>> documentation of the HTTP Connector never says explicitly that, on its own, 
>> it manages the number of threads dynamically. But it *does* mention a 
>> minSpareThreads parameter.
>>
>> On the other hand, when you use an Executor 
>> (http://tomcat.apache.org/tomcat-8.0-doc/config/executor.html), then the 
>> documentation states explicitly that the number of threads *is* dynamically 
>> managed, up and down.
>>
>> I found something else 

Re[2]: FW: tomcat 8080 thread not reduced

2017-01-18 Thread Smith Hua

thanks, our monitor is getting the result from the tomcat manager page which 
provides the busy threads count and totol threads count
--
从myMail的Android专用app所发送 星期三, 18 一月 2017, 06:08下午 +08:00 发件人 André Warnier 
(tomcat)  a...@ice-sa.com :

>On 18.01.2017 10:56, smith wrote:
>> Hi, André
>>
>> Thanks for the great explanation. So the current thread count will grow 
>> always until it reaches to the max configuration.
>>
>> I have another strange thing:
>> We never monitored tomcat busy thread count high (we monitored one minutes 
>> interval through Nagios to get tomcat manager result, not high than 10). So 
>> if the threads grows, it should monitored the busy thread count reach that 
>> high(or some lower). So I'm still not understand when the current thread 
>> count will grow while current busy thread has not change a lot.
>>
>
>I think that if you combine my explanation of the KeepAlive effect, with 
>Philippe's notes, 
>you may get the explanation.
>I would personally guess that your monitoring agent does not consider a thread 
>that is 
>idle in KeepAlive state, as "busy".  So it only counts as busy, the threads 
>which are 
>effectively in the state of processing a request.
>(This is just a guess; I think you may want to draw a little time-dependent 
>diagram, to 
>see what really happens, with a KeepAlive of 20 seconds, and ping or heartbeat 
>requests 
>coming in regularly.)
>In any case, if you want to avoid this phenomenon altogether, try configuring 
>an Executor. 
>You need to configure the  itself, and then in your , 
>refer to that 
>Executor).
>
>
>
>
>>
>>
>> -Original Message-
>> From: André Warnier (tomcat) [mailto:a...@ice-sa.com]
>> Sent: Wednesday, January 18, 2017 9:41 AM
>> To:  users@tomcat.apache.org
>> Subject: Re: FW: tomcat 8080 thread not reduced
>>
>> Hi.
>>
>> I believe that what Philippe mentions below is somewhat different : in his 
>> configuration, there is apparently a front-end httpd server, which 
>> communicates with Tomcat via AJP and the tomcat AJP Connector.
>> In such a case, the "mod_jk" or "mod_proxy_ajp" connector module inside of 
>> httpd, creates a series of connections to the back-end tomcat, and keeps 
>> these connections alive in a pool of connections, according to rules which 
>> are different, than what applies to your case (which consists of direct HTTP 
>> connections from browsers, to the tomcat HTTP connector).
>> So Philippe's case introduces probably an additional level of complexity 
>> into the equation.
>> semi-graphically :
>>
>> smith case :
>>
>> client <- HTTP -> tomcat HTTP connector - tomcat thread
>>
>> Philippe's case :
>>
>> client <- HTTP -> apache httpd + ajp module <- AJP -> tomcat AJP connector - 
>> tomcat thread
>>
>> The real question is :
>>
>> The tomcat 8.0 HTTP Connector documentation
>> ( http://tomcat.apache.org/tomcat-8.0-doc/config/http.html ) mentions a 
>> series of attributes/parameters (maxThreads, minSpareThreads, 
>> connectionTimeout,
>> keepAliveTimeout,..) which, together, would lead one to believe that tomcat 
>> is managing the number of threads dynamically (increasing the number of 
>> threads (up to maxThreads) when needed to process simultaneous requests, and 
>> decreasing the number of threads again (down to minSpareThreads) when less 
>> requests are being processed).
>>
>> According to observations however (and to Chris' comments), that does not 
>> seem to be the case : once the number of threads has grown to a certain 
>> number, it never goes down back down again.
>> It has to be said that the above interpretation was mine, and the current 
>> documentation of the HTTP Connector never says explicitly that, on its own, 
>> it manages the number of threads dynamically. But it *does* mention a 
>> minSpareThreads parameter.
>>
>> On the other hand, when you use an Executor 
>> (http://tomcat.apache.org/tomcat-8.0-doc/config/executor.html), then the 
>> documentation states explicitly that the number of threads *is* dynamically 
>> managed, up and down.
>>
>> I found something else which seems to explain the riddle :
>>
>>  http://tomcat.apache.org/migration-6.html#Connector_thread_pools
>> That section explicitly says that since tomcat 6.0, for a Connector without 
>> an Executor, the number of threads always grows, and never decreases. And it 
>> also explicitly says that the Connector's "minSpareThreads" attribute will 
>&

RE: FW: tomcat 8080 thread not reduced

2017-01-18 Thread smith
Hi, André 

Thanks for the great explanation. So the current thread count will grow always 
until it reaches to the max configuration.

I have another strange thing:
We never monitored tomcat busy thread count high (we monitored one minutes 
interval through Nagios to get tomcat manager result, not high than 10). So if 
the threads grows, it should monitored the busy thread count reach that high(or 
some lower). So I'm still not understand when the current thread count will 
grow while current busy thread has not change a lot.



-Original Message-
From: André Warnier (tomcat) [mailto:a...@ice-sa.com] 
Sent: Wednesday, January 18, 2017 9:41 AM
To: users@tomcat.apache.org
Subject: Re: FW: tomcat 8080 thread not reduced

Hi.

I believe that what Philippe mentions below is somewhat different : in his 
configuration, there is apparently a front-end httpd server, which communicates 
with Tomcat via AJP and the tomcat AJP Connector.
In such a case, the "mod_jk" or "mod_proxy_ajp" connector module inside of 
httpd, creates a series of connections to the back-end tomcat, and keeps these 
connections alive in a pool of connections, according to rules which are 
different, than what applies to your case (which consists of direct HTTP 
connections from browsers, to the tomcat HTTP connector).
So Philippe's case introduces probably an additional level of complexity into 
the equation.
semi-graphically :

smith case :

client <- HTTP -> tomcat HTTP connector - tomcat thread

Philippe's case :

client <- HTTP -> apache httpd + ajp module <- AJP -> tomcat AJP connector - 
tomcat thread

The real question is :

The tomcat 8.0 HTTP Connector documentation
(http://tomcat.apache.org/tomcat-8.0-doc/config/http.html) mentions a series of 
attributes/parameters (maxThreads, minSpareThreads, connectionTimeout,
keepAliveTimeout,..) which, together, would lead one to believe that tomcat is 
managing the number of threads dynamically (increasing the number of threads 
(up to maxThreads) when needed to process simultaneous requests, and decreasing 
the number of threads again (down to minSpareThreads) when less requests are 
being processed).

According to observations however (and to Chris' comments), that does not seem 
to be the case : once the number of threads has grown to a certain number, it 
never goes down back down again.
It has to be said that the above interpretation was mine, and the current 
documentation of the HTTP Connector never says explicitly that, on its own, it 
manages the number of threads dynamically. But it *does* mention a 
minSpareThreads parameter.

On the other hand, when you use an Executor 
(http://tomcat.apache.org/tomcat-8.0-doc/config/executor.html), then the 
documentation states explicitly that the number of threads *is* dynamically 
managed, up and down.

I found something else which seems to explain the riddle :

http://tomcat.apache.org/migration-6.html#Connector_thread_pools
That section explicitly says that since tomcat 6.0, for a Connector without an 
Executor, the number of threads always grows, and never decreases. And it also 
explicitly says that the Connector's "minSpareThreads" attribute will be 
ignored.

So in fact the only thing wrong, is the online documentation for the Connectors 
: the minSpareThreads attribute should be removed (since it is anyway ignored).
That seems to have been an oversight ever since tomcat 6.0.

As far as I am concerned thus, the mystery is solved.

One question which is a bit left open is :

What - if any - is the real advantage/disadvantage of having perhaps maxThreads 
idle threads, as opposed to using an Executor to manage the number of threads 
dynamically ?
But that is probably the kind of question to which the appropriate answer is : 
"it depends.."




On 18.01.2017 07:33, smith wrote:
> Thanks, Philippe
>
> But we never monitored tomcat busy thread count high (we monitored one 
> minutes interval through nagios to get tomcat manager result, not high than 
> 10). This is strange
>
> -Original Message-
> From: Philippe Busque [mailto:pbus...@mediagrif.com]
> Sent: Monday, January 16, 2017 8:09 PM
> To: users@tomcat.apache.org
> Subject: Re: Re: FW: tomcat 8080 thread not reduced
>
> We're having a similar issues with our numberous Tomcat instances.
>
> Our connector config look like this.
>
>enableLookups="false" redirectPort="8443" acceptCount="100"
> connectionTimeout="2"  URIEncoding="UTF-8" />
>
>
> Sometime, the number of active connection would jump very high (up to 190), 
> due to some external issues (database lock, etc) and threads would accumulate.
>
> Even though a connectionTimeout is set, and therefor set keepAliveTimeout as 
> the same value,  threads are never released once the problem is  resolved 
> un

RE: FW: tomcat 8080 thread not reduced

2017-01-18 Thread smith
Hi, André
My case is same, my tomcat also has load balancer in front and it has health 
check to tomcat

-Original Message-
From: André Warnier (tomcat) [mailto:a...@ice-sa.com] 
Sent: Wednesday, January 18, 2017 9:41 AM
To: users@tomcat.apache.org
Subject: Re: FW: tomcat 8080 thread not reduced

Hi.

I believe that what Philippe mentions below is somewhat different : in his 
configuration, there is apparently a front-end httpd server, which communicates 
with Tomcat via AJP and the tomcat AJP Connector.
In such a case, the "mod_jk" or "mod_proxy_ajp" connector module inside of 
httpd, creates a series of connections to the back-end tomcat, and keeps these 
connections alive in a pool of connections, according to rules which are 
different, than what applies to your case (which consists of direct HTTP 
connections from browsers, to the tomcat HTTP connector).
So Philippe's case introduces probably an additional level of complexity into 
the equation.
semi-graphically :

smith case :

client <- HTTP -> tomcat HTTP connector - tomcat thread

Philippe's case :

client <- HTTP -> apache httpd + ajp module <- AJP -> tomcat AJP connector - 
tomcat thread

The real question is :

The tomcat 8.0 HTTP Connector documentation
(http://tomcat.apache.org/tomcat-8.0-doc/config/http.html) mentions a series of 
attributes/parameters (maxThreads, minSpareThreads, connectionTimeout,
keepAliveTimeout,..) which, together, would lead one to believe that tomcat is 
managing the number of threads dynamically (increasing the number of threads 
(up to maxThreads) when needed to process simultaneous requests, and decreasing 
the number of threads again (down to minSpareThreads) when less requests are 
being processed).

According to observations however (and to Chris' comments), that does not seem 
to be the case : once the number of threads has grown to a certain number, it 
never goes down back down again.
It has to be said that the above interpretation was mine, and the current 
documentation of the HTTP Connector never says explicitly that, on its own, it 
manages the number of threads dynamically. But it *does* mention a 
minSpareThreads parameter.

On the other hand, when you use an Executor 
(http://tomcat.apache.org/tomcat-8.0-doc/config/executor.html), then the 
documentation states explicitly that the number of threads *is* dynamically 
managed, up and down.

I found something else which seems to explain the riddle :

http://tomcat.apache.org/migration-6.html#Connector_thread_pools
That section explicitly says that since tomcat 6.0, for a Connector without an 
Executor, the number of threads always grows, and never decreases. And it also 
explicitly says that the Connector's "minSpareThreads" attribute will be 
ignored.

So in fact the only thing wrong, is the online documentation for the Connectors 
: the minSpareThreads attribute should be removed (since it is anyway ignored).
That seems to have been an oversight ever since tomcat 6.0.

As far as I am concerned thus, the mystery is solved.

One question which is a bit left open is :

What - if any - is the real advantage/disadvantage of having perhaps maxThreads 
idle threads, as opposed to using an Executor to manage the number of threads 
dynamically ?
But that is probably the kind of question to which the appropriate answer is : 
"it depends.."




On 18.01.2017 07:33, smith wrote:
> Thanks, Philippe
>
> But we never monitored tomcat busy thread count high (we monitored one 
> minutes interval through nagios to get tomcat manager result, not high than 
> 10). This is strange
>
> -Original Message-
> From: Philippe Busque [mailto:pbus...@mediagrif.com]
> Sent: Monday, January 16, 2017 8:09 PM
> To: users@tomcat.apache.org
> Subject: Re: Re: FW: tomcat 8080 thread not reduced
>
> We're having a similar issues with our numberous Tomcat instances.
>
> Our connector config look like this.
>
>enableLookups="false" redirectPort="8443" acceptCount="100"
> connectionTimeout="2"  URIEncoding="UTF-8" />
>
>
> Sometime, the number of active connection would jump very high (up to 190), 
> due to some external issues (database lock, etc) and threads would accumulate.
>
> Even though a connectionTimeout is set, and therefor set keepAliveTimeout as 
> the same value,  threads are never released once the problem is  resolved 
> until Tomcat is restarted.  We would end up with maybe 5-10 busy workers, but 
> 190 idle workers/ threads
>
> I think the issue is related to how the StandardThreadExecutor is 
> implemented. The StandardThreadExecutor is a front for the default Java 
> ThreadPoolExecutor.  If I'm not mistaken, ThreadPoolExecutor is distributing 
> work in round robin fashion among all defined workers, rather than sticking 
> to

RE: Re: FW: tomcat 8080 thread not reduced

2017-01-17 Thread smith
Thanks, Philippe

But we never monitored tomcat busy thread count high (we monitored one minutes 
interval through nagios to get tomcat manager result, not high than 10). This 
is strange

-Original Message-
From: Philippe Busque [mailto:pbus...@mediagrif.com] 
Sent: Monday, January 16, 2017 8:09 PM
To: users@tomcat.apache.org
Subject: Re: Re: FW: tomcat 8080 thread not reduced

We're having a similar issues with our numberous Tomcat instances.

Our connector config look like this.

 


Sometime, the number of active connection would jump very high (up to 190), due 
to some external issues (database lock, etc) and threads would accumulate.

Even though a connectionTimeout is set, and therefor set keepAliveTimeout as 
the same value,  threads are never released once the problem is  resolved until 
Tomcat is restarted.  We would end up with maybe 5-10 busy workers, but 190 
idle workers/ threads

I think the issue is related to how the StandardThreadExecutor is implemented. 
The StandardThreadExecutor is a front for the default Java ThreadPoolExecutor.  
If I'm not mistaken, ThreadPoolExecutor is distributing work in round robin 
fashion among all defined workers, rather than sticking to the core threads.


As a result, should a website has any constant traffic (Apache AJP ping, load 
balancer monitoring, normal traffic, etc), all thread will be hit at least once 
within the configured  keepAliveTimeout, reseting it. So unless the 
keepAliveTimeout is set to a very low value, which defeat the purpose, thread 
will never be released .


This is what I've come to suspect from looking at the StandardThreadExecutor, 
but never really had the opportunity to do deeper test with load.
But from Tomcat 6 to tomcat 8, we were never able to  decrease the number of 
'idle' workers back from the highest value it had reached.


Le 2017-01-16 à 05:24, André Warnier (tomcat) a écrit :
> On 16.01.2017 11:10, smith wrote:
>> We has same problem on dev env that no any traffic to the serive,
>
> Ah. That is /new/ information, which may change the suggestions below.
> It looks like you should really find out what these threads are doing, 
> probably by doing a few thread dumps.
> See here e.g. :
> http://stackoverflow.com/questions/18573411/tomcat-thread-dump
>
> Again : we do not know your application, so we can only make guesses 
> based on the information that you provide.
>
>  will try on dev first
>>
>> -Original Message-
>> From: André Warnier (tomcat) [mailto:a...@ice-sa.com]
>> Sent: Monday, January 16, 2017 10:08 AM
>> To: users@tomcat.apache.org
>> Subject: Re: FW: tomcat 8080 thread not reduced
>>
>> On 16.01.2017 09:50, smith wrote:
>>> Busy one is process customer request, do not know what non-busy one 
>>> is doing, always keep 120 for many days. I don't think 20s timeout 
>>> will not cause so long connection
>>>
>>> -smith
>>
>> And did you actually try it ?
>>
>> We do not know your website or your application, so we cannot tell 
>> how many clients there are, what these clients are really requesting, 
>> how many requests each client is sending before going away, etc.
>>
>> KeepAlive means that when a client has sent its /last/ request and 
>> received the response, one thread is going to remain "not free" (but 
>> doing nothing) for the duration of the KeepAlive timeout. This thread 
>> will keep waiting, for KeepAliveTimeout seconds, just in case the 
>> client would still send another request (which it may never do, 
>> depending on the application).
>>
>> Imagine that your application is so that the average client
>> - connects to your site
>> - sends a single HTTP request, which gets processed in 0.1 s
>> - receives the response
>> - and then goes away
>> and that the above sequence happens once every second, from different 
>> clients.
>> After one second, there will be one thread waiting for another 19 
>> seconds before becoming free (and potentially destroyed or re-used).
>> After 2 seconds, there will be 2 such threads. After 3 seconds, 3 
>> threads. And so on. After 20 seconds, the first thread will be freed, 
>> but there will be 19 other threads still waiting, and one new thread 
>> just created.
>> If everything stays perfectly regular like that, your will have 
>> /permanently/ 20 threads in existence, even if the minimum is 10.
>> If you change the above so that there is a new client every 0.5 s, 
>> you will have permanently 40 threads (of which only 2 maximum are 
>> really doing something).
>>
>> The point is : KeepAlive is not "bad", and in some cases having a 
>> relatively long KeepAliveTimeout is the ri

RE: FW: tomcat 8080 thread not reduced

2017-01-17 Thread smith
Thanks chris

So the tomcat default executor will not reduce the thread count until it reach 
to the max configuration? Will it reduce when it reach to max?
And why the default not reduce the thread?

-Smith

-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: Tuesday, January 17, 2017 7:18 PM
To: Tomcat Users List
Subject: Re: FW: tomcat 8080 thread not reduced

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Smith,

On 1/16/17 8:22 PM, smith wrote:
> Yes, I think thread count should be reduced when those threads are 
> idle
> 
> Is this right? Or it will not reduced?

Id you want Tomcat to reduce the number of idle threads, you'll need to 
explicitly configure an  and use that with your  .

- -chris

> -Original Message- From: Christopher Schultz 
> [mailto:ch...@christopherschultz.net] Sent: Monday, January 16,
> 2017 2:20 PM To: Tomcat Users List Subject: Re: FW: tomcat 8080 thread 
> not reduced
> 
> Smith,
> 
> There are your only active s:
> 
> On 1/14/17 1:30 AM, smith wrote:
>> > connectionTimeout="2" redirectPort="8443" />
> 
>> [snip]
> 
>> 
> 
> You have not changed any settings from the default. What makes you 
> think that your thread count should be reduced when those threads are 
> idle?
> 
> -chris
> 
> -
>
> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 
> -
>
> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYfm4EAAoJEBzwKT+lPKRY7RkP/1Pd1MNlaCCLGAX/vVXPTsTi
ZO+zBM888owqJNcMgtoZnXHdJQnsX2ulfeFLJGEXtBby1L8zR/E+B2/lXFjlU2Bj
h3PHPKH3w7Lj/pKnWUoErSCiqKhIIg3XsfBZfIaHE+jSBvibO30luzUwbLWXgTkb
0sK/tmdvoautPEyXSo0X9bg0FCrFnmbv3pJhCz4kUPtpLKXb9ffQchitCshqu96d
jZF5RgAqP2U9j5au0GKsHwAbDVXdM/qd04DbJjcS19LIsRYXCrUvMduRYVaiA5KK
PbV9slZ23hLDrqI3nE/jR5MATl2HzeqLs7sVpYMWhWgMYst1cgFvIQVnVjKa1uah
CTlHhBYbzrtYHnZBdKcBN1wpMnpnM6HM9CZCyRvrG4AqUvmKhQx/OHoUbP8DH8uc
8JRgTskpYO2MESsiDAVRBIe1MN/jm/YbZVRikooCA5JgVUNQf9k2CyZy9oDqz25d
dAiMwKdZ8ZS6bhglGx2SJm9pePM+Kt5N9TiUE+TkTOsoLmqgiSm5SAXOuQMLzfI4
a1LMR72GDogxckMmumfjSRwwvkoEGqR6VrQ8dzfp+mhaYysRgHAbzxAe4ZWCl9Bz
7UFn8cHCMjNHOwBFbkcuuCXoaUpfLE4spauFiU8FFnkmrvs/BWiXTplh596fgzsE
MzaClwNfP/RGKNqi4fsc
=W1gG
-END PGP SIGNATURE-

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



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



RE: FW: tomcat 8080 thread not reduced

2017-01-16 Thread smith
Yes, I also think it should act like this, but it did not.

-Original Message-
From: André Warnier (tomcat) [mailto:a...@ice-sa.com] 
Sent: Monday, January 16, 2017 2:33 PM
To: users@tomcat.apache.org
Subject: Re: FW: tomcat 8080 thread not reduced

On 16.01.2017 15:19, Christopher Schultz wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Smith,
>
> There are your only active s:
>
> On 1/14/17 1:30 AM, smith wrote:
>> > connectionTimeout="2" redirectPort="8443" />
>>
>> [snip]
>>
>> 
>
> You have not changed any settings from the default. What makes you 
> think that your thread count should be reduced when those threads are 
> idle?

Hi.  (André responding for "smith")

Maybe this :
http://tomcat.apache.org/tomcat-8.0-doc/config/http.html#Standard_Implementation
--> minSpareThreads
?
(That's also the way I understand this : inactive threads disappear after a 
while, down to the number mentioned here - which is 10 by default. Not so ?)

>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJYfNaBAAoJEBzwKT+lPKRY3ZsP+wdrzjUHAVPoF8KXIAj+vz0O
> lZ0zXBC2XID9Bh6dQRKvW+9k/RQRCuOrnZ+Z4qVdeo9jdtQMPGkQcpr5mw3m7rCZ
> XefMU8KBsSl/31lBhl8ajxAUqpTx37dSUV6mUFVtVVEZdp2/+3Jy1slmEuO7+COJ
> wUYtD7y4yk9oitxj0S3Omeglo+g00yJmTVgEJClCF19wYIn0uSfwZFgOpkftj2HO
> ct1ndMa5WIUQYtQ6ueiOgIoZb4aEhhS69JilN0GZ1WZpdTUCj04bosnOJ94w8fPi
> 1+z/5GCAPVhLBYN+LTr/03EoC9u+gm7163+eIbGK8g/1GiNqY+m6plI7LMGaNy0j
> 3pfgitcK2Mte4w2T0yJpe87lwNOCrkVL4oXCmOGx8b/P5f9M2MukKTIfmRsT7Q/G
> u4skc+LYCxVwIqsND/4DuBatAx8FSzi3UebHIJoBVOe22b6zPYKGaXUBo530dAvK
> iVnBgzxIOvQuQr1pD6ylRjCmrmooIH6P8iknHX2DrKyaqEcdnR0g/iJnfuGeW+JO
> VrbTWEcb29IrKsn4WGuglALijl+I1UCEvru5aTlvkXyWhePK1wlHYaupy69sy3a/
> 5z4LJdOebtN3QFr2I6hM54L0+bjjwCznlVa8b/6ky84ya/7tzWGoHqpqYod46HZZ
> 7E1OkTnDk67xhmh7iXbB
> =e2NW
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>


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



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



RE: FW: tomcat 8080 thread not reduced

2017-01-16 Thread smith
Yes, I think thread count should be reduced when those threads are idle

Is this right? Or it will not reduced?

-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: Monday, January 16, 2017 2:20 PM
To: Tomcat Users List
Subject: Re: FW: tomcat 8080 thread not reduced

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Smith,

There are your only active s:

On 1/14/17 1:30 AM, smith wrote:
>  connectionTimeout="2" redirectPort="8443" />
> 
> [snip]
> 
> 

You have not changed any settings from the default. What makes you think that 
your thread count should be reduced when those threads are idle?

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

iQIcBAEBCAAGBQJYfNaBAAoJEBzwKT+lPKRY3ZsP+wdrzjUHAVPoF8KXIAj+vz0O
lZ0zXBC2XID9Bh6dQRKvW+9k/RQRCuOrnZ+Z4qVdeo9jdtQMPGkQcpr5mw3m7rCZ
XefMU8KBsSl/31lBhl8ajxAUqpTx37dSUV6mUFVtVVEZdp2/+3Jy1slmEuO7+COJ
wUYtD7y4yk9oitxj0S3Omeglo+g00yJmTVgEJClCF19wYIn0uSfwZFgOpkftj2HO
ct1ndMa5WIUQYtQ6ueiOgIoZb4aEhhS69JilN0GZ1WZpdTUCj04bosnOJ94w8fPi
1+z/5GCAPVhLBYN+LTr/03EoC9u+gm7163+eIbGK8g/1GiNqY+m6plI7LMGaNy0j
3pfgitcK2Mte4w2T0yJpe87lwNOCrkVL4oXCmOGx8b/P5f9M2MukKTIfmRsT7Q/G
u4skc+LYCxVwIqsND/4DuBatAx8FSzi3UebHIJoBVOe22b6zPYKGaXUBo530dAvK
iVnBgzxIOvQuQr1pD6ylRjCmrmooIH6P8iknHX2DrKyaqEcdnR0g/iJnfuGeW+JO
VrbTWEcb29IrKsn4WGuglALijl+I1UCEvru5aTlvkXyWhePK1wlHYaupy69sy3a/
5z4LJdOebtN3QFr2I6hM54L0+bjjwCznlVa8b/6ky84ya/7tzWGoHqpqYod46HZZ
7E1OkTnDk67xhmh7iXbB
=e2NW
-END PGP SIGNATURE-

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



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



RE: FW: tomcat 8080 thread not reduced

2017-01-16 Thread smith
We has same problem on dev env that no any traffic to the serive, will try on 
dev first

-Original Message-
From: André Warnier (tomcat) [mailto:a...@ice-sa.com] 
Sent: Monday, January 16, 2017 10:08 AM
To: users@tomcat.apache.org
Subject: Re: FW: tomcat 8080 thread not reduced

On 16.01.2017 09:50, smith wrote:
> Busy one is process customer request, do not know what non-busy one is 
> doing, always keep 120 for many days. I don't think 20s timeout will 
> not cause so long connection
>
> -smith

And did you actually try it ?

We do not know your website or your application, so we cannot tell how many 
clients there are, what these clients are really requesting, how many requests 
each client is sending before going away, etc.

KeepAlive means that when a client has sent its /last/ request and received the 
response, one thread is going to remain "not free" (but doing nothing) for the 
duration of the KeepAlive timeout. This thread will keep waiting, for 
KeepAliveTimeout seconds, just in case the client would still send another 
request (which it may never do, depending on the application).

Imagine that your application is so that the average client
- connects to your site
- sends a single HTTP request, which gets processed in 0.1 s
- receives the response
- and then goes away
and that the above sequence happens once every second, from different clients.
After one second, there will be one thread waiting for another 19 seconds 
before becoming free (and potentially destroyed or re-used). After 2 seconds, 
there will be 2 such threads. After 3 seconds, 3 threads. And so on. After 20 
seconds, the first thread will be freed, but there will be 19 other threads 
still waiting, and one new thread just created.
If everything stays perfectly regular like that, your will have /permanently/ 
20 threads in existence, even if the minimum is 10.
If you change the above so that there is a new client every 0.5 s, you will 
have permanently 40 threads (of which only 2 maximum are really doing 
something).

The point is : KeepAlive is not "bad", and in some cases having a relatively 
long KeepAliveTimeout is the right thing to do.  Also, having a high number of 
threads sitting idle is not necessarily a problem.
Your own scenario is probably not like the above perfectly regular and 
irrealistic one above. But there may be a perfectly logical reason why you have 
so many threads on average, and I am just trying to give you ideas for finding 
out the reason.


>
> -Original Message-
> From: André Warnier (tomcat) [mailto:a...@ice-sa.com]
> Sent: Monday, January 16, 2017 8:33 AM
> To: users@tomcat.apache.org
> Subject: Re: FW: tomcat 8080 thread not reduced
>
> On 16.01.2017 03:41, Smith Hua wrote:
>>
>> actually there is not much busy threads, less tahn 10,so i think this 
>> parameter may has nothing to do with this
>
> It depends on what you call "busy". What are the busy ones doing ? and what 
> are the non-busy ones doing ?
>
>
>> --
>> 从myMail的Android专用app所发送 星期一, 16 一月 2017, 03:01上午 +08:00 发件人 André Warnier 
>> (tomcat)  a...@ice-sa.com :
>>
>>> Hi.
>>>
>>> I can find nothing really wrong in your configuration below.
>>> But, what happens if in this section :
>>>
>>>>  >>> maxThreads="300" connectionTimeout="2"
>>>> redirectPort="8443" />
>>>
>>> you change the connectionTimeout to 3000 (= 3 seconds, instead of the above 
>>> 20 seconds) ?
>>>
>>> Do you still see the number of threads remaining at the maximum ?
>>>
>>> See :  
>>> http://tomcat.apache.org/tomcat-8.0-doc/config/http.html#Standard_Im
>>> plementation
>>> --> connectionTimeout
>>> and the fact that it is also the default for keepAliveTimeout
>>>
>>>
>>> On 14.01.2017 07:30, smith wrote:
>>>> The server.xml:
>>>>
>>>> 
>>>> 
>>>> 
>>>> 
>>>>  >>> className="org.apache.catalina.startup.VersionLoggerListener" />
>>>>  
>>>>  
>>>>  >>> SSLEngine="on" />
>>>>  
>>>>  >>> className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
>>>>  >>> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
>>>>  >>

RE: FW: tomcat 8080 thread not reduced

2017-01-16 Thread smith
Busy one is process customer request, do not know what non-busy one is doing, 
always keep 120 for many days. I don't think 20s timeout will not cause so long 
connection

-smith

-Original Message-
From: André Warnier (tomcat) [mailto:a...@ice-sa.com] 
Sent: Monday, January 16, 2017 8:33 AM
To: users@tomcat.apache.org
Subject: Re: FW: tomcat 8080 thread not reduced

On 16.01.2017 03:41, Smith Hua wrote:
>
> actually there is not much busy threads, less tahn 10,so i think this 
> parameter may has nothing to do with this

It depends on what you call "busy". What are the busy ones doing ? and what are 
the non-busy ones doing ?


> --
> 从myMail的Android专用app所发送 星期一, 16 一月 2017, 03:01上午 +08:00 发件人 André Warnier 
> (tomcat)  a...@ice-sa.com :
>
>> Hi.
>>
>> I can find nothing really wrong in your configuration below.
>> But, what happens if in this section :
>>
>>   >  >   > maxThreads="300" connectionTimeout="2"
>>   > redirectPort="8443" />
>>
>> you change the connectionTimeout to 3000 (= 3 seconds, instead of the above 
>> 20 seconds) ?
>>
>> Do you still see the number of threads remaining at the maximum ?
>>
>> See :  
>> http://tomcat.apache.org/tomcat-8.0-doc/config/http.html#Standard_Implementation
>> --> connectionTimeout
>> and the fact that it is also the default for
>> keepAliveTimeout
>>
>>
>> On 14.01.2017 07:30, smith wrote:
>>> The server.xml:
>>>
>>> 
>>> 
>>> 
>>> 
>>> >> />
>>> 
>>> 
>>> >> SSLEngine="on" />
>>> 
>>> >> className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
>>> >> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
>>> >> className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
>>>
>>> 
>>> 
>>>   
>>>   >> type="org.apache.catalina.UserDatabase"
>>> description="User database that can be updated and saved"
>>> 
>>> factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>>> pathname="conf/tomcat-users.xml" />
>>> 
>>>
>>> 
>>> 
>>>
>>>   
>>>   
>>>
>>>
>>>   
>>>   >>  maxThreads="300" connectionTimeout="2"
>>>  redirectPort="8443" />
>>>   
>>>   
>>>   
>>>   
>>>
>>>   
>>>   
>>>
>>>
>>>   
>>>
>>>   
>>>   
>>>
>>> 
>>> 
>>>
>>> 
>>> 
>>>   
>>>   >>  resourceName="UserDatabase"/>
>>> 
>>>
>>> >>   unpackWARs="true" autoDeploy="true">
>>>
>>>   
>>>   
>>>
>>>   
>>>
>>> >> directory="logs"
>>>  prefix="localhost_access_log" suffix=".txt"
>>>  pattern="%h,%t,%m,%U,%H,%s,%B,%D,%{User-Agent}i" />
>>>
>>>   >> docBase="//t" sessionCookieName="" />
>>> 
>>>   
>>> 
>>> 
>>>
>>> -Original Message-
>>> From: André Warnier (tomcat) [mailto:a...@ice-sa.com]
>>> Sent: Friday, January 13, 2017 10:42 AM
>>> To:  users@tomcat.apache.org
>>> Subject: Re: FW: tomcat 8080 thread not reduced
>>>
>>> On 13.01.2017 09:38, smith wrote:
>>>>
>>>>
>>>>
>>>>
>>>> From: smith [mailto:smith@zoom.us]
>>>> Sent: Tuesday, January 10, 2017 9:57 AM
>>>> To: 'users'
>>>> Subject: tomcat 8080 thread not reduced
>>>>
>>>>
>>>>
>>>> Hi,
>>>>
>>>>
>>>>
>>>> We have installed Apache Tomcat/8.0.14, and found that after one period of 
>>>> time, the thread

Re[2]: FW: tomcat 8080 thread not reduced

2017-01-15 Thread Smith Hua

actually there is not much busy threads, less tahn 10,so i think this parameter 
may has nothing to do with this
--
从myMail的Android专用app所发送 星期一, 16 一月 2017, 03:01上午 +08:00 发件人 André Warnier 
(tomcat)  a...@ice-sa.com :

>Hi.
>
>I can find nothing really wrong in your configuration below.
>But, what happens if in this section :
>
> >   > maxThreads="300" connectionTimeout="2"
> > redirectPort="8443" />
>
>you change the connectionTimeout to 3000 (= 3 seconds, instead of the above 20 
>seconds) ?
>
>Do you still see the number of threads remaining at the maximum ?
>
>See :  
>http://tomcat.apache.org/tomcat-8.0-doc/config/http.html#Standard_Implementation
>--> connectionTimeout
>and the fact that it is also the default for
>keepAliveTimeout
>
>
>On 14.01.2017 07:30, smith wrote:
>> The server.xml:
>>
>> 
>> 
>> 
>> 
>>
>>
>>
>>> SSLEngine="on" />
>>
>>> className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
>>> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
>>> className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
>>
>>
>>
>>  
>>  >type="org.apache.catalina.UserDatabase"
>>description="User database that can be updated and saved"
>>factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>>pathname="conf/tomcat-users.xml" />
>>
>>
>>
>>
>>
>>  
>>  
>>
>>
>>  
>>  > maxThreads="300" connectionTimeout="2"
>> redirectPort="8443" />
>>  
>>  
>>  
>>  
>>
>>  
>>  
>>
>>
>>  
>>
>>  
>>  
>>
>>
>>
>>
>>
>>
>>  
>>  > resourceName="UserDatabase"/>
>>
>>
>>>  unpackWARs="true" autoDeploy="true">
>>
>>  
>>  
>>
>>  
>>
>>  > directory="logs"
>> prefix="localhost_access_log" suffix=".txt"
>> pattern="%h,%t,%m,%U,%H,%s,%B,%D,%{User-Agent}i" />
>>
>>  > docBase="//t" sessionCookieName="" />
>>
>>  
>>
>> 
>>
>> -Original Message-
>> From: André Warnier (tomcat) [mailto:a...@ice-sa.com]
>> Sent: Friday, January 13, 2017 10:42 AM
>> To:  users@tomcat.apache.org
>> Subject: Re: FW: tomcat 8080 thread not reduced
>>
>> On 13.01.2017 09:38, smith wrote:
>>>
>>>
>>>
>>>
>>> From: smith [mailto:smith@zoom.us]
>>> Sent: Tuesday, January 10, 2017 9:57 AM
>>> To: 'users'
>>> Subject: tomcat 8080 thread not reduced
>>>
>>>
>>>
>>> Hi,
>>>
>>>
>>>
>>> We have installed Apache Tomcat/8.0.14, and found that after one period of 
>>> time, the thread count for 8080(our port published) goes to 120 and never 
>>> reduced even the busy count is only 3-4.
>>>
>>> Why? Tomcat8 not reduced the thread pool even the thread is idle, and the 
>>> minSpareThreads for tomcat8 default is only 10.
>>>
>>> When will the thread reduce?
>>>
>>>
>>>
>>>
>>>
>>> Best regards
>>>
>>> Smith
>>>
>>>
>>
>> Hi.
>>
>> Please copy/paste your complete server.xml configuration file (confidential 
>> things removed), so that we could have a useful look at it.
>> Please edit *only* the confidential things, not entire sections. Often, the 
>> issue is in the details.
>>
>>
>>
>> -
>> To unsubscribe, e-mail:  users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail:  users-h...@tomcat.apache.org
>>
>>
>>
>> -
>> To unsubscribe, e-mail:  users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail:  users-h...@tomcat.apache.org
>>
>
>
>-
>To unsubscribe, e-mail:  users-unsubscr...@tomcat.apache.org
>For additional commands, e-mail:  users-h...@tomcat.apache.org
>


RE: FW: tomcat 8080 thread not reduced

2017-01-13 Thread smith
The server.xml:





  
  
  
  
  
  
  
  

  
  


  

  
  





















  
  

  
  


  

  









  

  


-Original Message-
From: André Warnier (tomcat) [mailto:a...@ice-sa.com] 
Sent: Friday, January 13, 2017 10:42 AM
To: users@tomcat.apache.org
Subject: Re: FW: tomcat 8080 thread not reduced

On 13.01.2017 09:38, smith wrote:
>
>
>
>
> From: smith [mailto:smith@zoom.us]
> Sent: Tuesday, January 10, 2017 9:57 AM
> To: 'users'
> Subject: tomcat 8080 thread not reduced
>
>
>
> Hi,
>
>
>
> We have installed Apache Tomcat/8.0.14, and found that after one period of 
> time, the thread count for 8080(our port published) goes to 120 and never 
> reduced even the busy count is only 3-4.
>
> Why? Tomcat8 not reduced the thread pool even the thread is idle, and the 
> minSpareThreads for tomcat8 default is only 10.
>
> When will the thread reduce?
>
>
>
>
>
> Best regards
>
> Smith
>
>

Hi.

Please copy/paste your complete server.xml configuration file (confidential 
things removed), so that we could have a useful look at it.
Please edit *only* the confidential things, not entire sections. Often, the 
issue is in the details.



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



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



FW: tomcat 8080 thread not reduced

2017-01-13 Thread smith
 

 

From: smith [mailto:smith@zoom.us] 
Sent: Tuesday, January 10, 2017 9:57 AM
To: 'users'
Subject: tomcat 8080 thread not reduced

 

Hi,

 

We have installed Apache Tomcat/8.0.14, and found that after one period of 
time, the thread count for 8080(our port published) goes to 120 and never 
reduced even the busy count is only 3-4. 

Why? Tomcat8 not reduced the thread pool even the thread is idle, and the 
minSpareThreads for tomcat8 default is only 10.

When will the thread reduce?

 

 

Best regards

Smith

 



Re: CONFIRM unsubscribe from users@tomcat.apache.org

2016-07-07 Thread Andy Smith
dont remove

  From: Felix Schumacher 
 To: users@tomcat.apache.org 
 Sent: Thursday, July 7, 2016 1:02 PM
 Subject: Re: CONFIRM unsubscribe from users@tomcat.apache.org
   
Am 07.07.2016 um 20:01 schrieb users-h...@tomcat.apache.org:
> Hi! This is the ezmlm program. I'm managing the
> users@tomcat.apache.org mailing list.
>
> I'm working for my owner, who can be reached
> at users-ow...@tomcat.apache.org.
>
> A request has been made to remove
>
>    hughhols...@yahoo.com
>
> from the users mailing list. If you agree, please send
> a short reply to this address:
>
>    
>users-wc.1467914473.kkhfblfnmljllpmlpdnb-hughholston=yahoo@tomcat.apache.org
>
> Usually, this happens when you just hit the "reply" button.
> If this does not work, simply copy the address and paste it into
> the "To:" field of a new message.
>
> or click here:
>     
> mailto:users-wc.1467914473.kkhfblfnmljllpmlpdnb-hughholston=yahoo@tomcat.apache.org
>
> If you don't approve, simply ignore this message.
>
> Thank you for your help!
>
>
> --- Administrative commands for the users list ---
>
> I can handle administrative requests automatically. Please
> do not send them to the list address! Instead, send
> your message to the correct command address:
>
> To subscribe to the list, send a message to:
>    
>
> To remove your address from the list, send a message to:
>    
>
> Send mail to the following for info and FAQ for this list:
>    
>    
>
> Similar addresses exist for the digest list:
>    
>    
>
> To get messages 123 through 145 (a maximum of 100 per request), mail:
>    
>
> To get an index with subject and author for messages 123-456 , mail:
>    
>
> They are always returned as sets of 100, max 2000 per request,
> so you'll actually get 100-499.
>
> To receive all messages with the same subject as message 12345,
> send a short message to:
>    
>
> The messages should contain one line or word of text to avoid being
> treated as sp@m, but I will ignore their content.
> Only the ADDRESS you send to is important.
>
> You can start a subscription for an alternate address,
> for example "john@host.domain", just add a hyphen and your
> address (with '=' instead of '@') after the command word:
> 

Using MANIFEST.MF in Tomcat 8

2016-02-09 Thread Andy Smith
Hi,
I am currently running Tomcat 8.0.30 on a Red Hat Linux 64 bit O/S (2.6.18). My 
question is, I hope, simple. I want to tell Tomcat to look in a child directory 
of the WEB-INF/lib directory for jar files that contain classes my web app 
requires. For example, I have four main jar files that reside in the 
WEB-INF/lib directory. Under the WEB-INF/lib directory I have a directory that 
contains jar files that support one or more of the main jar files. However no 
matter what I put in the MANIFEST.MF file the jar files in the child 
directories are not located. Here is what I currently have in my 
META-INF/MANIFEST.MF file for the web app context. I only have one library(jar 
file) at this point because I was trying to limit the variables and this is the 
jar file that contains the class that can not be located.
Manifest-Version: 1.0Class-Path: libraries/commons-fileupload-1.2.2.jar
I have also tried the KV Pair,  Dependencies: 
libraries/commons-fileupload-1.2.2.jar.
When I looked at the Tomcat 8 source code, I believe it is trying to read the 
MANIFEST.MF file. So my question is, can I use the MANIFEST.MF file to tell 
Tomcat to look in child directories of the web app context or am I limited to 
the WEB-INF/lib directory only for supporting jar files?
Regards,
Andy Smith

Re: Tomcat & SOAP/Rest +/- jax-ws or Axis2 or cxf ????

2015-11-01 Thread Howard W. Smith, Jr.
On Sun, Nov 1, 2015 at 2:31 AM, N.s.Karthik  wrote:

> Hi
> spec : jdk 1.7
> Container Tomcat 7.x
> O/s : Oracle Linux
>
> Question : Need a *Simple & Single Framework to support both "SOAP & Rest"*
> based  services.
>
> Which one is the best to make use of ??
>
> Jax-ws   OR   Axis2  OR  Cxf  or 
>
>
http://tomee.apache.org/apache-tomee.html


Re: Tomcat 8 reliability/performance on Windows 2008 R2 Server vs. RHEL/CentOS

2015-10-01 Thread Howard W. Smith, Jr.
On Thu, Oct 1, 2015 at 11:46 AM, Aurélien Terrestris 
wrote:

> I recommend Linux for 2 reasons :
>  - easier to install and maintain a secured Tomcat (especially when
> using different TOMCAT_HOME & TOMCAT_BASE, on Windows it's pretty
> difficult to know how to secure all directories correctly) ; if you
> have to deal with file uploading, you don't want a system which could
> launch any exe,..
>  - doesn't need to reboot every 3 days because of the memory
> fragmentation or anything else
>

Multiple tomcat/tomee instances are running well on Windows 2008 R2 Server
for me.

- does 'not' reboot every 3 days at all
- only reboots automatically at 3am when there is a Windows update for the
Windows 2008 R2 Server
- my apps shut down with no issues and restart (via Windows Service for
each tomcat/tomee instance) with no issues
- the embedded Apache Derby database is/has never corrupted due to loss of
power or restart (for Windows update)
- never had to set or maintain TOMCAT_HOME and/or TOMCAT_BASE environment
variables
- i only set/maintain JAVA_HOME and JRE_HOME environment variables
(whenever there is a Java version update)
- my 2 apps (and/or tomee instances) run under 500MB and 1GB of RAM,
respectively, and CPU seem to max out between 4 to 10% (on average)
- Java EE 6 full blown stack (JPA, JSF, JMS) running on main tomee instance
using under 1 GB of RAM
- Java EE 6 RESTful + JMS running on 2nd tomee instance using under 500MB
of RAM
- use tomcat7w.exe and tomee4restw.exe to start, stop, edit the Windows
Services for the tomcat/tomee instances
- Windows = piece of cake (for me)
- as Andre' mentioned, use Remote Desktop connection to connect to the
Windows 2008 R2 Server
- i remove default tomcat/tomee web app (ROOT folder, etc...) and deploy my
WAR to webapps folder
- i'm loving tomcat/tomee on Windows Server
- have 32 GB of RAM available, only using (approximately) 4GB because of my
java heap settings for both tomcat/tomee settings


Re: Is Container Managed Transactions possible in case of Tomcat ?

2015-08-19 Thread Howard W. Smith, Jr.
On Aug 19, 2015 3:56 PM, Sreyan Chakravarty sreyan.mail...@gmail.com
wrote:

 TomEE supports Apache OpenJPA. What if I wanted to use Hibernate as my JPA
 provider ?


I searched Google for

tomee hibernate tutorial

And found

http://tomee.apache.org/examples-trunk/jpa-hibernate/README.html

https://rmannibucau.wordpress.com/2012/07/01/hibernate-tomee/

And many more. Please subscribe to the Apache TomEE user list, download
latest version, and ask any further questions on the tomee user list.

 On Wed, Aug 19, 2015 at 9:53 PM, Alex Soto asot...@gmail.com wrote:

  Yeah in this case you should take a look at Apache TomEE which is Apache
  Tomcat + Java EE and you will get all of these for free :).
 
  El dc., 19 ag. 2015 a les 18:18, Daniel Mikusa (dmik...@pivotal.io) va
  escriure:
 
   On Wed, Aug 19, 2015 at 12:03 PM, Sreyan Chakravarty 
   sreyan.mail...@gmail.com wrote:
  
I planning to use JPA (Hibernate) in a small project that I am
   developing.
Now I have heard a lot about the benefits of using Container Managed
Transactions(CMT) for JPA in web apps. But most of the tutorials on
the
   web
use either GlassFish or JBoss, so I was wondering is CMT supported
by
Tomcat. Send me a link to the documentation for this if there is
any.
Please note that I am going to use a datasource to connect to my
  database
and I am using persistence.xml(JPA style) to use Hibernate.
   
  
   If you're referring to JTA, then no.  Tomcat doesn't implement that.
   Tomcat only implements a subset of the JEE spec.
  
   http://tomcat.apache.org/whichversion.html
  
   However most of the parts of the spec that Tomcat does not implement
can
  be
   pulled in via libraries.  For JTA you can use a third party
  implementation
   with Tomcat.  Atomikos, JOTM and Bitronix are ones that come to mind.
  
   These docs are a little dated, but should get you started.
  
   http://www.atomikos.com/Documentation/TomcatIntegration
   http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html
  
   Dan
  
 


Re: Tomcat Maven plugin failure: tries to use a TLSv1 handshake with a TLSv1.2 server.

2015-03-05 Thread Stu Smith
Hello Chris,
  With maven, I am using:

java -version
java version 1.7.0_55
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1~0.13.10.1)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

On the server,
java version 1.7.0_65
OpenJDK Runtime Environment (IcedTea 2.5.1) (7u65-2.5.1-4ubuntu1~0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

The tomcat configuration that works (password fields elided):

  Connector
   protocol=HTTP/1.1
   port=443 maxThreads=200
   scheme=https secure=true SSLEnabled=true
   keystoreFile=/etc/shareplaylearn.jks
   keyAlias=shareplaylearn
   keystorePass=[password]
   keyPass=[password]
   clientAuth=false
   sslProtocol=TLS
   sslEnabledProtocols=TLSv1.2,TLSv1,TLSv1.1
/

The one that does not work:


  Connector
   protocol=HTTP/1.1
   port=443 maxThreads=200
   scheme=https secure=true SSLEnabled=true
   keystoreFile=/etc/shareplaylearn.jks
   keyAlias=shareplaylearn
   keystorePass=[password]
   keyPass=[password]
   clientAuth=false
   sslProtocol=TLS
   sslEnabledProtocols=TLSv1.2
/

(Exactly the same, except more protocols enabled on sslEnabledProtocols)

I can try to run the tool, but not tonight! Thanks!

Also, given the only difference between working/not working is enabled
protocol.. I'm not totally sure what we're looking for.
I guess maybe to see what ciphers are enabled?

The site, while neither beautiful nor functional, does support ssl
correctly in all the browsers I've tested (even on my gingerbread phone):

https://www.shareplaylearn.com/#/share

I do have it working, and I was a bit frustrated last night - so I'm a
little happier now - but still, it would be really nice to the plugin
support 1.2.. even nicer it if was smart enough to look for the CA certs in
the standard locations, and just work (or something close to that) like a
browser. I've used HttpComponents HttpClient fairly often fairly recently,
and the most recent stable version seems to handle ssl just fine,
defaulting to the jvm cacert, etc.. no mavenrc necessary... which is one
reason why I was little bit confused by the maven plugin behavior.

Hope that doesn't sound too whiny - just explaining the POV - I do
appreciate the help!

Take care,
  -stu


On Thu, Mar 5, 2015 at 8:34 AM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Stu,

 On 3/5/15 2:23 AM, Stu Smith wrote:
  Hello,
 
  I'm using the tomcat maven plugin to deploy to an SSL-enabled host.
  I've pointed maven at copy of the keystore used on the tomcat
  server itself, so all the keys should be there. Also, I enabled
  java.net.ssl.debug=all, and confirmed the public key, intermediate
  cert, and CA cert are loaded. Yet, with TLSv1.2 on the server, the
  handshake failed at this point:
 
  0070: 00 17 00 01 00 03 00 13   00 15 00 06 00 07 00 09
   0080: 00 0A 00 18 00 0B 00 0C   00 19 00 0D 00 0E
  00 0F   0090: 00 10 00 11 00 02 00 12   00 04 00 05
  00 14 00 08   00A0: 00 16 00 0B 00 02 01 00
   [Raw read]: length = 5 : 15 03 01 00 02
  . [Raw read]: length = 2 : 02 28
  .( main, READ: TLSv1 Alert, length = 2 main, RECV TLSv1 ALERT:
  fatal, handshake_failure main, called closeSocket() main, handling
  exception: javax.net.ssl.SSLHandshakeException: Received fatal
  alert: handshake_failure main, called close() main, called
  closeInternal(true)
 
  I really had no idea how to interrupt the error - it's a bit
  ambiguous.
 
  I took a wild guess that maybe it was because it was trying TLSv1,
  and enabled 1.1 and 1 on the server - and it appeared to fix the
  error.
 
  So as best as I can tell, even thought tomcat 7 supports TLSv1, the
  tomcat maven plugin does not. I think?

 What's the configuration of Tomcat's Connector(s) in both the
 working and non-working example? What version of the JVM is in use?

  My two main questions would be:
 
  - is there a better way to debug this issue? - is there a way to
  enabled TLSv1.2 support in the tomcat maven plugin?
 
  The maven plugin is version 2.2, maven is 3.0.4 The server is
  tomcat 7.

 What about the JVM being used with Maven?

 Can you try running this tool against your server?
 http://markmail.org/thread/tz4z44nfjl7sy2lj

 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 Comment: GPGTools - http://gpgtools.org

 iQIcBAEBCAAGBQJU+IWnAAoJEBzwKT+lPKRYwDIP/27+p8e6NAdn7qodRKO+WRlr
 ofecmUEk2OIxDz3V3NXMa6ZPBBkpnvEJ0snd8WuXDuLUjqsfy4SZpTnWuV2cx5Vh
 V84JJAnRN2aH3MIm9X+Qi8X4msrdmWg2ZBmU4yf+rNOuX9Uz1OO2kic9kBjRa/WF
 R7sZj4NUrdBag9d4WKCGt7gmUvFVSrmWmEAjof2fi/5FsSyqhT4Jue/J76RDIrGH
 HmRQXBrLyngUqExrVGlCbzQegPvpziBNX0P8mqlSZZ90BCEHm1eB7m4dsR3/wTAD
 0o1Y2cOrWbgWt34pUiSDudX77p4/ENXDpusZ3rje2b7s278C9c5l2NVUJLyLO6uz

Tomcat Maven plugin failure: tries to use a TLSv1 handshake with a TLSv1.2 server.

2015-03-04 Thread Stu Smith
Hello,

   I'm using the tomcat maven plugin to deploy to an SSL-enabled host. I've
pointed maven at copy of the keystore used on the tomcat server itself, so
all the keys should be there. Also, I enabled java.net.ssl.debug=all, and
confirmed the public key, intermediate cert, and CA cert are loaded. Yet,
with TLSv1.2 on the server, the handshake failed at this point:

0070: 00 17 00 01 00 03 00 13   00 15 00 06 00 07 00 09  
0080: 00 0A 00 18 00 0B 00 0C   00 19 00 0D 00 0E 00 0F  
0090: 00 10 00 11 00 02 00 12   00 04 00 05 00 14 00 08  
00A0: 00 16 00 0B 00 02 01 00
[Raw read]: length = 5
: 15 03 01 00 02 .
[Raw read]: length = 2
: 02 28  .(
main, READ: TLSv1 Alert, length = 2
main, RECV TLSv1 ALERT:  fatal, handshake_failure
main, called closeSocket()
main, handling exception: javax.net.ssl.SSLHandshakeException: Received
fatal alert: handshake_failure
main, called close()
main, called closeInternal(true)

I really had no idea how to interrupt the error - it's a bit ambiguous.

I took a wild guess that maybe it was because it was trying TLSv1, and
enabled 1.1 and 1 on the server - and it appeared to fix the error.

So as best as I can tell, even thought tomcat 7 supports TLSv1, the tomcat
maven plugin does not. I think?

My two main questions would be:

- is there a better way to debug this issue?
- is there a way to enabled TLSv1.2 support in the tomcat maven plugin?

The maven plugin is version 2.2, maven is 3.0.4 The server is tomcat 7.

My certs being loaded:
trustStore provider is :
init truststore
adding as trusted cert:
  Subject: CN=StartCom Class 1 Primary Intermediate Server CA, OU=Secure
Digital Certificate Signing, O=StartCom Ltd., C=IL
  Issuer:  CN=StartCom Certification Authority, OU=Secure Digital
Certificate Signing, O=StartCom Ltd., C=IL
  Algorithm: RSA; Serial number: 0x19
  Valid from Wed Oct 24 13:54:17 PDT 2007 until Tue Oct 24 13:54:17 PDT 2017

adding as trusted cert:
  Subject: EMAILADDRESS=shareplaylearn@domainsbyproxy.com, CN=
www.shareplaylearn.com, C=US
  Issuer:  CN=StartCom Class 1 Primary Intermediate Server CA, OU=Secure
Digital Certificate Signing, O=StartCom Ltd., C=IL
  Algorithm: RSA; Serial number: 0x51a8eec8d76a0
  Valid from Sat Jan 24 20:46:45 PST 2015 until Mon Jan 25 21:43:15 PST 2016

adding as trusted cert:
  Subject: CN=StartCom Certification Authority, OU=Secure Digital
Certificate Signing, O=StartCom Ltd., C=IL
  Issuer:  CN=StartCom Certification Authority, OU=Secure Digital
Certificate Signing, O=StartCom Ltd., C=IL
  Algorithm: RSA; Serial number: 0x1
  Valid from Sun Sep 17 12:46:36 PDT 2006 until Wed Sep 17 12:46:36 PDT 2036


There are some notes about unsupported ciphers.. but it doesn't look like
it's the ones the client is requesting anyways:
trustStore provider is :
init truststore
adding as trusted cert:
  Subject: CN=StartCom Class 1 Primary Intermediate Server CA, OU=Secure
Digital Certificate Signing, O=StartCom Ltd., C=IL
  Issuer:  CN=StartCom Certification Authority, OU=Secure Digital
Certificate Signing, O=StartCom Ltd., C=IL
  Algorithm: RSA; Serial number: 0x19
  Valid from Wed Oct 24 13:54:17 PDT 2007 until Tue Oct 24 13:54:17 PDT 2017

adding as trusted cert:
  Subject: EMAILADDRESS=shareplaylearn@domainsbyproxy.com, CN=
www.shareplaylearn.com, C=US
  Issuer:  CN=StartCom Class 1 Primary Intermediate Server CA, OU=Secure
Digital Certificate Signing, O=StartCom Ltd., C=IL
  Algorithm: RSA; Serial number: 0x51a8eec8d76a0
  Valid from Sat Jan 24 20:46:45 PST 2015 until Mon Jan 25 21:43:15 PST 2016

adding as trusted cert:
  Subject: CN=StartCom Certification Authority, OU=Secure Digital
Certificate Signing, O=StartCom Ltd., C=IL
  Issuer:  CN=StartCom Certification Authority, OU=Secure Digital
Certificate Signing, O=StartCom Ltd., C=IL
  Algorithm: RSA; Serial number: 0x1
  Valid from Sun Sep 17 12:46:36 PDT 2006 until Wed Sep 17 12:46:36 PDT 2036


SSL Root Cert install

2014-11-05 Thread Matthew Smith
I'm running Apache Tomcat 7 on Windows Server 2008 R2 with Java jdk
1.8.0_25. I was able to use the keytool.exe command with the -genkey switch
to create a keystore. I then used keytool.exe to create a CSR which I
submitted to an issuer and received a certificate. I have to use
keytool.exe to import the Root and Chain certificates first. I can't get
the import of the Root certificate to work. I get the error message

keytool error: java.io.FileNotFoundException:
C:\Users\Administrator\root.cer (The system cannot find the file specified)

Searches I do for this error seem to only net me results when people run
keytool.exe and it can't find their .keystore. Keytool.exe finds my
keystore just fine, it can't find the actual root.cer file though. I've
tried putting that cert file in the C:\Users\Administrator folder with the
.keystore file, I've put it in the Java jdk folders, I've put it in the
tomcat7 folder, and keytool.exe still can't find it. I've download the
Microsoft Process Monitor util and setup a filter to watch for any
commands/errors related to my root.cer file, and the keytool.exe process
can access the root.cer file, even though the import fails. I've modified
the -file command to use the current directory, I've passed it the full
path to the root.cer file in multiple locations, nothing is working, and
I've run out of ideas for things to try. Has anyone else seen this problem
before?


Excessive threads crashing tomcat

2014-10-21 Thread Smith, Mitchell
Hi

I have an issue where my applicaion servers have recently started failing
with OOM - cannot create native thread errors. However the dump files all
show he majority of threads (over 90%) like the following:

pool-21088-thread-1 - Thread t@36407

java.lang.Thread.State: WAITING
 at sun.misc.Unsafe.park(Native Method)
 - parking to wait for 2bc1d4f0 (a
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
 at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
 at
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
 at
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1079)
 at
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:807)
 at
 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
 at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:724)
Locked ownable synchronizers:
 - None



My first assumption is that these are for a connection pool, however I am
seeing close to 1000 (one thousand) and these never appear to timeout, or
close.


I could of course increase the number of threads the OS allows, but this of
course has memory implications etc and is not really solving the root cause.

Can anyone identify what these are? I see some posts online indicating
these are the connection pool waiting for new requests. But this doesnt
seem to match my configuation for acceptable connections

Any help would be greatly appreciated

Thanks

*Mitchell *

Cable  Wireless Communications Plc is a company registered in England  Wales 
with number:
07130199 and offices located at 3rd Floor, 26 Red Lion Square, London WC1R 4HQ


Re: Excessive threads crashing tomcat

2014-10-21 Thread Smith, Mitchell
Tomcat7
Java1.7_025


On 21 October 2014 20:06, Smith, Mitchell mitchell.sm...@cwc.com wrote:

 Hi

 I have an issue where my applicaion servers have recently started failing
 with OOM - cannot create native thread errors. However the dump files all
 show he majority of threads (over 90%) like the following:

 pool-21088-thread-1 - Thread t@36407

java.lang.Thread.State: WAITING
 at sun.misc.Unsafe.park(Native Method)
 - parking to wait for 2bc1d4f0 (a
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
 at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
 at
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
 at
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1079)
 at
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:807)
 at
 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
 at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:724)
Locked ownable synchronizers:
 - None



 My first assumption is that these are for a connection pool, however I am
 seeing close to 1000 (one thousand) and these never appear to timeout, or
 close.


 I could of course increase the number of threads the OS allows, but this
 of course has memory implications etc and is not really solving the root
 cause.

 Can anyone identify what these are? I see some posts online indicating
 these are the connection pool waiting for new requests. But this doesnt
 seem to match my configuation for acceptable connections

 Any help would be greatly appreciated

 Thanks

 *Mitchell *



Cable  Wireless Communications Plc is a company registered in England  Wales 
with number:
07130199 and offices located at 3rd Floor, 26 Red Lion Square, London WC1R 4HQ


Re: Tomcat Connection Pool Problems with XtraBackup

2014-10-13 Thread John Smith
On Sun, Oct 12, 2014 at 5:56 AM, Stefan Mayr ste...@mayr-stefan.de wrote:

 Hi John,

 Am 11.10.2014 23:30, schrieb John Smith:

 I'm trying to workout a managed backup scheme on a MySQL production
 database with XtraBackup. According to our DBA, XtraBackup doesn't lock
 the
 database, but issues a series of SHOW TABLE STATUS commands and then works
 on the file system level.

 Still, just as XtraBackup runs my logs start to blow up with connection
 pool errors:

 Error getting database connection:[http-nio-8080-exec-5] Timeout: Pool
 empty. Unable to fetch a connection in 10 seconds, none
 available[size:100;
 busy:100; idle:0; lastwait:1].

 There's some suggestion that turning off 'innodb-stats-on-metadata' might
 help so we're trying that.

 ...
 Anything else seem like it could be tweaked in relation to XtraBackup?

 TIA,
 John


 XtraBackup can operate without locks if your database contains only InnoDB
 tables. For other storage engines like MyISAM it still uses locks. A
 problem we seen is high IO load during XtraBackup. Your DBA could check
 iostats while backup is in progress. If this makes your database server
 unresponsive he could try to throttle the backup:
 http://www.percona.com/doc/percona-xtrabackup/2.2/
 innobackupex/throttling_ibk.html

 -Stefan

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


Stefan,

Thanks, that seems to be the problem. We have all InnoDB, and the backup
runs without locks, but the it runs under fairly heavy IO load. It seems
like turning 'innodb-stats-on-metadata' to OFF lessened the strain that the
SHOW STATUS queries from XtraBackup caused. Bumping up maxActive allowed
the pool to handle the slowdown of application queries during the backup.
This has worked so far but if it repeats I'll look into the throttling.
That was my first sense, that it wasn't locking, just pushing too hard on
the DB.

Very helpful. Thanks.

-John


Re: Windows Tomcat install folder

2014-10-13 Thread John Smith


 I don't know about the recommended way, but personally I hate the
 SPACE in Program Files, so I definitely prefer the 2nd option.


Same, I don't even bother with the second level directory. I just install
to c:\apache-tomcat...


Tomcat Connection Pool Problems with XtraBackup

2014-10-11 Thread John Smith
I'm trying to workout a managed backup scheme on a MySQL production
database with XtraBackup. According to our DBA, XtraBackup doesn't lock the
database, but issues a series of SHOW TABLE STATUS commands and then works
on the file system level.

Still, just as XtraBackup runs my logs start to blow up with connection
pool errors:

Error getting database connection:[http-nio-8080-exec-5] Timeout: Pool
empty. Unable to fetch a connection in 10 seconds, none available[size:100;
busy:100; idle:0; lastwait:1].

There's some suggestion that turning off 'innodb-stats-on-metadata' might
help so we're trying that.

At the same time I want to confirm my connection pool settings are good:

Resource name=jdbc/mydatabase_master
  auth=Container
  type=javax.sql.DataSource
  factory=org.apache.tomcat.jdbc.pool.DataSourceFactory
  testWhileIdle=true
  testOnBorrow=true
  testOnReturn=false
  validationQuery=SELECT 1
  validationInterval=3
  timeBetweenEvictionRunsMillis=3
  maxActive=100
  minIdle=10
  maxWait=1
  initialSize=10
  removeAbandonedTimeout=60
  removeAbandoned=true
  minEvictableIdleTimeMillis=3

jdbcInterceptors=org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer
  username=db_user
  password=mypassword
  driverClassName=com.mysql.jdbc.Driver
  url=jdbc:mysql://my.ip:3306/my_database
  /

For everything besides the backup, this configuration works very well. For
most of our traffic, the connection pool size hovers around the
initialSize. It seems like setting the maxActive higher will just spawn new
connections in the pool that are hanging. Anything strike you as...too
tight for lack of a better description, that would force the pool to
continuously add connections when the backup runs?

Anything else seem like it could be tweaked in relation to XtraBackup?

TIA,
John


Re: Daily catalina.out has thousands of NPEs

2014-08-27 Thread John Smith



 You haven't really provided any information, here. Please post full
 stack traces.

 You might want to do something like catch NPE around the area(s) where
 they are being thrown, and log information about the requests that are
 causing them. It may be something like a web search crawler requesting
 the XML with parameters you don't expect, etc.



Chris,

Sorry for the delayed reply. The thing is, there are no stack traces in the
catalina logs. Just the report of the NPE's as cut and pasted above, over
and over again. So I can't get to where the NPE is even being thrown.
Again, the errors are not generated at the application level code, or at
least they're not 500 errors or they would be written to the logback logs,
instead of catalina.out.

I have an a really high amount of traffic (500,000 visits a day) so
detailed catalina logs become so massive they become untenable. I thinned
out logging.properties to simply:

___
handlers = 1catalina.org.apache.juli.FileHandler

1catalina.org.apache.juli.FileHandler.level = SEVERE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
___

Do you know if this configuration removing the full trace?


Best,
John


Daily catalina.out has thousands of NPEs

2014-08-22 Thread John Smith
TC 7.0.54, RHEL 6, JDK 1.7.0_60. I have two RH servers with one instance of
TC on each, set up for clustering. There's a HWLB routing 80 to 8080 with 5
min sticky sessions.

My daily catalina logs are set up to just show SEVERE errors, every day
they average about *30mb* per server with the same set of errors, over and
over:


Aug 21, 2014 12:00:04 AM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet [GetLevelServlet] in context with
path [] threw exception
java.lang.NullPointerException

Aug 21, 2014 12:00:04 AM org.apache.coyote.http11.AbstractHttp11Processor
process
SEVERE: Error processing request
java.lang.NullPointerException

Aug 21, 2014 12:00:04 AM org.apache.coyote.http11.AbstractHttp11Processor
endRequest
SEVERE: Error finishing response
java.lang.NullPointerException

Aug 21, 2014 12:00:13 AM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet [GetLevelServlet] in context with
path [] threw exception
java.lang.NullPointerException

Aug 21, 2014 12:00:13 AM org.apache.coyote.http11.AbstractHttp11Processor
process
SEVERE: Error processing request
java.lang.NullPointerException

Aug 21, 2014 12:00:13 AM org.apache.coyote.http11.AbstractHttp11Processor
endRequest
SEVERE: Error finishing response
java.lang.NullPointerException


GetLevelServlet is the workhorse of the site, providing XML to a SWF
through a simple method:


protected void writeXML(HttpServletResponse res, String xml) throws
IOException {

if (xml == null || xml.isEmpty()) return;

res.setContentType(text/xml);
PrintWriter out = res.getWriter();
out.write(xml);
out.close();
}



About 99% of the site usage is through that servlet. I'm catching all 500
errors and logging them with Logback to a different log file, and I'm not
seeing the NPE's generated on the application level (i.e., com.mysite.*)

I'm using the NIO connector.


!-- Using the non blocking NIO connector --
  Connector port=8080
protocol=org.apache.coyote.http11.Http11NioProtocol
   connectionTimeout=2
   redirectPort=443
   maxConnections=7500
   maxThreads=400
   /


There's a sizable download (8mg) for the SWF (it's a game site). So
useSendFile being on (the default) works incredibly well. The errors in
catalina aren't presenting on the site as much as they are in the logs,
that is, the site seems to be behaving reasonably well despite the enormous
amount of errors in the logs.

Anyone know what might be causing it?

Best,
John


Re: java.lang.IllegalArgumentException at java.nio.Buffer.limit

2014-08-22 Thread John Smith
How would you use a proxy to do that?


On Mon, Aug 18, 2014 at 3:23 PM, Yogesh Rao yog...@gmail.com wrote:

 How about tracing the http request and response for the call made?

 Tip : adding a proxy wud help here to log the entire request.

 Regards,
 -Yogesh

 On Monday, August 18, 2014, John Smith tomcat.ran...@gmail.com wrote:

  On Fri, Aug 8, 2014 at 9:10 AM, John Smith tomcat.ran...@gmail.com
  javascript:; wrote:
 
   On Thu, Aug 7, 2014 at 5:28 PM, Filip Hanik fi...@hanik.com
  javascript:; wrote:
  
   if you could capture the XML that you are trying to write, we can put
 it
   into a test case and reproduce.
  
   Filip
  
  
   I'll try that -- I should be able to catch the IllegalArgumentException
   there when it happens.
  
  
 
  Sorry for the delayed reply. I was out last week.
 
  I caught the error and wrote the XML to the logs. The thing is, 1) It's
  valid XML, and 2) the exact same XML doesn't always cause the exception
 to
  be thrown. I don't believe the issue is the XML String itself. For
 example
  the XML I caught was from memcached and its expiration time is very long.
  If it were just the XML String it would be happening each time, but it's
  intermittent.
 



Re: java.lang.IllegalArgumentException at java.nio.Buffer.limit

2014-08-18 Thread John Smith
On Fri, Aug 8, 2014 at 9:10 AM, John Smith tomcat.ran...@gmail.com wrote:

 On Thu, Aug 7, 2014 at 5:28 PM, Filip Hanik fi...@hanik.com wrote:

 if you could capture the XML that you are trying to write, we can put it
 into a test case and reproduce.

 Filip


 I'll try that -- I should be able to catch the IllegalArgumentException
 there when it happens.



Sorry for the delayed reply. I was out last week.

I caught the error and wrote the XML to the logs. The thing is, 1) It's
valid XML, and 2) the exact same XML doesn't always cause the exception to
be thrown. I don't believe the issue is the XML String itself. For example
the XML I caught was from memcached and its expiration time is very long.
If it were just the XML String it would be happening each time, but it's
intermittent.


Re: java.lang.IllegalArgumentException at java.nio.Buffer.limit

2014-08-08 Thread John Smith



 What's on line 182 of AbstractServlet.java?

 -Terence Bandoian


It's the out.write(xml); line.


java.lang.IllegalArgumentException at java.nio.Buffer.limit

2014-08-07 Thread John Smith
TC 7.0.54 / RHEL 6 / JDK 1.7.0_60

I'm getting a pretty consistent error in my logs that started showing up
recently. I use logback and have a servlet catch all 500 errors and log
them. The error seems to be associated with one servlet that writes XML
output.

Two changes I made recently were implement SSL for one subdirectory on the
webapp, and removing redirects in IPTables to the HWLB. I can't really
think of any other code level changes that might have caused the change in
behavior. Please let me know if you need more information. Any thoughts?

The writeXML method is:

protected void writeXML(HttpServletResponse res, String xml) throws
IOException {
res.setContentType(text/xml);
PrintWriter out = res.getWriter();
out.write(xml);
out.close();
}


The stacktrace almost always looks like this:
_
14:18:59.617 [http-nio-8080-exec-45] ERROR c.m.SiteExceptionHandlerServlet
- Stacktrace was: java.lang.IllegalArgumentException
at java.nio.Buffer.limit(Buffer.java:267)
at org.apache.tomcat.util.buf.C2BConverter.convert(C2BConverter.java:85)
at
org.apache.catalina.connector.OutputBuffer.realWriteChars(OutputBuffer.java:481)
at org.apache.tomcat.util.buf.CharChunk.flushBuffer(CharChunk.java:464)
at org.apache.tomcat.util.buf.CharChunk.append(CharChunk.java:384)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:554)
at org.apache.catalina.connector.CoyoteWriter.write(CoyoteWriter.java:174)
at org.apache.catalina.connector.CoyoteWriter.write(CoyoteWriter.java:184)
at com.mysite.AbstractServlet.writeXML(AbstractServlet.java:182)
at com.mysite.level.GetLevelServlet.getAllAsXML(GetLevelServlet.java:82)
at com.mysite.level.GetLevelServlet.manageActions(GetLevelServlet.java:33)
at com.mysite.AbstractServlet.doPost(AbstractServlet.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
...
__

Although there are variations like:

Stacktrace was: java.lang.IllegalArgumentException
at java.nio.Buffer.position(Buffer.java:236)
at sun.nio.cs.ISO_8859_1$Encoder.encodeArrayLoop(ISO_8859_1.java:179)
at sun.nio.cs.ISO_8859_1$Encoder.encodeLoop(ISO_8859_1.java:212)
at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:561)
at org.apache.tomcat.util.buf.C2BConverter.convert(C2BConverter.java:108)
at
org.apache.catalina.connector.OutputBuffer.realWriteChars(OutputBuffer.java:481)
at org.apache.tomcat.util.buf.CharChunk.flushBuffer(CharChunk.java:464)
at org.apache.tomcat.util.buf.CharChunk.append(CharChunk.java:384)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:554)
at org.apache.catalina.connector.CoyoteWriter.write(CoyoteWriter.java:174)
at org.apache.catalina.connector.CoyoteWriter.write(CoyoteWriter.java:184)
at com.mysite.AbstractServlet.writeXML(AbstractServlet.java:182)

___


Re: Restricting SSL access within webapp

2014-08-05 Thread John Smith
All, Thanks for the thoughtful advice and replies.

To answer a few questions, belatedly, yes it would be an option to move the
admin tools to another instance of TC, as Leo suggested -- in a way a
better one, since it wouldn't need session replication, could exist on a
single server since the traffic would be be trivial, and would be
potentially more secure. I'll probably do this in the long term.

If not that, then url-rewrites or a filter to bounce users out of https is
another simpler option, as Chris suggested.

Based on the information about SSL not being that expensive, I'll just
leave it in for now, at the clients discretion, as Charles originally
suggested. Our user base is probably not going to suddenly all jump on
https, so I can watch and see if it affects performance. The area that
mandatorily requires SSL is configured with a security constraint -- for
the rest of the site, I'll leave it up to the user.

Best,
John


Re: JKS keystore password Encryption

2014-08-05 Thread John Smith

 You may find Wiki also useful:

   http://wiki.apache.org/tomcat/FAQ/Password

 -Ognjen


Write your own datasource implementation which wraps your datasource and
obscure your brains out (XOR http://en.wikipedia.org/wiki/XOR_cipher and
ROT13 http://en.wikipedia.org/wiki/ROT13 are great candidates for this
since their strength matches the protection you'll actually get)

Haha. ROT13: Vg pna'g or penpxrq!

Hmm, Interesting, ROT13 looks oddly like klingon.


SSL redirect problems

2014-08-01 Thread John Smith
TC 7.0.54 / RHEL 6

I have two physical servers, each running an instance of TC. The servers
are behind a hardware loadbalancer. IPTables is routing request on 80 to
8080. Tomcat runs under a non-root user. All good.

I needed to protect an area of our webapp under SSL. Went ahead and
installed the cert on each server. I can go directly to each server by IP
under SSL and get the cert (with the expected IP doesn't match FQDN
warning).

But when I go through the loadbalancer I can't access anything under port
8443. I redirected 443 to 8443 on each TC server using IPTables, but still
no luck.

Is there anything I'm missing? I understand I can install the cert on the
loadbalancer instead, or use httpd as a proxy, but I'd rather just leave it
the way it is if there's any other option.

TIA,
John


Re: SSL redirect problems

2014-08-01 Thread John Smith

  TC 7.0.54 / RHEL 6
 
  I have two physical servers, each running an instance of TC. The servers
  are behind a hardware loadbalancer. IPTables is routing request on 80 to
  8080.


 This seems unnecessary.  If you have a hardware load balancer in front of
 Tomcat, it is the only thing that would ever talk to Tomcat.  Thus if you
 just configure it to go to port 8080 you don't need the iptables rule.  I
 can't imagine it's hurting anything, but just thought I'd mention it.


Not at all, it would seem like a better choice than an OS level redirect
like iptables.



  Tomcat runs under a non-root user. All good.
 
  I needed to protect an area of our webapp under SSL. Went ahead and
  installed the cert on each server. I can go directly to each server by IP
  under SSL and get the cert (with the expected IP doesn't match FQDN
  warning).
 

 You probably want the SSL certificate installed on your hardware load
 balancer.  End client's browsers are going to connect to the hardware load
 balancer, not Tomcat.  Thus you'd want the certificate there so your end
 users can benefit from it.

 Ex:  browser - HTTPS - load balancer - HTTP or HTTPS - Tomcat

 If you put an SSL certificate on your Tomcat servers, that would allow you
 to secure the connection between your load balancer and Tomcat.  Depending
 on your network and security requirements this may or may not be necessary.
  I'd say most people don't do this because terminating SSL on the load
 balancer is sufficient.  It just depends on your requirements though.


Ok, that makes sense. I think just on the loadbalancer will work. In our
configuration, unencrypted traffic between the LB and the servers is
subject to minimal risk, and our security requirements aren't critical.



  But when I go through the loadbalancer I can't access anything under port
  8443. I redirected 443 to 8443 on each TC server using IPTables, but
 still
  no luck.
 
  Is there anything I'm missing?


 The load balancer is almost certainly listening on port 80 and 443.  To
 test, you'd want to connect to the load balancer on one of those ports.
  The load balancer would then connect to one of your backend nodes and
 proxy the request on your behalf.  Your browser will not connect directly
 to the backend nodes (see my point above about not needing the iptables
 rule), unless you specifically point it to the ip address of one of the
 backend nodes.



Sorry, I'm a bit unclear on this. What method of connecting would let me
test?


 I think you'd want it on the load balancer.  Possibly with additional certs
 on your backend nodes, if you want HTTPS communication between the load
 balancer and the Tomcat nodes.

 Dan


Thanks so much for the detailed and quick reply.
John


Re: SSL redirect problems

2014-08-01 Thread John Smith
 Not contradicting anything Daniel is saying, but maybe something to add,
 and maybe that's the missing part of the original puzzle :

 If Tomcat is expecting HTTPS requests on port 8443, then any re-direct or
 response that it is sending back is going to include that port number after
 the hostname.
 (even inside the pages, if you use absolute URL links there).
 So the browser who ultimately receives this, is going to try to talk to
 port 8443.
 But that will not work, if your front-end is expecting further requests on
 port 443, and blocks 8443.
 Unless in all your Tomcat responses, you arrange to replace any reference
 to port 8443, by 443, before they reach the browser again.

 Maybe using a browser plugin like HttpFox, LiveHttpHeaders or Fiddler2
 would allow you to see more clearly what is going on there.


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


Well, that's the part that seems confusing. Left as default, I would have
thought connecting through the LB on 8443 would have worked. Actually I'm
still not clear on which part of the chain is having a problem. Originally,
I had no iptable redirect - I just added it in the great tradition of
programming - try everything and anything until it works. I don't care if
the user has to have 8443 in the URL. Just to be clear, you are suggesting
that then problem would be the iptables redirect?


Re: SSL redirect problems

2014-08-01 Thread John Smith
On Fri, Aug 1, 2014 at 11:54 AM, Mark Thomas ma...@apache.org wrote:

 On 01/08/2014 16:30, Daniel Mikusa wrote:
  You probably want the SSL certificate installed on your hardware load
  balancer.  End client's browsers are going to connect to the hardware
 load
  balancer, not Tomcat.  Thus you'd want the certificate there so your end
  users can benefit from it.

 That depends on whether the load-balancer is operating at layer 4 or
 layer 7.

 Mark


Mark, I have to check which layer it's operating at, but does that mean
that, depending on the layer, the cert should *not* be on the LB?


Re: SSL redirect problems

2014-08-01 Thread John Smith


 No, I am not really going that far.  I am suggesting that that may be
 the kind of thing that is happening, and that you may want to investigate
 with a browser plugin, that the requests/responses are really what you are
 expecting.
 Your initial explanation was a bit confusing and lacking in precise
 details, as to what the load balancer really does, where IPtables does
 what, and how your tomcats are configured (re Connectors, and possibly
 IPtables too).  So we're all kind of guessing here, and just trying to give
 you some tips, to either simplify your setup, or to figure out better what
 is happening.



Well, lets remove the IP tables. I know the certs work because as I said I
can access them directly by going to either server on 8443 directly. The
connectors are configured correctly. There's no security info in web.xml.
The entire site should be available over SSL.

Using Charles, with LB:8443 I get connection refused - without any other
particularly useful info in the response.


Re: SSL redirect problems

2014-08-01 Thread John Smith


 As your testing keep this process in mind.  If you encounter a problem just
 try to break down the flow from your browser to the server and back.  If
 you look at the request at each hop through this process, you can often
 find where things went wrong.  For example, did the request hit the LB?  If
 not, maybe we have a firewall issue or ports are configured right.  If so,
 did it hit one of the backend servers?  If not, maybe there's a config
 issue in the lb.  If it did, what response did it get?  A 4xx / 5xx error,
 ok something went wrong on the backend, need to investigate the logs there
 for more details.

 Hope that helps to clarify.

 Dan


Dan,

It did. It was one of those cases where the simplest answer was assumed but
not tested. The loadbalancer was not listening on 443 or 8443. I was able
to have it redirect 443 to 8443 successfully. I also took your advice and
redirected 80 to 8080 instead of using iptables.

Thanks for your help. So many knowledgeable people on here.

John


Re: SSL redirect problems

2014-08-01 Thread John Smith



 Is your LB configured to listen on 8443, or on 443?  It won't pick up the
 port it's supposed to listen on from the TC instances; you have to specify
 it.


Nailed it. Simplest solution, I didn't even consider it.

Thanks,
John


Re: SSL redirect problems

2014-08-01 Thread John Smith


  There is no response, since you are not even able to connect to that
 IP:port.
 If you are using the IP of the LB, then the LB is not accepting
 connections on port 8443.
 You won't get much further, unless you solve that first.
 But I thought that you wanted your users to access via port 443 ?


Thanks, This was the problem. So simple I should have looked there first.
Facepalms. I was able to redirect 443 to 8443 on the LB with success.


Restricting SSL access within webapp

2014-08-01 Thread John Smith
In my webapp there's a directory '/admin' that's protected under SSL. Users
are forced to use SSL via a security constraint in web.xml. It works great.

As mentioned in the docs and other places, it would be good to prevent SSL
everywhere else on the site, but I searched around and couldn't find
anything that works.I tried adding another security constraint with
transport guarantee set to NONE for url-pattern '/*' but it didn't prevent
https access to the site as a whole.

What's the correct way to selectively restrict https to only one area of a
webapp?

TIA,
John


Re: SSL redirect problems

2014-08-01 Thread John Smith


 Thanks for letting us know what the issue was; many people never come back
 and tell us what fixed it.

 My pleasure. This list is awesome.


Re: SSL redirect problems

2014-08-01 Thread John Smith



 TLS is layer 5 so if the LB is operating at layer 4 it can't host the
 cert. Some LBs can operate at layer 5 so it will depend on your LB
 and/or its configuration.

 Mark


I see. That's good to know. The LB is at 7.


Re: Restricting SSL access within webapp

2014-08-01 Thread John Smith
On Fri, Aug 1, 2014 at 4:34 PM, Caldarale, Charles R 
chuck.caldar...@unisys.com wrote:

  From: John Smith [mailto:tomcat.ran...@gmail.com]
  Subject: Restricting SSL access within webapp

  What's the correct way to selectively restrict https to only one area of
 a webapp?

 Why would you want to do that?  Other than a few extra server CPU cycles,
 what's the harm in allowing SSL anywhere at the client's discretion?

  - Chuck


From the docs:

Also, while the SSL protocol was designed to be as efficient as securely
possible, encryption/decryption is a computationally expensive process from
a performance standpoint. It is not strictly necessary to run an entire web
application over SSL, and indeed a developer can pick and choose which
pages require a secure connection and which do not. For a reasonably busy
site, it is customary to only run certain pages under SSL, namely those
pages where sensitive information could possibly be exchanged.

Unfortunately how to do this isn't explained. I might use a filter. Our
site handles 500,000 visitors a day on two TC instances. Believe me, I need
to consider performance costs.


Re: TC7 and SSL Questions

2014-07-28 Thread John Smith
On Thu, Jul 24, 2014 at 6:24 PM, Ognjen Blagojevic 
ognjen.d.blagoje...@gmail.com wrote:

 John,


 On 24.7.2014 21:11, John Smith wrote:

 1. Can I specify /admin/* as a security constraint url pattern so that
 only
 that directory runs under SSL?


 Yes, you can.



  2. The NIO connector is accepted for JSSE, since I'm using it already, is
 there any point in not using it as my SSL connector?


 If /admin has low traffic, then I would say, there is no need to use
 anything else. For high traffic TLS/SSL applications you may want to do
 some performance measurements of different Tomcat connectors, simulating
 your traffic patterns.



  3. Any known issues with routing 443 to 8443 in Iptables?


 I recommend using JSVC instead of iptables redirect. I had issues with
 redirect when used with virtual hosts. IPv6 (ip6tables) doesn't support
 redirect, either.



  4. The admin tools share underlying classes with the rest of the web
 application, which is why it makes sense to have it just as a subdirectory
 in the same webapp. But would I be better off migrating the admin tools to
 their own webapp for the purposes of SSL?


 Yes, I think so. From the security standpoint, that is way better. It will
 be much easier to apply IP address filtering, move it to another port /
 server, to isolate admin and user privileges, and so on.

 -Ognjen

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


Thanks for the info.

Best,
John


TC7 and SSL Questions

2014-07-24 Thread John Smith
TC 7.0.54 / JDK 1.7.0_60 / RHEL 6

My webapp is the only one on my TC install. It's in webapps/ROOT. Iptables
routes 80 to 8080 and I'm using the NIO connector. There are two physical
servers with that same webapp, using session replication. Everything works
great.

There's a subdirectory /admin in the webapp that has some admin tools
that we've been using behind our firewall and under BASIC authentication. I
want to put just the /admin directory under SSL and have a user/hashed-pass
in the database do the login and authentication instead of having them in
tomcat-users.xml.

Questions:

1. Can I specify /admin/* as a security constraint url pattern so that only
that directory runs under SSL?

2. The NIO connector is accepted for JSSE, since I'm using it already, is
there any point in not using it as my SSL connector?

3. Any known issues with routing 443 to 8443 in Iptables?

4. The admin tools share underlying classes with the rest of the web
application, which is why it makes sense to have it just as a subdirectory
in the same webapp. But would I be better off migrating the admin tools to
their own webapp for the purposes of SSL?

Apologies if I've missed any of this in the docs. Any additional
info/advice appreciated.

Thanks in Advance,
John


Silent failure to deploy or run from configuration descriptor

2014-07-02 Thread Gulliver Smith
Apache Tomcat/7.0.28, Debian

I have two configuration descriptors in /etc/tomcat7/Catalina/localhost/

One, solr.xml deploys correctly and fills catalina.out with lots of
useful messages.


The other fails silently to start (see below).

I see the message INFO: Deploying configuration descriptor in
catalina.out; then there is nothing else in catalina.out.

Is there any way to cause Tomcat to output more debug information? I
haven't been able to narrow an internet search to get useful answers
for this problem.

The most annoying thing is that this has worked fine for at least one
Tomcat 6 installation.

The deployment descriptor is

Context docBase=/opt/myApp/MyApp.war
 crossContext=true 
  Resource
  name=jdbc/LockDB
  auth=Container
  type=javax.sql.DataSource
  maxActive=100
  maxIdle=30
  maxWait=1
  removeAbandoned=true
  testWhileIdle=true
  timeBetweenEvictionRunsMillis=6
  driverClassName=com.mysql.jdbc.Driver
  username=myApp
  password=xx
  url=jdbc:mysql://127.0.0.1/myApp /
   Loader
className=org.apache.catalina.loader.VirtualWebappLoader
virtualClasspath=/opt/myApp/ext/*.jar;/opt/myApp/resources/ /
/Context


Thanks for any guidance

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



Getting 405 status from local Tomcat on Windows

2014-05-30 Thread Dave Smith
I am running Tomcat 7.0.41 on a Windows laptop (8.1 Pro). I know, I know - I
get what I deserve in such a configuration.

 

Actually, it was running fine until about a month ago. Something went
horribly wrong that required I re-install Windows and, basically, start from
scratch. My reason for running Tomcat here? I have a Windows client app,
written in Java, that talks to the Tomcat/JSP server via HTTP. 

 

Since re-installing tomcat and my server application, it runs fine when I
connect to it from a web browser. However, when I tell my desktop client app
to connect to the server, it fails on the initial connection with a 405
status. I am running the server is debug, from Eclipse, and have put
breakpoints in the doGet, doPost, and doPut methods of my ControllerServlet
class that extends the java.servlet.http.HttpServlet. None of these
breakpoints fire before the client gets back the 405 status. (the client
works fine if connecting to the real server running tomcat 6 on an Ubuntu
server.)

 

I can find no place locally where verb filtering is being configured.

 

Any idea will be greatly appreciated.

 

Dave Smith

Brindle Waye, Ltd.

866-522-9839 ext 823

Design-a-Course

The Easiest Way to Train Anyone. Anywhere!

 

Like us on  http://www.facebook.com/brindleadmin Facebook and follow us on
http://www.linkedin.com/company/915700 LinkedIn!

 



Re: SSL on one subdirectory only.

2014-05-29 Thread John Smith
On Tue, May 27, 2014 at 2:21 PM, Mark Thomas ma...@apache.org wrote:

 On 27/05/2014 17:31, John Smith wrote:
  Tomcat 7.0.42,  RHEL6, JDK1.7.0_25, Standalone TC configuration. IPTABLES
  route port 80 to 8080
 
  I've got a subdirectory like 'www.mysite.com/admin' that I want to put
  under FORM based authentication. That's clear enough, and I've got the
 java
  keytool cert working well enough on my dev box until I get one from a CA.
 
  Couple of questions:
 
  1. Anyone familiar with any problems routing 443 to 8443 on *nix boxes
 for
  TC SSL certs? It's preferable to not have my end users needing port
  numbers. The cert doesn't care about the port, IIRC.

 Should be fine.

  2. With the SSL connector enabled, https://* is globally respected on
 the
  entire webapp. Do I need to manually check the URL/protocol to deny or
  redirect https to http outside of '/admin'? Is there any built in TC
  mechanism or suggested best practice to handle this? or should I not
 care?

 Nothing to automatically handle https - http. Unless it causes an
 issue, I'd just leave it.

 Mark

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


Mark, Thanks and appreciated, as always.


Re: SSL on one subdirectory only.

2014-05-29 Thread John Smith



 2. With the SSL connector enabled, https://* is globally respected on the
 entire webapp. Do I need to manually check the URL/protocol to deny or
 redirect https to http outside of '/admin'? Is there any built in TC
 mechanism or suggested best practice to handle this? or should I not care?


 We use two-factor authentification with SSL - but I think in your case
 this can be helpful too - not a big difference.
 Try look at this:

 http://wiki.metawerx.net/wiki/ForcingSSLForSectionsOfYourWebsite



Arseny, thank you. I wasn't aware of the user-data-constraint
and transport-guarantee elements. I'll give them a try.


SSL on one subdirectory only.

2014-05-27 Thread John Smith
Tomcat 7.0.42,  RHEL6, JDK1.7.0_25, Standalone TC configuration. IPTABLES
route port 80 to 8080

I've got a subdirectory like 'www.mysite.com/admin' that I want to put
under FORM based authentication. That's clear enough, and I've got the java
keytool cert working well enough on my dev box until I get one from a CA.

Couple of questions:

1. Anyone familiar with any problems routing 443 to 8443 on *nix boxes for
TC SSL certs? It's preferable to not have my end users needing port
numbers. The cert doesn't care about the port, IIRC.

2. With the SSL connector enabled, https://* is globally respected on the
entire webapp. Do I need to manually check the URL/protocol to deny or
redirect https to http outside of '/admin'? Is there any built in TC
mechanism or suggested best practice to handle this? or should I not care?

Best,
John


Re: RES: Configuring limits of requests/sessions/threads in Tomcat

2014-04-01 Thread Howard W. Smith, Jr.
On Tue, Apr 1, 2014 at 9:30 PM, Frederik Nosi frederik.n...@postecom.itwrote:

 If so, just put an nginx or such in front of you'r Tomcat, you dont need
 an application server for that, it's just like using a tank to shoot a
 mosquito :P


Wow, LOL!


Re: [OT] timeout

2014-03-31 Thread Howard W. Smith, Jr.
On Mar 31, 2014 3:48 AM, André Warnier a...@ice-sa.com wrote:

 Howard W. Smith, Jr. wrote:

 On Sun, Mar 30, 2014 at 9:54 PM, Caldarale, Charles R 
 chuck.caldar...@unisys.com wrote:

 From: Howard W. Smith, Jr. [mailto:smithh032...@gmail.com]
 Subject: Re: timeout

 - and if that is not the reason, then find the person responsible for

 the

 in-between equipment and ask them why their junk closes the connection
 before your application has a chance to respond

 'junk'? please clarify the usage of the word 'junk', here. :)

 I think the definition something of poor quality would fit in this
case,
 if the poor quality were a result of configuring equipment without
regard
 to the requirements of the network users.

  - Chuck


 understood, thanks Chuck. :)


 Yes, what I meant precisely was thus : if after receiving numerous
complaints from your users and your boss that your application is
misbehaving; after an in-depth review of the Apache httpd and tomcat
on-line documentation; after a level-headed discussion of the issue with a
group of independent experts; after a thorough witnessed interview of a
significant sample of the users to ascertain their professional behaviour
in front of a browser and the absence of any problem with their mouse
buttons; after a careful and time-consuming examination of all the
evidence, including the access logs of both tomcat and httpd; if after all
that thus you would come to the inescapable conclusion that it is the
intermediate firewall/gateway that is the cause of all the trouble, then
when you talk to the people responsible for that equipment, the word that
might come to mind then, to qualify this equipment and its settings seen as
a whole, is junk.

 Thank you for offering me the opportunity to clarify this section of my
previous post.


You're welcome, the pleasure was [almost] all mine, and thank you for the
clarification. :-)



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



Re: Request for better deployment usability: should be able to specify context root inside war

2014-03-31 Thread Howard W. Smith, Jr.
On Mon, Mar 31, 2014 at 1:27 PM, Mark Eggers its_toas...@yahoo.com wrote:

 As far as Glassfish versus Apache Tomcat goes, they address different use
 cases. Glassfish is a J2EE application server. Apache Tomcat is a servlet
 container. While you can convince Apache Tomcat to do a lot of things, at
 some point it's better to run an application server if your requirements
 dictate it. Apache TomEE is a good choice.


+1 TomEE is a good choice, and it makes you a Tomcat user, too. :)



 BTW, I like Glassfish and Apache TomEE. It just depends on my use case.


As one that migrated from Glassfish to TomEE, my recommendation is TomEE.


 Concerning string concatenation, I think you would be surprised. Since
 strings are immutable, concatenating strings is very expensive if you're
 doing more than a few. I believe I read somewhere that concatenating 'n'
 strings is proportional to the quadratic of n. In short, ouch. Are there
 better places to spend time on optimization? Probably, but this depends on
 your application. Is concatenating 100 strings using the concatenation
 operator needlessly expensive? Most probably.


In the past, i worked on a contract where I moved some string-processing
Powerbuilder logic from PowerBuilder/client to database stored proc.
Previously, the Powerbuilder client-side string-processing code took 1.5
hours to complete; after i moved the logic to database stored proc, it took
2 to 10 seconds to complete. :)


Re: timeout

2014-03-30 Thread Howard W. Smith, Jr.
On Sun, Mar 30, 2014 at 6:30 PM, André Warnier a...@ice-sa.com wrote:

 - and if that is not the reason, then find the person responsible for the
 in-between equipment and ask them why their junk closes the connection
 before your application has a chance to respond


'junk'? please clarify the usage of the word 'junk', here. :)


Re: timeout

2014-03-30 Thread Howard W. Smith, Jr.
On Sun, Mar 30, 2014 at 9:54 PM, Caldarale, Charles R 
chuck.caldar...@unisys.com wrote:

  From: Howard W. Smith, Jr. [mailto:smithh032...@gmail.com]
  Subject: Re: timeout

   - and if that is not the reason, then find the person responsible for
 the
   in-between equipment and ask them why their junk closes the connection
   before your application has a chance to respond

  'junk'? please clarify the usage of the word 'junk', here. :)

 I think the definition something of poor quality would fit in this case,
 if the poor quality were a result of configuring equipment without regard
 to the requirements of the network users.

  - Chuck


understood, thanks Chuck. :)


Re: PooledConnection.getConnection - Tomcat JDBC Pool

2014-03-25 Thread John Smith
  If that is the case the tomcat jdbc
 pooling library handling the call incorrectly and its a bug.


I'd be suspect of this. Are you actually using *org.apache.tomcat.jdbc.pool*?
Since it's a Tomcat module it seems an odd choice to use outside of Tomcat.

http://docs.oracle.com/javase/7/docs/api/javax/sql/PooledConnection.html



*The connection pool manager, typically the application server, maintains a
pool of PooledConnection objects. If there is a PooledConnection object
available in the pool, the connection pool manager returns a Connection
object that is a handle to that physical connection. If no PooledConnection
object is available, the connection pool manager calls the
ConnectionPoolDataSource method getPoolConnection to create a new physical
connection. The JDBC driver implementing ConnectionPoolDataSource creates a
new PooledConnection object and returns a handle to it. *
My emphasis there. Just using the tomcat jdbc classes doesn't guarantee you
have a pool. It does guarantee you'll get a connection, however it won't be
pooled if there isn't one. Am I misunderstanding that outside of Tomcat
means you're running Tomcat, but have some non-webapp application that's
trying to use the JNDI datasource? Or are you not running Tomcat at all?

Best,
John


Re: Concurrency - Servlet created instances accessing static classes

2014-03-25 Thread John Smith

 If the method is thread-safe - no issue. If it isn't thread-safe then
 you have a problem.

 Mark


Thanks Mark - Clearly and succinctly explained.

Best,
John


Re: Concurrency - Servlet created instances accessing static classes

2014-03-25 Thread John Smith
 First terminology problem: class X isn't instantiated here, an object of
 type class X is instantiated.


As Matisse once said, exactitude is not truth. This sort of hair splitting
isn't helpful. Say Class X is instantiated to a thousand programmers and
they'll understand that it means an instance of Class X.


 Second terminology problem: classes don't make calls, threads do.


Again, google class calls another class. Even the java docs use this
terminology. The last sentence of your answer was helpful, but don't waste
people's time being otherwise pedantic.


Re: Concurrency - Servlet created instances accessing static classes

2014-03-25 Thread John Smith
 You must have been fun to have as a student.


Student is a vague term. Student of which grade, which subject? Student of
a trade? Student of life?

Unfortunately your lack of exactness means I can't understand your joke :)

(I was an even worse employee)

- John


Re: PooledConnection.getConnection - Tomcat JDBC Pool

2014-03-25 Thread John Smith
On Tue, Mar 25, 2014 at 9:54 AM, Filip Hanik fi...@hanik.com wrote:

 Please open a bug, and we will get this taken care of. I do have one
 question,Aries library, on which call does it expect to return the
 connection to the pool? XAConnection.close() or
 XAConnection.getConnection().close(); ?


Jonathan, Filip,

If it is a bug then my answer is way off the mark. I'm sorry. If it's not a
problem, could you explain, in this case, what acts as the connection pool
manager when the Tomcat jdbc pool library is used outside of Tomcat?

Best,
John


Re: Can we increase the logging in localhost_access.log

2014-03-25 Thread John Smith
 We see 404 error in localhost_access so this the place from where we can
 dig into.
 Is there any way we can enhance the logging/information in
 localhost_access_log.
 Or then how can debug what happens between user requests and 404 response,?


Outside of performance monitoring tools, you might try a custom 404 error
that points to a servlet. Within that servlet you can capture information
and log to a separate 404 log file (say, using LogBack). There are a few
pages on the web that describe this process. Here's one:

http://www.journaldev.com/1973/servlet-exception-and-error-handling-example-tutorial

Best,
John


Concurrency - Servlet created instances accessing static classes

2014-03-24 Thread John Smith
I should know this, but I want to confirm with smarter people on the board.

Assume the following:
1. Servlet receives an HTTP POST request. doPost(...) is called.
2. doPost(..) instantiates class X with each request
3. Class X calls a static method of class Y

Assuming I have no synchronization in the method signature or body of Y,
there is a danger of concurrency issues or thread safety issues. Many
instances of X can call Y's static method at the same time, causing BAD
THINGS to happen.

True? I swear I used to know this but I've worked on so much stuff for this
project in the last few months it simply fell out of my brain :). I'm also
aware that the answer to this is often it depends but I'm looking for the
general case answer.

TIA
John


Re: Detecting out-of-memory condition

2014-03-24 Thread Howard W. Smith, Jr.
On Mon, Mar 24, 2014 at 1:57 PM, Caldarale, Charles R 
chuck.caldar...@unisys.com wrote:

  From: James H. H. Lampert [mailto:jam...@touchtonecorp.com]
  Subject: Detecting out-of-memory condition

  We have noticed that after a certain amount of continuous uptime, Tomcat
  eventually runs out of memory.

 Your app has a memory leak.


I agree. My app runs well after/during continuous uptime, but about a month
ago, a certain part of the app was used for annual reporting. Keep-alive
session is available when accessing/using that part of the app, and there
is a heck of amount of data being selected from database and/or stored in
@SessionScoped beans. A memory leak was exposed in that part of the app.
it's on my to-do list to review and refactor that part of the app to
avoid/fix the memory leak in the future.


Re: Effects of turning off sendFile in the NIO connector

2014-03-23 Thread John Smith


 MGwhen you enable sendfile support with request attr
  org.apache.tomcat.sendfile.support = true
 MGYou will need to set these 3 header attributes

 org.apache.tomcat.sendfile.filename: Canonical filename of the file which
 will be sent as a String
 org.apache.tomcat.sendfile.start: Start offset as a Long
 org.apache.tomcat.sendfile.end: End offset as a Long
 MGhtitps://tomcat.apache.org/tomcat-6.0-doc/aio.html

 MGCompression:
 MGset compression=on @ Connector
 MGhttps://tomcat.apache.org/tomcat-7.0-doc/config/http.html

 MGI did not read that TC cannot use sendfile with any compressed Stream?
 MGcan you show us the URL?
 MGThanks

  We also only really need compression on XML data, the site has minimal
  HTML, SWF's don't really benefit from gzip and some binary data we send
  back and forth is already compressed. I could manually implement
  compression on XML at the application level and within the SWF, if
 turning
  off sendFile will have negative consequences.
 
  Tomcat 7.0.42
  RHEL6
  ~4T outbound traffic/day
 
  Best,
  John



Your first link refers to using sendFile for asynchronous writes from a
servlet. Any servlet can instruct Tomcat to perform a sendfile call by
setting the appropriate request attributes. Your answer is not accurate. I
don't need to do anything explicitly with the headers. You should look at
the documentation regarding the HTTP NIO Connector - which you already have
as the second link in your reply. It discusses sendFile and compression,
and how you cannot use both the NIO connector and compression if sendFile
is on (on is the default).


Re: Effects of turning off sendFile in the NIO connector

2014-03-23 Thread John Smith

 John

 The consequences for disabling sendFile are extremely hard to quantify
 as there are so many variables. I would normally expect there to be more
 CPU load but how much more? No idea. It might be impossible to detect,
 it might leaver your CPUs pegged at 100%.

 The only way you will know for sure for your application is to test it
 with your application.

 Mark

 P.S. As you've probably figured out having been Martined, the best
 location for any response from Martin Gainty is /dev/null. I keep
 debating dropping him from the list as he causes far more harm than
 good. A topic for a separate thread I think.



Mark,

Thanks for the answer. As suggested, I'll test it and see what
happens...kind of figured I'd have to do that :)

Appreciate the heads-up on MG. I was wondering why the answer seemed
off.

Best,
Alec


Effects of turning off sendFile in the NIO connector

2014-03-22 Thread John Smith
What effect would setting useSendfile=false have on a web application using
the NIO connector? I'm asking because I may want to use gzip compression in
the connector. The docs state:

*There is a tradeoff between using compression (saving your bandwidth) and
using the sendfile feature (saving your CPU cycles). If the connector
supports the sendfile feature, e.g. the NIO connector, using sendfile will
take precedence over compression. The symptoms will be that static files
greater that 48 Kb will be sent uncompressed.*

It's trivial that adding compression uses CPU cycles, but does that imply
that turning sendFile off even without enabling compression would increase
CPU cycles? It's worth mentioning that the site serves a large (8mg) SWF
file. I believe that was one of the pluses of NIO/sendFile, that it was
good with sending large files under heavy traffic?

We also only really need compression on XML data, the site has minimal
HTML, SWF's don't really benefit from gzip and some binary data we send
back and forth is already compressed. I could manually implement
compression on XML at the application level and within the SWF, if turning
off sendFile will have negative consequences.

Tomcat 7.0.42
RHEL6
~4T outbound traffic/day

Best,
John


Re: Site down for maintenance senario

2014-03-17 Thread John Smith
 Deploy a ROOT web application whose 404 page says Down for
 maintenance. You could even customize this kind of thing to only
 respond to certain URL-prefixes (like [ROOT]/mywebapp/*).

 What will you do while Tomcat is restarting, though, if you have to
 restart?


Restarts take about a second or two, it's an acceptable downtime. Custom
404's are a good idea -- the only content I need in the directory is the
404 maintenance page itself. I can just swap the names of the actual webapp
and 'maintenence' webapp directories (they're exploded).

Thanks to everyone for the other good suggestions.


Hosting recommendations

2014-03-17 Thread John Smith
We're getting killed by our hosting provider (RS) over bandwidth issues. I
swear we scoped this out but somehow were over our agreement by an alarming
amount.

Our daily bandwidth looks like this:
http://s17.postimg.org/btl0sj3jz/rs_traffic.png

That's ~4T/day in bandwidth.

I know it's a little outside the scope of this group, but there's a lot of
smart people on here and I am using Tomcat on the two webservers.

Can anyone suggest a managed hosting company they like. Preferential to
iron, but if a cloud has worked for you please let me know. My boss is
going to stab me.

Thanks,
John


Re: tomcat-native libraries

2014-03-17 Thread John Smith


 Installing the native library will make a difference. Whether the
 difference is large enough to notice depends very much on your
 application. If you want to improve your application's performance I
 suspect your time would be better spent with a profiler to see where the
 bottlenecks are in your application.

 Mark


+1
I had the native APR installed and ended up removing it in favor of keeping
things simple. The NIO connector often recommended by Chris S. and others
works very well.


Re: Hosting recommendations

2014-03-17 Thread John Smith
On Mon, Mar 17, 2014 at 9:55 AM, Mark Thomas ma...@apache.org wrote:

 On 17/03/2014 13:41, John Smith wrote:
  We're getting killed by our hosting provider (RS) over bandwidth issues.
 I
  swear we scoped this out but somehow were over our agreement by an
 alarming
  amount.
 
  Our daily bandwidth looks like this:
  http://s17.postimg.org/btl0sj3jz/rs_traffic.png
 
  That's ~4T/day in bandwidth.

 That looks odd.

 1. Is that volume of traffic reasonable for your site?

 2. Are those figures consistent with your access logs?

 3. I'd expect incoming to be a lot less than outgoing for a typical site.

  I know it's a little outside the scope of this group, but there's a lot
 of
  smart people on here and I am using Tomcat on the two webservers.
 
  Can anyone suggest a managed hosting company they like. Preferential to
  iron, but if a cloud has worked for you please let me know. My boss is
  going to stab me.

 That sort of traffic level is going to cost $$$ pretty much anywhere.
 For example, the bandwidth alone is going to cost upwards of $70k/month
 with Amazon EC2.

 I know it isn't the question you asked but I'd be looking hard at the
 traffic to see if a) those numbers are correct and b) someone didn't do
 something REALLY silly that is causing excessive traffic.

 Mark


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



Mark,

1. Yes, we have ~500,000 visitors per day, and the site is based around a
very popular game that is very data intensive (users creating, browsing and
loading levels and replays).
2. Yes
3. I agree. I'm not clear on the MRTG graphs. The one I posted is the
firewall. The loadbalancer shows equal amounts of in/out, and the web
servers show same incoming as the firewall, and slightly higher outgoing.
It's seems unlikely, but it *may* reflect level saving. I would also think
out would be higher than in though.

All that said, I think the numbers are correct, especially since they look
the same as the MRTG graphs from the old host.

 I'd at least like to get a quote from another hosting company. Any recs at
all?

Best,
John


Re: Hosting recommendations

2014-03-17 Thread John Smith
On Mon, Mar 17, 2014 at 10:25 AM, Mikolaj Rydzewski m...@ceti.pl wrote:

 On 17.03.2014 15:15, John Smith wrote:

  1. Yes, we have ~500,000 visitors per day, and the site is based around a
 very popular game that is very data intensive (users creating, browsing
 and
 loading levels and replays).


 Just a rough idea: maybe differential level load/save will help? In other
 words: to download/upload only changed entities


Like a diff? That's a good idea. It's not that there aren't optimizations
for the data going back and forth, it's just there's got to be something
comparable to RS that's not as expensive.


Re: Possible Tomcat 8.0.3 issue

2014-03-17 Thread Howard W. Smith, Jr.
On Mon, Mar 17, 2014 at 4:14 PM, Felipe Jaekel fkjae...@gmail.com wrote:

 My Tomcat 7 was running fine with this script, but last friday morning I
 started Tomcat 8 setting only this:
 *-Xms2048m -Xmx2048m -XX:MaxPermSize=1024m
 -Dorg.apache.el.parser.COERCE_TO_ZERO=false*
 and the applications crashed too.

 So I'd say that the problem is not my JVM config, but I'm interested on
 improving it. What arguments do you recommend to tune GC?

 Last friday afternoon I created a new Amazon EC2 instance with Tomcat 7 to
 check, and the problem is still there, so It was a damn coincidence that
 this problem started after I migrate to Tomcat 8. As I had a connection
 pool leak with Tomcat 8 it contributed for me to think that it could be


Was the following in your Tomcat7 config before 'and' after migrating to
tomcat8?

-Dorg.apache.el.parser.COERCE_TO_ZERO=false*


Re: Possible Tomcat 8.0.3 issue

2014-03-13 Thread Howard W. Smith, Jr.
On Thu, Mar 13, 2014 at 9:33 AM, burghard.britzke 
b...@charmides.in-berlin.de wrote:

 may be restarting the context would even be sufficient? May be the
 FacesServlet has an issue which implementation are you using? which
 version? which version of PrimeFaces?


earlier, in the thread, he provided the following:

Chrome console output:

 Resource interpreted as Stylesheet but transferred with MIME type
 text/plain: 

http://spdata-apps.net/cliente/javax.faces.resource/theme.css.jsf?ln=primefaces-redmond
.
 login.jsf:3
 Resource interpreted as Script but transferred with MIME type text/plain:


http://spdata-apps.net/cliente/javax.faces.resource/primefaces.js.jsf?ln=primefacesv=4.0.9
.
 login.jsf:3
 Resource interpreted as Image but transferred with MIME type text/plain: 

http://spdata-apps.net/cliente/javax.faces.resource/loading26.gif.jsf?ln=image
.
 login.jsf:22
 GET

http://spdata-apps.net/cliente/javax.faces.resource/primefaces.css.jsf?ln=primefacesv=4.0.9net::ERR_INVALID_CHUNKED_ENCODING
 login.jsf:3

primefacesv=4.0.9

PrimeFaces Elite 4.0.9

Since I usually scour PrimeFaces forum topics, this is the first person
that I have heard/seen using tomcat 8.0.x with PrimeFaces.


Re: Possible Tomcat 8.0.3 issue

2014-03-13 Thread Howard W. Smith, Jr.
On Thu, Mar 13, 2014 at 11:47 AM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Felipe,

 On 3/13/14, 10:57 AM, Felipe Jaekel wrote:
  There are lots of this in catalina log: *12-Mar-2014 08:41:43.828
  WARNING [http-nio-80-exec-28]
  com.sun.faces.application.resource.ResourceHandlerImpl.logMissingResource
 
 
 JSF1064: Unable to find or serve resource, primefaces.js, from library,
  primefaces.* *12-Mar-2014 08:41:43.829 WARNING
  [http-nio-80-exec-28]
  com.sun.faces.application.resource.ResourceHandlerImpl.logMissingResource
  * * org.apache.catalina.connector.ClientAbortException:
  java.io.IOException: Connection reset by peer*
 
  But these always appeared in my logs, I guess it happens when the
  client cancel the page load.


Felipe,  why would a user cancel the page load? is this quite common that
user cancels page load? are there pages in your app that would
provoke/motivate user(s) to cancel page load? this/some page(s) take a long
time to load?


 
  I did found something strange in the access log. Applications
  crashed around 2:20PM. I checked for primefaces.js at this time in
  the access log and its all 200 status, but I noticed some very
  small response sizes in some requests, which explains the
  JavaScripts errors on Chrome console.
 
  Here are the log files and some print-screens:
  https://dl.dropboxusercontent.com/u/66737052/logs-12-03-2014.tar.bz2
 
 
 
  Nothing changed in the system. I started to use Tomcat 8.0.3 in
  production on February 28th and the server is restarted daily to
  recycle PermGen space.

 I'm curious about this: what eats-up your PermGen space?


if this behavior did not occur in tomcat7, why would it (start to) occur
when using tomcat8?



  I'm using Mojarra 2.2.5.


Mojarra 2.2.5 + tomcat8, hmmm

Felipe, which servlet in your web.xml? servlet 2.5, 3.0, 3.1?

Felipe, did you look at tomcat 8 migration guide (URL below)?

https://tomcat.apache.org/migration-8.html



 
  This issue started to manifest at 10AM after a parallel deploy. At
  first only the icons disappeared from the new deployed version, but
  it was functional. Although new and old deployed versions had
  PrimeFaces 4.0.9, I started to think that might be something wrong
  with it, so I deployed a new version using 4.0.10. Problem was
  solved for some hours, but when it returned the status was what I
  mentioned above. Tried to parallel deploy with 4.0.8 but no
  success. After I restarted problem was solved, but in case it's
  relevant, there was only one version of each application running.

 My guess is still OOME: immediately after a parallel-deployment (which
 roughly doubles the non-session resident footprint of your web
 application, which you already say has PermGen issues) things start
 going wonky, and a JVM restart fixes things? My money is on an OOME.
 Note that they don't always have stack-traces along with them, so they
 are easy to miss when eyeballing log files.


Felipe, can you share your java settings, similar to what I shared below?

-Xms3G
-Xmx3G
-XX:MaxPermSize=384m
-XX:+UseTLAB
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled



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

 iQIcBAEBCAAGBQJTIdMGAAoJEBzwKT+lPKRYkkkP/31gOfqH+wxtEFTKXbNRmKPx
 56anmEVQqDo36icLTGRrXS9bhlq5UWZQvdm24n/aA2SeBYJWxOYK0eIU9SnY+Q5w
 CurqA7KLQPw0UVTXXR3k85etGT8Uuivfnup28bPeJTtsifOzlQOHNC/MpyBzhMaR
 vwhc94cXR3HC+eoM5mgGMHiMG17jT1P0ty6kCGuDPPNM3DwVyXxmZE0oQQ+Pgoq9
 XGJEnW1uKJG0vmM4tNRWWCrWxxu0nypMml/a93IdAZNgCkoEUuHnRqS4Qtie9O/i
 sMjuJ/dBrc9qMpBfEvGUhLrO6whFbjnVqwfi6saXIcwvEUhs/w7h0dvOsgF9UxLa
 a8R3mR14QNmLR9Pmh+3OqdwVOx+m4bec5oXjWvitin9RsuaurdRqRDAmvXIWG4ab
 PLTDGaVmKPIx58uizN0WlQloj2haN7FPvlj18rlirb245KK23sYQHPWTRsOV/KXS
 wkzlSmzUoIePzCS6jQcCA+lKQ0Is/+JQvoTlBxOgCV1FlqtYR9LTd4qzTDzsTnuH
 wyhC1+ovscEZPDHlNBUu1RSJGvnB+YccWttcTeXQi3i25bitt+L3HqUyWE7VJbaL
 9SetiKGcsJK/gx9NzSQXEwEoPXuTK3vPmW4HVgIg6X51TKORZpPsfknX/iBd1Hml
 VFCVjzEC334YBFgULc6a
 =w3Sk
 -END PGP SIGNATURE-

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




Site down for maintenance senario

2014-03-12 Thread John Smith
Is there a straightforward way to toggle or add something in Tomcat, in the
event a webapp is intentionally taken 'offline for maintenance? The user
would receive the same single notification page saying as much, for any and
all requests.

Tomcat 7.0.42


Re: NIO connector - connections and threads

2014-03-10 Thread John Smith
Thanks for your reply. So are the open HTTP connections that use my web
application code waiting in line to be processed by the available threads
specified in maxThreads?

Best,
John


On Sun, Mar 9, 2014 at 12:44 PM, Konstantin Kolinko
knst.koli...@gmail.comwrote:

 2014-03-09 2:08 GMT+04:00 John Smith tomcat.ran...@gmail.com:
  Sorry, forgot: Tomcat 7.0.42
 
 
  On Fri, Mar 7, 2014 at 3:59 PM, John Smith tomcat.ran...@gmail.com
 wrote:
 
  The NIO connector has two attributes from the standard HTTP Connector
  implementation, maxConnections and maxThreads with defaults of 1 and
  200, respectively.
 
  Can anyone shine some light on how these work together? If I'm allowing
 up
  to 1 connections, would that mean I only have 200 threads to process
  through them? It would seem to be a disparity between the defaults. If
 I'm
  expecting maxConnection numbers in the area of ~2000 at any given time,
  wouldn't I want to bump up my maxThreads closer to match that?
 
  Production environment is:
 
  DELL PowerEdge R720
  Single Socket Six Core Intel Xeon E5-2640 2.5GHz
  32 GB RAM
  RHEL 6
 

 Roughly speaking,

 The new APIs in java NIO and in Apache APR (and ultimately in
 underlying OS) allow to test whether there are incoming data on a
 network socket without actually reading it.

 A thread is needed when Tomcat calls your code in a web application to
 process a request.

 When request processing ends and control is returned to Tomcat, the
 request processing thread is decoupled from connection and is used to
 process other connections.  With keep-alive feature in HTTP/1.1
 protocol there may be several HTTP requests on the same HTTP
 connection,

 maxConnections = how many open HTTP connection can be hold by Tomcat
 maxThreads = how many requests are being actively processed at the same
 time.

 Best regards,
 Konstantin Kolinko

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




Executor thread pool

2014-03-10 Thread John Smith
How dumb am I being by not using an Executor with a named thread pool?
Currently I just have a Connector in server.xml:

Connector port=8080 protocol=org.apache.coyote.http11.Http11NioProtocol
   connectionTimeout=2
   redirectPort=8443 /

Assuming ~2000 simultaneous connections. Tomcat 7.0.42. RHEL6.

Best,
John


Re: NIO connector - connections and threads

2014-03-10 Thread John Smith
On Mon, Mar 10, 2014 at 11:48 AM, Caldarale, Charles R 
chuck.caldar...@unisys.com wrote:

  From: John Smith [mailto:tomcat.ran...@gmail.com]
  Subject: Re: NIO connector - connections and threads

 Don't top post.

  So are the open HTTP connections that use my web application code waiting
  in line to be processed by the available threads specified in maxThreads?

 The connections won't be waiting, but requests arriving over those
 connections may wait if all the threads are busy.

 Do you really have more than 200 simultaneous _requests_ active?

  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
 MATERIAL and is thus for use only by the intended recipient. If you
 received this in error, please contact the sender and delete the e-mail and
 its attachments from all computers.


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


Don't top post.

Sorry, just getting this list through gmail, normal replies are top posted.

Do you really have more than 200 simultaneous _requests_ active?

If you're implying are 200 people simultaneously, hitting the same page at
the same time, or making the same HTTP POST at the same time, the answer
is, yes, probably.

-John


Re: NIO connector - connections and threads

2014-03-10 Thread John Smith


 Collecting some peak usage data might be interesting.  You definitely want
 your max thread limit to be a bit above the number of concurrent requests
 you're handling.  Of course, that has to be balanced against limits on
 other resources, such as memory and data base connections.

  - Chuck


Thanks, I'm in the process of implementing MoSKito, so I'm hoping to get
some good reporting there.


Re: Tomcat7w.exe

2014-03-10 Thread Howard W. Smith, Jr.
On Sun, Mar 9, 2014 at 3:53 PM, Leo Donahue donahu...@gmail.com wrote:

 On Fri, Mar 7, 2014 at 12:43 PM, Howard W. Smith, Jr. 
 smithh032...@gmail.com wrote:

 
  Actually, i hate clicking on things... I use Windows keyboard shortcuts
 as
  much as possible.
 

 Even when you run the following command, you still get a GUI.

 Tomcat7w //ES/Tomcat7


okay/true.



 Do you Ctrl + Tab your way through that dialog?


yes.



 Plus, I don't know what this is supposed to edit, but it doesn't change the
 values in the Tomcat7w.exe dialog:
 Tomcat7 //ES//Tomcat7 --Startup=Auto  (or Automatic)

 Running that command still shows Manual in the Startup type on the
 General tab.


okay. i never used/tried --Startup=..., because after creating the
Windows Service, I /simply/ use tomcat7w.exe (or Windows Start button 
Administratives Tools  Services) to change the value to 'Automatic'.


Re: Tomcat7w.exe

2014-03-10 Thread Howard W. Smith, Jr.
On Mon, Mar 10, 2014 at 10:37 AM, Jeffrey Janner 
jeffrey.jan...@polydyne.com wrote:

  -Original Message-
  From: Leo Donahue [mailto:donahu...@gmail.com]
  Sent: Friday, March 07, 2014 11:10 AM
  To: users@tomcat.apache.org
  Subject: Tomcat7w.exe
 
  Did I miss something in the documentation about renaming this if one is
  running multiple windows services of Tomcat?
 
  ex:
  #Prod port 80
  c:\apache-tomcat
  c:\apache-tomcat\apache-tomcat-7.0.52
  service install Tomcat7 (from bin directory here)
 
  #Dev port 8080
  c:\apache-tomcat-dev
  c:\apache-tomcat-dev\apache-tomcat-7.0.52
  service install Tomcat7dev (from bin directory here)
 
  If I run the Tomcat7w.exe from #Dev, all of those settings point to
  #Prod.
 
  Unless I change the name of Tomcat7w.exe in #Dev to Tomcat7devw.exe,
  then everything is fine.
 
  Was that listed in the docs somewhere and I missed it?

 Leo,
 If you use the Windows installer that the foundation thoughtfully
 provides, you'll see that the installer actually renames the executables to
 whatever you put in the Windows Service Name field.  So, if you use it to
 install one instance with the service name Prod, then in the bin
 directory, you will have Prod.exe and Prodw.exe.  If you second instance
 uses the service name Dev, then the bin directory will have Dev.exe and
 Devw.exe.  And when you go to look for those processes using Task Manager,
 or Process Explorer, or whatever tool you use, they will actually show up
 as those names.  No more trying to figure out which Tomcat.exe is which.
 Jeff



+1 that's good to know, as I may have a need to have multiple tomcat/tomee
instances. Thanks!



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




Re: NIO connector - connections and threads

2014-03-08 Thread John Smith
Sorry, forgot: Tomcat 7.0.42


On Fri, Mar 7, 2014 at 3:59 PM, John Smith tomcat.ran...@gmail.com wrote:

 The NIO connector has two attributes from the standard HTTP Connector
 implementation, maxConnections and maxThreads with defaults of 1 and
 200, respectively.

 Can anyone shine some light on how these work together? If I'm allowing up
 to 1 connections, would that mean I only have 200 threads to process
 through them? It would seem to be a disparity between the defaults. If I'm
 expecting maxConnection numbers in the area of ~2000 at any given time,
 wouldn't I want to bump up my maxThreads closer to match that?

 Production environment is:

 DELL PowerEdge R720
 Single Socket Six Core Intel Xeon E5-2640 2.5GHz
 32 GB RAM
 RHEL 6

 Best,
 John




Re: Tomcat7w.exe

2014-03-07 Thread Howard W. Smith, Jr.
On Fri, Mar 7, 2014 at 1:11 PM, Leo Donahue donahu...@gmail.com wrote:

  I blame my lack of command line upbringing for not catching that.


I love my MS-DOS command-line days/upbringing (dating back to my first
computer, 1986 Tandy 1000 SX, MS-DOS 5.0, maybe, and I don't remember using
Windows way back at that time).


 Windows people click on things.
 Bad habits.


Actually, i hate clicking on things... I use Windows keyboard shortcuts as
much as possible.


NIO connector - connections and threads

2014-03-07 Thread John Smith
The NIO connector has two attributes from the standard HTTP Connector
implementation, maxConnections and maxThreads with defaults of 1 and
200, respectively.

Can anyone shine some light on how these work together? If I'm allowing up
to 1 connections, would that mean I only have 200 threads to process
through them? It would seem to be a disparity between the defaults. If I'm
expecting maxConnection numbers in the area of ~2000 at any given time,
wouldn't I want to bump up my maxThreads closer to match that?

Production environment is:

DELL PowerEdge R720
Single Socket Six Core Intel Xeon E5-2640 2.5GHz
32 GB RAM
RHEL 6

Best,
John


Re: java: src/network.c:441: Java_org_apache_tomcat_jni_Socket_send: Assertion failed

2014-03-05 Thread Howard W. Smith, Jr.
Chris,

On Tue, Mar 4, 2014 at 4:18 PM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 Dmitry,

 On 3/4/14, 2:48 AM, Dmitry Batiyevskiy wrote:
  Howard, My connector config is the following (i've already posted
  that):
 
  Connector port=8443 maxHttpHeaderSize=8192 maxThreads=15000
  enableLookups=false disableUploadTimeout=true acceptCount=100
  scheme=https secure=true SSLEnabled=true compression=off
  SSLCertificateFile=/opt/tomcat/mycompany.com.crt
  SSLCertificateKeyFile=/opt/tomcat/mycompany.com.key /
 
  Also -Dhttps.protocols=TLSv1 option is passed to java machine
 
  The reason for me to use apr connector is https performance, isn't
  NIO much slower in that?

 I don't have any recent performance data, but using OpenSSL is
 apparently measurably faster than using JSSE.

 On the other hand, is the NIO connector does not crash, isn't that a
 point in its favor?


Can you please clarify your statements above? are you saying that OpenSSL
implies (or equals) NIO or APR?

I'm asking, because I only use NIO connector without SSL.


Re: Tomcat 7.0.52 NIO + Atmospere 1.0.18 damaged responses

2014-03-05 Thread Howard W. Smith, Jr.
On Wed, Mar 5, 2014 at 8:35 AM, Jan Dosoudil jan.dosou...@aura.cz wrote:

 Hi,
 we have application running on Tomcat 7.0.52 with Nio connector (a lot
 older versions too), it uses MyFaces (2.1.12), RichFaces (4.3.5),
 Atmosphere framework (1.0.18). Atmosphere framework is configured to use
 long-polling with Tomcat Nio comet support.


I searched atmosphere google groups mail list, earlier, this morning, for

tomcat nio ssl

and found,

https://groups.google.com/forum/?fromgroups#!searchin/atmosphere-framework/tomcat$20nio$20ssl/atmosphere-framework/J685km4oOvM/2qZMzo4wyfAJ

that topic mentioned something similar to what you are stating here, and i
think they were using same/similar version of atmosphere (1.0.1x).


 Sometimes simple request takes a long time to finish (correlates with
 connectionTimeout set on Connector) and response is damaged. Here is
 example of damaged response from server:

 0

 HTTP/1.1 302 Found
 Server: Apache-Coyote/1.1
 Set-Cookie: JSESSIONID=C524EA667CA4087407A5DCDEA1712E53; Path=/app/;
 HttpOnly
 Location: http://192.168.1.156:8080/app/login
 Content-Length: 0
 Date: Tue, 28 Jan 2014 16:10:54 GMT

 Response packet contains exactly this data, no more data (headers) before
 0. Example contains redirect but problem appears in JSF pages too. 0 is
 end of chunked encoded response.

 Problem went away by switching atmosphere from long-polling to WebSockets


+1 and this was mentioned in that thread (URL above), too.


 so I think there may be problem in Atmospere framework long polling and
 Tomcat async support. I've found workaround using socket.bufferPool=0 but
 i think it's not final solution.

 I don't have simple testcase to easily reproduce this problem. I've tried
 turning on Tomcat debug logs, debugging Tomcat and so on but without usable
 results. My opinion is that atmosphere framework uses NioChannel which
 doesn't own but I'm not able to confirm or reject it.

 Can you suggest me how to debug this problem or give me some tip to find
 final solution?


have you considered upgrading to latest atmosphere version, retesting your
app, and sending a mail to atmosphere list about these issues?

also, is it a requirement or preference to use long-polling instead of
websocket? usually, i think it is default or recommended to upgrade to
websocket, and fallback to long-polling. is long-polling to support target
multiple-servers/platforms and/or clients?


 Thanks,
 Jan Dosoudil

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




Re: java: src/network.c:441: Java_org_apache_tomcat_jni_Socket_send: Assertion failed

2014-03-05 Thread Howard W. Smith, Jr.
On Mar 5, 2014 11:09 AM, Christopher Schultz ch...@christopherschultz.net
wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Howard,

 On 3/5/14, 9:45 AM, Howard W. Smith, Jr. wrote:
  Chris,
 
  On Tue, Mar 4, 2014 at 4:18 PM, Christopher Schultz 
  ch...@christopherschultz.net wrote:
 
  Dmitry,
 
  On 3/4/14, 2:48 AM, Dmitry Batiyevskiy wrote:
  Howard, My connector config is the following (i've already
  posted that):
 
  Connector port=8443 maxHttpHeaderSize=8192
  maxThreads=15000 enableLookups=false
  disableUploadTimeout=true acceptCount=100 scheme=https
  secure=true SSLEnabled=true compression=off
  SSLCertificateFile=/opt/tomcat/mycompany.com.crt
  SSLCertificateKeyFile=/opt/tomcat/mycompany.com.key /
 
  Also -Dhttps.protocols=TLSv1 option is passed to java machine
 
  The reason for me to use apr connector is https performance,
  isn't NIO much slower in that?
 
  I don't have any recent performance data, but using OpenSSL is
  apparently measurably faster than using JSSE.
 
  On the other hand, is the NIO connector does not crash, isn't
  that a point in its favor?
 
 
  Can you please clarify your statements above? are you saying that
  OpenSSL implies (or equals) NIO or APR?

 APR implies OpenSSL, and I suppose vice-versa. APR is native code and
 uses OpenSSL for its SSL engine. All of the pure-Java connectors (BIO,
 NIO, and possible a soon-to-be-available NIO2 connector) all use JSSE
 (Java Secure Sockets Extension) for SSL. For whatever reason, OpenSSL
 is measurably faster than JSSE.

 If you are fronting Tomcat with a web server which terminates SSL
 itself, then I see no particular reason to use the connectors over the
 NIO connectors.

 (Note that you can still use APR for its entropy capabilities even if
 not using it for SSL. You'll get session ids coming from OpenSSL's
 random source instead of Java's. I'm not sure that matters too much.)

 - -chris

Understood. Thanks Chris!

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

 iQIcBAEBCAAGBQJTF0qNAAoJEBzwKT+lPKRYkIUQALqutaNWH1pLL1Gg89RgHyb+
 01ORV9O6q2fwtsIgW5WPurZr6gJAcf8K2C1bAkE6WCudgLrHjaTwQtb5peWFqHr0
 IiCLa2bVxkDXDPFy5ESViPTML6UPiOHBXa707ZAK3vzRB5jy6fHbqMVvPBRx4CzD
 T0jKAqU9Odj38QBaUWvCi1BNgc0J5i4OyXBDNJmchyB0G6tN29vYo9zpaUnl972e
 4qLzmWEGBzUnQ6y2zTga2fOZQJ4Lu5hQCLYmoCM84sU1Xl9BjHJ1Tn1mWm7jEm7V
 zMlIgFlJ/y65AUCqSRerMO5V5y4N+44CeQ2WV5v3hes4htAqRV7BFOgCfQW8e6Ng
 oqn4KLQU81rCOsN61tQIv1j17wkP6vux9WbaDScr+UVfjFZgdygaZvOLkmDs/bXG
 +b3DNsGVswOU4it2Y/cp6NAzwWDQfdfQUYDn9U/XOi9MnYSXNf+2dorTqnUhZ3Y7
 mbxrCFpwKdbgXTkvs1UPwOZVhJ8dBuno/HofKuqbd+s9SkF/eXZNdyWolRUQ8sdK
 KFWgByHW+18IM1RiBieu9/iGA1U4nUz0HvLo0UxXpN1GAXO/67/Hv2h/LiqB/tQh
 yVFbvEZV5bR64D9FoPFReGQG4as2NBfIrbFz4XhqHwps5DDYm7WsS4hK87PE7fNC
 qeyeWruqGubsZfwDrfft
 =ihsJ
 -END PGP SIGNATURE-

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



Re: Optimization on simple requests

2014-03-05 Thread John Smith
Chris,

Thanks! Very helpful advice.

Best,
John


On Tue, Mar 4, 2014 at 1:54 PM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 John,

 On 3/4/14, 1:17 PM, John Smith wrote:
  Tomcat 7.0.42 on RHEL6.
 
  Assume that Tomcat is serving only one jsp page. Say it just
  rewrites a parameter value from the querystring to the html within
  the jsp.
 
  Also assume that there are ~200,000 users attempting to access that
  page - say almost simultaneously.
 
  What are the most relevant optimizations I can make to a single
  instance of tomcat for this scenario?

 So you want the highest-performance solution to the above scenario?

 As for Tomcat configuration, I would use the NIO connector with a
 large number of max connections (you'll have to see what practical
 size to give it) and a large number of threads in your thread pool
 (i.e. executor).

 NIO gets you the benefit of not blocking waiting for a second (or
 third, etc.) keepalive request to arrive over a connection before that
 thread can be used to do some real work. If all connections are
 Connection:close then this is less of an issue.

 If you have a big, beefy CPU relative to your Internet connection's
 bandwidth, you should probably enable compression on the connector:
 that will help you push bytes back to the client faster. You'll have
 to test whether or not this actually helps you in your particular
 situation, because you are trading CPU time for I/O time.

 Define only one Host element in your server.xml, and name it
 whatever your public hostname is: there is a slight optimization in
 the mapper that works slightly faster if you have exactly one Host
 element, and if that name matches the Host header from the request.
 (There is an even faster case for where there are no elements in the
 host list, then the default is used, but I'm not sure how to get a
 zero-element host list and yet still have a default host).

 Don't add any Valves or Filters that you don't absolutely need.

 I would remove any intermediate proxies that don't absolutely need to
 be there (like Apache httpd, Microsoft IIS, nginx, etc.). Tomcat
 itself comes fairly well-configured for performance out of the box
 (except for the use of the BIO connector, which gets the job done and
 it very stable and reliable, but certainly does not win any speed
 contests).

 If you want to optimize the hell out of the experience, you'll want to
 dump JSP: there's a lot of setup that goes into creating the
 environment in which a JSP page runs, and you don't mention that you
 need any of it above.

 If you just need to write HEADER + some value from query string +
 FOOTER, then try to do that all in 3 I/O writes, like this would be in
 a servlet:

 static final String HEADER = htmlheadtitleMy Fast
 Page/title/headbodyh1My Fast Page/h1pYour parameter value
 is i;
 static final String FOOTER = /i/p/body/html;

 void doGet(request, response) {

   ServletOutputStream out = response.getOutputStream();
   out.print(HEADER);
   out.print(request.getParameter(key));
   out.print(FOOTER);
 }

 To save network bandwidth, remove any non-essential whitespace from
 your text as I have done above.

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

 iQIcBAEBCAAGBQJTFiFPAAoJEBzwKT+lPKRYR5wP/iiaEcMIFxKBE9Rr9EP6ZhA+
 +fxznQ1QED232LlhvAAcAiAjnOOv/dzLxmC62dai9EZoV0/24WcMpYaEjaRo2jZu
 jIyeGb4Dn4ommJj7aPG+yesPRRTBY6j23SIauWbnRNBCggn/YCpOnjERuUHPtjMO
 G4kDeZaHGGjfirwTuPYCKxiKlYow6C4H8HUzLH84BvuktPPCgO16qbtCSCI0st+b
 av4pza4lzKSO3YsjS3PBNa7eI9q7zvLYqTeB7TziyLq7Jf5OOWPL73qUVJUgb54A
 M6GzvsdIYWHCigGZff0iHT3oNbDEteSVK7TPLP8+XzI8x8F+xsn5G8yv5wXhStDH
 44g2E2hZLwLhaaSiJqtxKGb2kTwoJA+CX33MnbngOkMGUO7SmRMlkx77d08GiYoA
 uvOKep8zz7R4Is8EZu5sdzUQSxPx2Y59uzQNMiBeER47d+hfu4aOl241QUrN2osO
 NsddzzXB6i9auvdhDdGUkNwbT2Iy8NtMKPBUvM+LWz2GC+8+/WyVeRjhQ5N3BUwc
 5YHCKrHVEgZR/NO7j6HvsqXBdUnbt8JNFp0O6XtkCUtlilDabki50wIqVXn/jEmc
 rG9YJKYDFDQdxJSEnpeZEw5+iDmORkSyIOEMw5htqVCCgeBRp2jeATVWKpdcM76G
 EJD/P6bdni3Vj7kthhjs
 =ADJI
 -END PGP SIGNATURE-

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




Re: Optimization on simple requests

2014-03-05 Thread Howard W. Smith, Jr.
On Tue, Mar 4, 2014 at 1:54 PM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 John,

 On 3/4/14, 1:17 PM, John Smith wrote:
  Tomcat 7.0.42 on RHEL6.
 
  Assume that Tomcat is serving only one jsp page. Say it just
  rewrites a parameter value from the querystring to the html within
  the jsp.
 
  Also assume that there are ~200,000 users attempting to access that
  page - say almost simultaneously.
 
  What are the most relevant optimizations I can make to a single
  instance of tomcat for this scenario?

 So you want the highest-performance solution to the above scenario?

 As for Tomcat configuration, I would use the NIO connector with a
 large number of max connections (you'll have to see what practical
 size to give it) and a large number of threads in your thread pool
 (i.e. executor).

 NIO gets you the benefit of not blocking waiting for a second (or
 third, etc.) keepalive request to arrive over a connection before that
 thread can be used to do some real work. If all connections are
 Connection:close then this is less of an issue.

 If you have a big, beefy CPU relative to your Internet connection's
 bandwidth, you should probably enable compression on the connector:
 that will help you push bytes back to the client faster. You'll have
 to test whether or not this actually helps you in your particular
 situation, because you are trading CPU time for I/O time.

 Define only one Host element in your server.xml, and name it
 whatever your public hostname is: there is a slight optimization in
 the mapper that works slightly faster if you have exactly one Host
 element, and if that name matches the Host header from the request.
 (There is an even faster case for where there are no elements in the
 host list, then the default is used, but I'm not sure how to get a
 zero-element host list and yet still have a default host).

 Don't add any Valves or Filters that you don't absolutely need.

 I would remove any intermediate proxies that don't absolutely need to
 be there (like Apache httpd, Microsoft IIS, nginx, etc.). Tomcat
 itself comes fairly well-configured for performance out of the box
 (except for the use of the BIO connector, which gets the job done and
 it very stable and reliable, but certainly does not win any speed
 contests).

 If you want to optimize the hell out of the experience, you'll want to
 dump JSP: there's a lot of setup that goes into creating the
 environment in which a JSP page runs, and you don't mention that you
 need any of it above.

 If you just need to write HEADER + some value from query string +
 FOOTER, then try to do that all in 3 I/O writes, like this would be in
 a servlet:

 static final String HEADER = htmlheadtitleMy Fast
 Page/title/headbodyh1My Fast Page/h1pYour parameter value
 is i;
 static final String FOOTER = /i/p/body/html;

 void doGet(request, response) {

   ServletOutputStream out = response.getOutputStream();
   out.print(HEADER);
   out.print(request.getParameter(key));
   out.print(FOOTER);
 }

 To save network bandwidth, remove any non-essential whitespace from
 your text as I have done above.


+1 Chris.

What about, also, a servlet/filter to set header for caching resources on
the client for some period of time (if/when applicable)? :)



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

 iQIcBAEBCAAGBQJTFiFPAAoJEBzwKT+lPKRYR5wP/iiaEcMIFxKBE9Rr9EP6ZhA+
 +fxznQ1QED232LlhvAAcAiAjnOOv/dzLxmC62dai9EZoV0/24WcMpYaEjaRo2jZu
 jIyeGb4Dn4ommJj7aPG+yesPRRTBY6j23SIauWbnRNBCggn/YCpOnjERuUHPtjMO
 G4kDeZaHGGjfirwTuPYCKxiKlYow6C4H8HUzLH84BvuktPPCgO16qbtCSCI0st+b
 av4pza4lzKSO3YsjS3PBNa7eI9q7zvLYqTeB7TziyLq7Jf5OOWPL73qUVJUgb54A
 M6GzvsdIYWHCigGZff0iHT3oNbDEteSVK7TPLP8+XzI8x8F+xsn5G8yv5wXhStDH
 44g2E2hZLwLhaaSiJqtxKGb2kTwoJA+CX33MnbngOkMGUO7SmRMlkx77d08GiYoA
 uvOKep8zz7R4Is8EZu5sdzUQSxPx2Y59uzQNMiBeER47d+hfu4aOl241QUrN2osO
 NsddzzXB6i9auvdhDdGUkNwbT2Iy8NtMKPBUvM+LWz2GC+8+/WyVeRjhQ5N3BUwc
 5YHCKrHVEgZR/NO7j6HvsqXBdUnbt8JNFp0O6XtkCUtlilDabki50wIqVXn/jEmc
 rG9YJKYDFDQdxJSEnpeZEw5+iDmORkSyIOEMw5htqVCCgeBRp2jeATVWKpdcM76G
 EJD/P6bdni3Vj7kthhjs
 =ADJI
 -END PGP SIGNATURE-

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




Re: java: src/network.c:441: Java_org_apache_tomcat_jni_Socket_send: Assertion failed

2014-03-04 Thread Howard W. Smith, Jr.
On Mar 4, 2014 2:49 AM, Dmitry Batiyevskiy dmitry.batiyevs...@ardas.dp.ua
wrote:

 Howard,
 My connector config is the following (i've already posted that):

   Connector port=8443 maxHttpHeaderSize=8192
  maxThreads=15000
  enableLookups=false disableUploadTimeout=true
  acceptCount=100 scheme=https secure=true
  SSLEnabled=true
  compression=off
  SSLCertificateFile=/opt/tomcat/mycompany.com.crt
  SSLCertificateKeyFile=/opt/tomcat/mycompany.com.key /


Okay, thanks.

 Also -Dhttps.protocols=TLSv1 option is passed to java machine

 The reason for me to use apr connector is https performance, isn't NIO
much
 slower in that?


Chris recommended NIO. I'll let him answer your question.

 Regards,

 Dmitry Batiyevskiy

 Ardas Group Inc.

 www.ardas.dp.ua


 2014-03-04 2:04 GMT+02:00 Howard W. Smith, Jr. smithh032...@gmail.com:

  On Mon, Mar 3, 2014 at 11:22 AM, Christopher Schultz 
  ch...@christopherschultz.net wrote:
 
   Dmitry,
  
   On 3/3/14, 6:06 AM, Dmitry Batiyevskiy wrote:
Can you advice how we can find the problem in app/environment like
this? What are possible ways to debug this?
  
   Honestly, I'd try switching to the NIO connector and resume your
   testing. If all is well, it may point to a bug in the APR connector
   and/or tcnative itself. If you are having similar problems with the
   pure-Java connectors, then the problem is likely something you are
   doing in your application that is causing an invalid state. You'll
   probably get better information from the Java stack trace than from an
   assertion-failure.
  
   Give that a try and let us know how things go.
 
 
  +1 Chris
 
  I have found much /continued/ success using NIO connector across tomcat
and
  atmosphere versions.
 


Optimization on simple requests

2014-03-04 Thread John Smith
Tomcat 7.0.42 on RHEL6.

Assume that Tomcat is serving only one jsp page. Say it just rewrites a
parameter value from the querystring to the html within the jsp.

Also assume that there are ~200,000 users attempting to access that page -
say almost simultaneously.

What are the most relevant optimizations I can make to a single instance of
tomcat for this scenario?

TIA,
Alec


Re: java: src/network.c:441: Java_org_apache_tomcat_jni_Socket_send: Assertion failed

2014-03-03 Thread Howard W. Smith, Jr.
On Thu, Feb 20, 2014 at 11:00 AM, Dmitry Batiyevskiy 
dmitry.batiyevs...@ardas.dp.ua wrote:

 We have upgraded tomcat 7.0.42 to 7.0.50
 We have an app which is built around atmosphere framework and uses
 websockets
 After upgrade tomcat instance which has only this app dies in few hours
 after deploy (the whole java process dies)


How did you configure atmosphere?

which version of atmosphere are you using?

can you share your web.xml (atmosphere config)?

which atmosphere-related dependencies?

is atmosphere-related dependencies in tomcat/lib or in your WAR file?


  1   2   3   4   5   6   7   8   9   10   >