Re: Tomcat 8.0.15

2016-01-29 Thread Mark Thomas
On 29/01/2016 18:18, juliesur wrote:
> My webapp does show poor performance and stops responding after a while ,
> with these errors in the log.
> I have been unable to replicate the issue in my testing environment during
> load testing. 
> The error appears only in production .
> 
> I haven't tried another connector or diff tomcat version. I want to confirm
> this as a bug before suggesting the team to upgrade or make changes.

The evidence points to an application bug. You are getting an NPE from
the Context. That suggests the Request has been recycled and something
in the application is retaining a reference to the Request and trying to
use it.

Mark


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



RE: [PossibleSpam] Re: Tomcat Rewrite Valve

2016-01-29 Thread Joe Aldrich
Hello,

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Joe,

>On 1/29/16 9:34 AM, Joe Aldrich wrote:
>> I am using Tomcat 8.0.28 on Windows 10 and am having a problem with 
>> the Rewrite Value. I must include the escaped form of an ampersand 
>> '%26' in the output URL.
>> 
>> My rewrite.config has the following:
>> 
>> RewriteCond %{QUERY_STRING} ^(.*&)?SCID=8(&.*)?$ RewriteRule 
>> ^/(product|specs|avail-options|avail-category)\.php$
>> /Product.action?select=Model+4+\%26+4C [R=301,L,NE]
>> 
>> I am escaping the percent sign with a backslash, and I have tried 
>> using the NE flag. However, Tomcat always is treating the percent 
>> symbol as a back reference to the above RewriteCond. If I don't have a 
>> second capture group, then I get a 500 error from a 
>> NullPointerException.

>Can you please post the stack trace from that?

Here is what I get if I don’t specify a second capture group:

HTTP Status 500 - No group 2

type Exception report

message No group 2

description The server encountered an internal error that prevented it from 
fulfilling this request.

exception

java.lang.IndexOutOfBoundsException: No group 2
java.util.regex.Matcher.group(Unknown Source)

org.apache.catalina.valves.rewrite.Substitution$RewriteCondBackReferenceElement.evaluate(Substitution.java:51)

org.apache.catalina.valves.rewrite.Substitution.evaluate(Substitution.java:238)

org.apache.catalina.valves.rewrite.RewriteRule.evaluate(RewriteRule.java:133)

org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:292)

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)

org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)

org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)

org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)

org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)

org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Unknown Source)
note The full stack trace of the root cause is available in the Apache 
Tomcat/8.0.28 logs.

Apache Tomcat/8.0.28

>> I was working with the documentation on this page:
>> 
>> http://tomcat.apache.org/tomcat-8.0-doc/rewrite.html
>> 
>> The desired output URL would be:
>> 
>> http://www.domain.com/Product.html?select=Model+4+%26+4C

>Presumably, if you don't escape it at all, you get:
>
>http://www.domain.com/Product.html?select=Model+4+%2526+4C
>
>?

If I do not use the backslash to escape the percent sign, then (with or without 
the [NE] flag) I get a back-reference resulting in a 500 error if there isn't a 
second capture group. If there is a second capture group I get:

http://www.domain.com/Product.html?select=Model+4+null26+4C

(where again, null represents there was nothing specified after the SCID=8 in 
the query string).

If I omit the [NE] flag and keep the backslash to escape the percent sign, the 
escaping of the percent sign fails and I get similar results except for the 
presence of the backslash in the output URL as:

http://www.domain.com/Product.html?select=Model+4+\null26+4C


>> In the example given for the NE flag on the page reference above, the 
>> percent sign is escaped by a backslash to prevent it from being 
>> treated as a back-reference. This is not working for me. Instead I
>> get:
>> 
>> http://www.domain.com/Product.action?select=Model+4+\null6+4C
>> 
>> Where the "null" is due to an empty second back-reference.  I believe 
>> this is a bug in that it is not escaping the percent sign (making it 
>> impossible to create the %26 in the redirect URL). Or am I 
>> misunderstanding something here?
>> 
>> As a side question, shouldn't an empty back-reference be blank instead 
>> of adding 'null' to the URL?

>I agree that the "null" is incorrect. That is almost certainly a bug.
>
>[NE] should be preventing escaping of the resulting URL, but that might break 
>if you had user-specified input being re-written, but then not escaped.
>
>I'm not entirely sure if backslash-escaping is expected to work for 
>back-references. It's certainly a reasonable expectation, especially if that's 
>the way that mod_rewrite >works (and I don't know if that's the case). The 
>"escaping" section is only mentioned in the "regular expressions" section, and 
>not in the "backreferences" section, which is >why I think there may be some 
>room for alternative interpretations, here.
>
>I'm curious if \$25 works (as opposed to \%25)

Re: TLSv1.2 handshake failure on outgoing connections

2016-01-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dan,

On 1/29/16 3:55 PM, Hrivnak, Dan wrote:
> In case anyone was following this or seeing similar issues, I was 
> able to track it down. When debugging into the Axis library code 
> itself I was able to see one more frame of the stack trace 
> (java.security.InvalidAlgorithmParameterException: parameter
> object not a ECParameterSpec) before it got swallowed up, which led
> me to this article: 
> http://iwang.github.io/support/2014/03/14/cxf-cause-https-error.html
>
> 
> 
> Basically, my classpath had a version of the bouncycastle library 
> meant for JDK 1.4, causing the issue with the ECDH key exchange 
> during the TLS handshake. Removing it solved the problem!

Oh, man. That'll definitely do it.

> Now, in case you are still reading, I can explain why the problem 
> only appeared in the context of running inside Tomcat. Looking at
> the maven dependency tree to see where bouncycastle for JDK 1.4
> came from, I learned that jfreechart listed it as a dependency.

Nice! I'm always careful to make sure that all my charts are
encrypted, so it's great that jFreeChart pulls BC as a dependency. (WTF?
)

> Axis, on the other hand, listed bouncycastle for JDK 1.5+ in its 
> transitive dependencies. Since my unit test was inside a module
> that wasn’t concerned with jfreechart, its classpath only had the
> newer bouncycastle library. But Tomcat, since its classpath
> contained everything my entire application cared about, had both
> versions of bouncycastle. And apparently the classloader decided to
> pick up the old one at runtime.

Heisenbugs all the way down.

> The moral of the story is that Byteman will be a great tool to
> keep handy for times when a stack trace is dropped on the floor by
> code you don’t control.

Looks like a handy tool, especially being able to predictably stall
programs for multi-threaded testing. Force the JVM to behave like
those theoretical "thread A does this then thread B does this"
interleave diagrams that show the potential for deadlock/whatever? Sweet
.

I'm glad you got to the bottom of this.

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

iEYEARECAAYFAlar6PcACgkQ9CaO5/Lv0PBd9wCgrN/jOVqqiTazXN5YSKvUn2hh
l1sAnjcD9/pwcZyAcz2yb6Bw7wSJGHG+
=cNHp
-END PGP SIGNATURE-

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



Re: Tomcat 8: NPE In InternalNioOutputBuffer.java:234

2016-01-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Julie,

On 1/29/16 2:15 PM, Julie Sur wrote:
> Hi Mark,
> 
> I see your comment that the fix will be back ported to  8.0.x and
> 7.0.x. I checked this link 
> http://qnalist.com/questions/5638245/tomcat-8-npe-in-internalniooutput
buffer-java-234
>
>  I am using 8.0.15 and I am seeing this error in my log.
> 
> Which version should I upgrade to for this ?

Hmm. Whatever list aggregator that is has ruined the Buzgilla link
that would have told you the answer:

https://bz.apache.org/bugzilla/show_bug.cgi?id=57252

Looks like 8.0.16.

On the other hand, the answer to "what version should I upgrade to" is
almost always "the latest version in your major version line" --
currently 8.0.30.

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

iEYEARECAAYFAlar3DkACgkQ9CaO5/Lv0PDctgCfTKj4gRx01C0h/AurOdqBKQrj
rrwAnjFo8sEanb7KU7t8kqlXF2jqcRAg
=jijt
-END PGP SIGNATURE-

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



Re: TLSv1.2 handshake failure on outgoing connections

2016-01-29 Thread Hrivnak, Dan
In case anyone was following this or seeing similar issues, I was able to track 
it down. When debugging into the Axis library code itself I was able to see one 
more frame of the stack trace 
(java.security.InvalidAlgorithmParameterException: parameter object not a 
ECParameterSpec) before it got swallowed up, which led me to this article: 
http://iwang.github.io/support/2014/03/14/cxf-cause-https-error.html 


Basically, my classpath had a version of the bouncycastle library meant for JDK 
1.4, causing the issue with the ECDH key exchange during the TLS handshake. 
Removing it solved the problem!

Now, in case you are still reading, I can explain why the problem only appeared 
in the context of running inside Tomcat. Looking at the maven dependency tree 
to see where bouncycastle for JDK 1.4 came from, I learned that jfreechart 
listed it as a dependency. Axis, on the other hand, listed bouncycastle for JDK 
1.5+ in its transitive dependencies. Since my unit test was inside a module 
that wasn’t concerned with jfreechart, its classpath only had the newer 
bouncycastle library. But Tomcat, since its classpath contained everything my 
entire application cared about, had both versions of bouncycastle. And 
apparently the classloader decided to pick up the old one at runtime.

The moral of the story is that Byteman will be a great tool to keep handy for 
times when a stack trace is dropped on the floor by code you don’t control.

Thanks to anyone who took the time to help me out!

Dan Hrivnak

On 1/25/16, 5:19 PM, "Christopher Schultz"  wrote:

>-BEGIN PGP SIGNED MESSAGE-
>Hash: SHA1
>
>Dan,
>
>On 1/25/16 9:28 AM, Hrivnak, Dan wrote:
>> Thank you Chris! I’m glad to hear that Tomcat should have nothing
>> to do with this as that helps narrow down what I should look at.
>> The unit test (really an integration test) spins up an app server
>> using Guice and makes a call to the same remote service (verified
>> same URL, certificate chains, etc). The only difference I can find
>> is that one is running within Tomcat and one isn’t. The actual
>> client code is using Axis 2 to call a SOAP service, so the raw HTTP
>> connection code is inside the Axis library unfortunately.
>
>You might want to check the effective system properties to see if
>there is a JVM-wide trust store in use, or any other TLS-related
>properties. For instance, it's possible to enable/disable protocols
>and such using system properties, and it's also possible to configure
>everything explicitly using code.
>
>Tomcat does the latter for incoming connections, but, as I mentioned,
>doesn't have any hooks into outgoing connections. You should be
>dealing with JSSE, though through Axis in your case.
>
>Good luck,
>- -chris
>
>-BEGIN PGP SIGNATURE-
>Comment: GPGTools - http://gpgtools.org
>Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
>iEYEARECAAYFAlamrZ4ACgkQ9CaO5/Lv0PDUYwCgtYzYzC/ZhuqxUX3/8PkF5rEF
>ETEAn0a92HLNgFmIK0z/4zWsv4qP2YAz
>=svtS
>-END PGP SIGNATURE-
>
>-
>To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>For additional commands, e-mail: users-h...@tomcat.apache.org
>

All information in this message is confidential and may be legally privileged. 
Only intended recipients are authorized to use it.


Re: Tomcat Rewrite Valve

2016-01-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Joe,

On 1/29/16 9:34 AM, Joe Aldrich wrote:
> I am using Tomcat 8.0.28 on Windows 10 and am having a problem with
> the Rewrite Value. I must include the escaped form of an ampersand
> '%26' in the output URL.
> 
> My rewrite.config has the following:
> 
> RewriteCond %{QUERY_STRING} ^(.*&)?SCID=8(&.*)?$ RewriteRule
> ^/(product|specs|avail-options|avail-category)\.php$
> /Product.action?select=Model+4+\%26+4C [R=301,L,NE]
> 
> I am escaping the percent sign with a backslash, and I have tried
> using the NE flag. However, Tomcat always is treating the percent
> symbol as a back reference to the above RewriteCond. If I don't
> have a second capture group, then I get a 500 error from a
> NullPointerException.

Can you please post the stack trace from that?

> I was working with the documentation on this page:
> 
> http://tomcat.apache.org/tomcat-8.0-doc/rewrite.html
> 
> The desired output URL would be:
> 
> http://www.domain.com/Product.html?select=Model+4+%26+4C

Presumably, if you don't escape it at all, you get:

http://www.domain.com/Product.html?select=Model+4+%2526+4C

?

> In the example given for the NE flag on the page reference above,
> the percent sign is escaped by a backslash to prevent it from being
> treated as a back-reference. This is not working for me. Instead I
> get:
> 
> http://www.domain.com/Product.action?select=Model+4+\null6+4C
> 
> Where the "null" is due to an empty second back-reference.  I
> believe this is a bug in that it is not escaping the percent sign
> (making it impossible to create the %26 in the redirect URL). Or am
> I misunderstanding something here?
> 
> As a side question, shouldn't an empty back-reference be blank
> instead of adding 'null' to the URL?

I agree that the "null" is incorrect. That is almost certainly a bug.

[NE] should be preventing escaping of the resulting URL, but that
might break if you had user-specified input being re-written, but then
not escaped.

I'm not entirely sure if backslash-escaping is expected to work for
back-references. It's certainly a reasonable expectation, especially
if that's the way that mod_rewrite works (and I don't know if that's
the case). The "escaping" section is only mentioned in the "regular
expressions" section, and not in the "backreferences" section, which
is why I think there may be some room for alternative interpretations,
here.

I'm curious if \$25 works (as opposed to \%25), and this is merely an
oversight for one type of backreference. Can you confirm whether \$25
works as you expect (i.e. resulting in a URL containing a literal $25)?

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

iEYEARECAAYFAlary+YACgkQ9CaO5/Lv0PAjOACgrxb5md+QtRwzENQCOWtonQft
K70An3MWvKlh2nFgEL/mhjZK+RGIHB2y
=0g9b
-END PGP SIGNATURE-

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



Re: NullPointerException when using NIO connector

2016-01-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

João,

On 1/28/16 3:09 PM, João Sávio wrote:
> I'm using Tomcat 7.0.53 and I've changed it to use the NIO
> connector recently. So, the following error start appearing on the
> logs (few per day)
> 
> Jan 25, 2016 3:10:16 PM org.apache.tomcat.util.net.NioEndpoint
> processSocket SEVERE: Error allocating socket processor 
> java.lang.NullPointerException
> 
> 
> Any guesses? Is it a bug already fixed on newest versions?

Couldn't guess unless there is a stack trace.

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

iEYEARECAAYFAlarvNQACgkQ9CaO5/Lv0PDnvACeIITO/Wx+BBKY1Z+o1PAoilcz
PowAoKZEaVFxhaa8377A1JOlEG+hwo/s
=tzUB
-END PGP SIGNATURE-

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



Tomcat 8: NPE In InternalNioOutputBuffer.java:234

2016-01-29 Thread Julie Sur
Hi Mark,

I see your comment that the fix will be back ported to  8.0.x and 7.0.x. I
checked this link
http://qnalist.com/questions/5638245/tomcat-8-npe-in-internalniooutputbuffer-java-234

I am using 8.0.15 and I am seeing this error in my log.

Which version should I upgrade to for this ?

Thank you
Julie


RE: Tomcat 8.0.15

2016-01-29 Thread juliesur
My webapp does show poor performance and stops responding after a while ,
with these errors in the log.
I have been unable to replicate the issue in my testing environment during
load testing. 
The error appears only in production .

I haven't tried another connector or diff tomcat version. I want to confirm
this as a bug before suggesting the team to upgrade or make changes.




--
View this message in context: 
http://tomcat.10.x6.nabble.com/Re-Tomcat-8-0-15-tp5044779p5045814.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

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



Re: Tomcat https answers by hostname, but not by IP number

2016-01-29 Thread Mark Thomas
On 29/01/2016 17:36, Hubert Hickman wrote:
> Hi Dave !
> 
> 
> The app is specified to run on 6443 - with openings in firewalls between
> installations only for this port.  Tomcat does answer and return data if
> the call is made by hostname to port 6443 - just not by IP number to port
> 6443.
> 
> Regular Apache is running https on 443 and works fine.
> 
> https::6443/yadayada works.
> https::6443/yadayada does not work.

Define doesn't work. Some clients may simply drop the connection because
the host name used to connect doesn't match the name on the certificate.

Wireshark will give you a better idea of what is going on.

Mark


> 
> On Fri, Jan 29, 2016 at 11:28 AM, David kerber  wrote:
> 
>> On 1/29/2016 12:09 PM, Hubert Hickman wrote:
>>
>>> I am running Tomcat 7.0.67 on RHEL 6.7
>>>
>>> I have a tomcat app that is deployed and listening on port 6443 for https
>>> traffic.
>>>
>>> tomcat answers fine by request URLS of the form https://hostname:port/rest
>>> of
>>> URL/etc. However, it does not answer on https://IP 
>>>
>>
>> That's because 6443 is not the standard port for HTTPS.  If you just say
>> https://, without specifying the port, it will go to 443.  It
>> will work if you use https://ip:port.
>>
>>
>> Number:port/rest
>>> of URL/etc EXCEPT for tests I run from the server itself.
>>>
>>> [myuser@adifferenthost ~]$  curl -vk https://IP NUMBER:6443/>> ofURL>* About to connect() to IP NUMBER port 6443 (#0)*   Trying IP
>>> NUMBER... connected* Connected to IP NUMBER (IP NUMBER) port 6443
>>> (#0)* Initializing NSS with certpath: sql:/etc/pki/nssdb* warning:
>>> ignoring value of ssl.verifyhost* NSS error -5961* Closing connection
>>> #0* SSL connect error
>>> curl: (35) SSL connect error
>>>
>>> By convention, the other applications that connect to this port
>>> connect via IP number, not hostname.  Not sure what I am missing in
>>> the setup or certificates ?
>>>
>>> Thanks!
>>>
>>> Hubert
>>>
>>>
>>
>> -
>> 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: client ssl renegotiation after invalidating session

2016-01-29 Thread George Stanchev


-Original Message-
From: Gael Abadin [mailto:gael.aba...@imatia.com] 
Sent: Friday, January 29, 2016 10:33 AM
To: Tomcat Users List
Subject: client ssl renegotiation after invalidating session

I want to invalidate the client ssl cert authentication after the user logs out 
of my application.

There is nothing about it in the docs and google just digs out this unanswered 
old thread from this users list in 2007:

https://mail-archives.apache.org/mod_mbox/tomcat-users/200706.mbox/%3c306958.89260...@web36804.mail.mud.yahoo.com%3E

Does anybody know if there is any way to do it?


Depends what your version of Tomcat is. Since we skipped from 5.5 to 7.0 I 
don't know if 6 has this attribute. For 5.5 we used reflection to dig into the 
Request object and dig the SSLSessionManager which was kind of annoying since 
things shifted underground and we had to readjust for different releases of 5.5



private static boolean invalidateTomcat7AndAboveSSLSession(HttpServletRequest 
httpRequest) {
String serverInfo = 
FedSrvServlet.getServletContainerServerInfo();

if (serverInfo == null) {
log.error("Failed to determine server version");
return false;
}

boolean compatibleTomcat =
(serverInfo.indexOf("Tomcat") > 0 && 
serverInfo.indexOf("7.0") > 0) ||
(serverInfo.indexOf("Tomcat") > 0 && 
serverInfo.indexOf("8.0") > 0) ||
(serverInfo.indexOf("Tomcat") > 0 && 
serverInfo.indexOf("9.0") > 0);

if (compatibleTomcat) {
// Invalidate the SSL Session 
(org.apache.tomcat.util.net.SSLSessionManager)
Method invalidateSessionMethod = null;
Object mgr = 
httpRequest.getAttribute("javax.servlet.request.ssl_session_mgr");
if (mgr != null) {
try {
invalidateSessionMethod = 
mgr.getClass().getMethod("invalidateSession");
if (invalidateSessionMethod == null) {
log.error("Failed to reset SSL 
session: Method invalidateSessionMethod = 
mgr.getClass().getMethod(\"invalidateSession\") failed to return method");
}

invalidateSessionMethod.setAccessible(true);
} catch (Throwable t) {
log.error("Failed to reset SSL session: 
" + t.getMessage(), t);
}

// Invalidate the session
try {
invalidateSessionMethod.invoke(mgr);
log.trace("SSL session reset 
successfully");
return true;
} catch (Throwable t) {
log.error("Failed to reset SSL session: 
invalidateSession() threw exception: " + t.getMessage(), t);
}
} else {
log.error("Failed to reset SSL session: 
httpRequest.getAttribute(\"javax.servlet.request.ssl_session_mgr\") call failed 
to return session manager object");
}
}

return false;
}

Hope this helps.

George


Re: Tomcat https answers by hostname, but not by IP number

2016-01-29 Thread Hubert Hickman
Hi Dave !


The app is specified to run on 6443 - with openings in firewalls between
installations only for this port.  Tomcat does answer and return data if
the call is made by hostname to port 6443 - just not by IP number to port
6443.

Regular Apache is running https on 443 and works fine.

https::6443/yadayada works.
https::6443/yadayada does not work.

On Fri, Jan 29, 2016 at 11:28 AM, David kerber  wrote:

> On 1/29/2016 12:09 PM, Hubert Hickman wrote:
>
>> I am running Tomcat 7.0.67 on RHEL 6.7
>>
>> I have a tomcat app that is deployed and listening on port 6443 for https
>> traffic.
>>
>> tomcat answers fine by request URLS of the form https://hostname:port/rest
>> of
>> URL/etc. However, it does not answer on https://IP 
>>
>
> That's because 6443 is not the standard port for HTTPS.  If you just say
> https://, without specifying the port, it will go to 443.  It
> will work if you use https://ip:port.
>
>
> Number:port/rest
>> of URL/etc EXCEPT for tests I run from the server itself.
>>
>> [myuser@adifferenthost ~]$  curl -vk https://IP NUMBER:6443/> ofURL>* About to connect() to IP NUMBER port 6443 (#0)*   Trying IP
>> NUMBER... connected* Connected to IP NUMBER (IP NUMBER) port 6443
>> (#0)* Initializing NSS with certpath: sql:/etc/pki/nssdb* warning:
>> ignoring value of ssl.verifyhost* NSS error -5961* Closing connection
>> #0* SSL connect error
>> curl: (35) SSL connect error
>>
>> By convention, the other applications that connect to this port
>> connect via IP number, not hostname.  Not sure what I am missing in
>> the setup or certificates ?
>>
>> Thanks!
>>
>> Hubert
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: WebEx meeting invitation: Apache Tomcat: TLS key and certificate generation

2016-01-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Mark,

On 1/27/16 7:31 AM, Mark Thomas wrote:
> The recording for this is now available on the Apache Tomcat
> YouTube channel:
> https://www.youtube.com/channel/UCpqpJ0-G1lYfUBQ6_36Au_g

I missed the live presentation due to scheduling incompetence :(

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

iEYEARECAAYFAlaromEACgkQ9CaO5/Lv0PBpDgCcDKSFTrx6bo+sEw+mfR6nLvlA
2Y8AoIrSU8OQdadkyLVz0O+L+NJ7jEdy
=/F4D
-END PGP SIGNATURE-

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



client ssl renegotiation after invalidating session

2016-01-29 Thread Gael Abadin
I want to invalidate the client ssl cert authentication after the user logs
out of my application.

There is nothing about it in the docs and google just digs out this
unanswered old thread from this users list in 2007:

https://mail-archives.apache.org/mod_mbox/tomcat-users/200706.mbox/%3c306958.89260...@web36804.mail.mud.yahoo.com%3E

Does anybody know if there is any way to do it?

-- 



.

Alberto Gael Abadin Martinez
Junior Developer

[image: IMATIA]

www.imatia.com

*Tel: *+34 986 342 774 ext 4531

*Email: *gael.aba...@imatia.com
Edificio CITEXVI
Fonte das Abelleiras, s/n - Local 27
36310 Vigo (Pontevedra)
España

.



.

Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede
contener información confidencial, siendo para uso exclusivo del
destinatario. Queda prohibida su divulgación copia o distribución a
terceros sin la autorización expresa del remitente. Si usted ha recibido
este mensaje erróneamente, se ruega lo notifique al remitente y proceda a
su borrado. Gracias por su colaboración.
This message, and in the case of any file annexed to it, can have
confidential information, and it is exclusively for the use of the
addressee of the message. It is strictly forbidden to spread a copy or
distribute to third parties, without the express order of the sender. If
you have received this message mistakenly, we request you to notify to the
sender, and please be sure to erase it. Thank you for your collaboration.

.


Re: Tomcat https answers by hostname, but not by IP number

2016-01-29 Thread David kerber

On 1/29/2016 12:09 PM, Hubert Hickman wrote:

I am running Tomcat 7.0.67 on RHEL 6.7

I have a tomcat app that is deployed and listening on port 6443 for https
traffic.

tomcat answers fine by request URLS of the form https://hostname:port/rest of
URL/etc. However, it does not answer on https://IP 


That's because 6443 is not the standard port for HTTPS.  If you just say 
https://, without specifying the port, it will go to 443.  It 
will work if you use https://ip:port.




Number:port/rest
of URL/etc EXCEPT for tests I run from the server itself.

[myuser@adifferenthost ~]$  curl -vk https://IP NUMBER:6443/* About to connect() to IP NUMBER port 6443 (#0)*   Trying IP
NUMBER... connected* Connected to IP NUMBER (IP NUMBER) port 6443
(#0)* Initializing NSS with certpath: sql:/etc/pki/nssdb* warning:
ignoring value of ssl.verifyhost* NSS error -5961* Closing connection
#0* SSL connect error
curl: (35) SSL connect error

By convention, the other applications that connect to this port
connect via IP number, not hostname.  Not sure what I am missing in
the setup or certificates ?

Thanks!

Hubert




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



Re: Tomcat https answers by hostname, but not by IP number

2016-01-29 Thread Jeff Jennings
quick question.

in tomcat can I username/password protect directories with .htaccess like I
can in Apache?

On Fri, Jan 29, 2016 at 12:09 PM, Hubert Hickman 
wrote:

> I am running Tomcat 7.0.67 on RHEL 6.7
>
> I have a tomcat app that is deployed and listening on port 6443 for https
> traffic.
>
> tomcat answers fine by request URLS of the form https://hostname:port/rest
> of
> URL/etc. However, it does not answer on https://IP 
> Number:port/rest
> of URL/etc EXCEPT for tests I run from the server itself.
>
> [myuser@adifferenthost ~]$  curl -vk https://IP NUMBER:6443/ ofURL>* About to connect() to IP NUMBER port 6443 (#0)*   Trying IP
> NUMBER... connected* Connected to IP NUMBER (IP NUMBER) port 6443
> (#0)* Initializing NSS with certpath: sql:/etc/pki/nssdb* warning:
> ignoring value of ssl.verifyhost* NSS error -5961* Closing connection
> #0* SSL connect error
> curl: (35) SSL connect error
>
> By convention, the other applications that connect to this port
> connect via IP number, not hostname.  Not sure what I am missing in
> the setup or certificates ?
>
> Thanks!
>
> Hubert
>


Tomcat https answers by hostname, but not by IP number

2016-01-29 Thread Hubert Hickman
I am running Tomcat 7.0.67 on RHEL 6.7

I have a tomcat app that is deployed and listening on port 6443 for https
traffic.

tomcat answers fine by request URLS of the form https://hostname:port/rest of
URL/etc. However, it does not answer on https://IP 
Number:port/rest
of URL/etc EXCEPT for tests I run from the server itself.

[myuser@adifferenthost ~]$  curl -vk https://IP NUMBER:6443/* About to connect() to IP NUMBER port 6443 (#0)*   Trying IP
NUMBER... connected* Connected to IP NUMBER (IP NUMBER) port 6443
(#0)* Initializing NSS with certpath: sql:/etc/pki/nssdb* warning:
ignoring value of ssl.verifyhost* NSS error -5961* Closing connection
#0* SSL connect error
curl: (35) SSL connect error

By convention, the other applications that connect to this port
connect via IP number, not hostname.  Not sure what I am missing in
the setup or certificates ?

Thanks!

Hubert


Re: WebAppClassLoaderBase.clearReferencesThreads warning

2016-01-29 Thread Mark Thomas
On 29/01/2016 14:34, Yuval Schwartz wrote:
> Hello,
>
> tomcat version: 8.0.22
> java: jdk1.8.0_05
> server: Amazon Linux AMI
>
> I get the following warning message in my catalina log when I undeploy a
> web application:
>
> *WARNING [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
> org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The
> web application [ROOT##002] appears to have started a thread named
> [pool-2-thread-1] but has failed to stop it. This is very likely to create
> a memory leak. Stack trace of thread*
>
> As you can see, for some reason, I don't get a stack trace of the thread.
> Therefore, I have no idea how to debug this warning.
>
> This particular warning was generated when tomcat detected an unused
> version and undeployed it (I set undeployOldVersions="true").
>
> Does anyone know how I can debug this warning. How can I know more about
> this thread?
That looks like a thread from Commons Pool (possibly via DBCP). The only
way to be sure you have a leak or not is to use a profiler. See
http://home.apache.org/~markt/presentations/2010-11-04-Memory-Leaks-60mins.pdf
> I used the manager app and clicked "find leaks" but it said that there were
> none.
> (Can someone also explain why I have to be cautious when using this feature
> on production environments).

It triggers a full GC which may (hopefully briefly) pause the entire JVM.

Mark


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



Tomcat Rewrite Valve

2016-01-29 Thread Joe Aldrich
Hello,

I am using Tomcat 8.0.28 on Windows 10 and am having a problem with the Rewrite 
Value. I must include the escaped form of an ampersand '%26' in the output URL.

My rewrite.config has the following:

RewriteCond %{QUERY_STRING} ^(.*&)?SCID=8(&.*)?$
RewriteRule ^/(product|specs|avail-options|avail-category)\.php$ 
/Product.action?select=Model+4+\%26+4C [R=301,L,NE]

I am escaping the percent sign with a backslash, and I have tried using the NE 
flag. However, Tomcat always is treating the percent symbol as a back reference 
to the above RewriteCond. If I don't have a second capture group, then I get a 
500 error from a NullPointerException.

I was working with the documentation on this page:

http://tomcat.apache.org/tomcat-8.0-doc/rewrite.html

The desired output URL would be:

http://www.domain.com/Product.html?select=Model+4+%26+4C

In the example given for the NE flag on the page reference above, the percent 
sign is escaped by a backslash to prevent it from being treated as a 
back-reference. This is not working for me. Instead I get:

http://www.domain.com/Product.action?select=Model+4+\null6+4C

Where the "null" is due to an empty second back-reference.  I believe this is a 
bug in that it is not escaping the percent sign (making it impossible to create 
the %26 in the redirect URL). Or am I misunderstanding something here?

As a side question, shouldn't an empty back-reference be blank instead of 
adding 'null' to the URL?

Joseph B Aldrich
Junior Java Developer
P: 800.981.1540 | F: 715.254.0996
4848 Industrial Park Rd. Stevens Point. 54481


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



WebAppClassLoaderBase.clearReferencesThreads warning

2016-01-29 Thread Yuval Schwartz
Hello,

tomcat version: 8.0.22
java: jdk1.8.0_05
server: Amazon Linux AMI

I get the following warning message in my catalina log when I undeploy a
web application:

*WARNING [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The
web application [ROOT##002] appears to have started a thread named
[pool-2-thread-1] but has failed to stop it. This is very likely to create
a memory leak. Stack trace of thread*

As you can see, for some reason, I don't get a stack trace of the thread.
Therefore, I have no idea how to debug this warning.

This particular warning was generated when tomcat detected an unused
version and undeployed it (I set undeployOldVersions="true").

Does anyone know how I can debug this warning. How can I know more about
this thread?
I used the manager app and clicked "find leaks" but it said that there were
none.
(Can someone also explain why I have to be cautious when using this feature
on production environments).

Thank you


Re: Application throwing ClassCast Exception while upgrading from tomcat 8.0.18 to tomcat 8.0.30

2016-01-29 Thread Mark Thomas
On 29/01/2016 14:09, Adhavan Mathiyalagan wrote:
> Hi Mark,
> 
>  Kindly let me know if any further information required apart from the
> information that i have provided in the above mail.

You haven't answered my question. How are you inserting the non-String
data into the request parameter map?

Mark


> 
> Thanks & Regards,
> Adhavan.M
> 
> 
> 
> On Wed, Jan 27, 2016 at 4:09 PM, Adhavan Mathiyalagan 
> wrote:
> 
>> Hi Mark,
>>
>> Kindly find my answer for your query
>>
>> How are you inserting Integers into that Map?
>>
>> Displaytag(3pp)  introduces the value for the 'table name parameter
>> tag'(highlighted in bold) as integer in the request .
>>
>> this is used as identifier for the table name.
>>
>> Http Request Parameter :
>>
>> {*d-3034713-p=1*,
>> Description=[Ljava.lang.String;@9afb582,
>> SuToken=[Ljava.lang.String;@6eb56ec5,
>> requestMapping=[Ljava.lang.String;@497b804b,
>> IVP_Code=[Ljava.lang.String;@4b23e19d,
>> RequestTimeStamp=[Ljava.lang.String;@20b130f5,
>> OkButton=[Ljava.lang.String;@51053597,
>> FW_SubmittedFormPath=[Ljava.lang.String;@2d01760f,
>> IVP_Description=[Ljava.lang.String;@3aede9de,
>> SuStepName=[Ljava.lang.String;@59950c0b,
>> Code=[Ljava.lang.String;@4849d41f}
>>
>> As the tomcat version ( greater than tomcat 8.0.18) version restricts the
>> parameter value type to String only Hence the below class cast exception is
>> thrown .
>>
>> Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast
>> to [Ljava.lang.String;
>> at
>> org.apache.catalina.core.ApplicationHttpRequest.getParameter(ApplicationHttpRequest.java:369)
>> at
>> org.displaytag.util.DefaultRequestHelper.getParameterMap(DefaultRequestHelper.java:128)
>> at
>> org.displaytag.util.DefaultRequestHelper.getHref(DefaultRequestHelper.java:75)
>> at
>> com.ccc.ddd.cfw.wcs.uitemplates.taglib.displaytag.ExtendedRequestHelper.getHref(ExtendedRequestHelper.java:191)
>> at org.displaytag.tags.TableTag.initHref(TableTag.java:1061)
>> at
>> com.ccc.ddd.cfw.wcs.uitemplates.taglib.displaytag.TableTag.initHref(TableTag.java:666)
>> at org.displaytag.tags.TableTag.initParameters(TableTag.java:866)
>> at org.displaytag.tags.TableTag.doStartTag(TableTag.java:722)
>> at
>> com.ccc.ddd.cfw.wcs.uitemplates.taglib.displaytag.TableTag.doStartTag(TableTag.java:712)
>>
>>
>> Version of the 3PP Used :
>>
>> Displaytag version : displaytag 1.1
>> Tomcat Version : tomcat 8.0.30
>>
>> Kindly suggest me the path forward for the issue.
>>
>> Thanks in Advance.
>>
>> Adhavan.M
>>
>>
>>
>> On Fri, Jan 22, 2016 at 6:46 PM, Mark Thomas  wrote:
>>
>>> On 22/01/2016 13:01, Adhavan Mathiyalagan wrote:
 Hi Mark,

 Kindly let me know if you can conclude if the issue is on the client
>>> side
 of application or  tomcat restriction that has/will be reverted.
>>>
>>> Until you answer my previous question, this thread is not going to
>>> progress.
>>>
>>> Mark
>>>
>>>

 Note : As i mentioned already the application was working without issues
 with tomcat version <= 8.0.18

 Thanks ,
 Adhavan



 On Wed, Jan 20, 2016 at 4:17 AM, Mark Thomas  wrote:

> On 19/01/2016 16:37, Adhavan Mathiyalagan wrote:
>> Thanks Mark ! Please find my answer
>>
>> Figure out what is inserting something other than String[] as the
>>> value
>> into a Map instance.
>>
>> There are lot of places in Client we insert 'Integer' datatype
>>> (Also
>> other datatypes) .I fear that it is going to be more
>> tedious thing to identify and fix all the client code.
>>
>>  Is there any other way or path forward to fix this ? (Like upgrading
>>> the
>> displaytag version
>> which is currently 1.1)  Or Is the modifying the Client Code is the
>>> only
>> path forward ?
>
> It depends. How are you inserting Integers into that Map? I'm trying to
> figure out if this is a client code bug or if the restriction that was
> added to Tomcat was overly strict and needs to be reverted.
>
> Mark
>
>
>>
>> Thanks Again !
>>
>> On Tue, Jan 19, 2016 at 8:12 PM, Mark Thomas 
>>> wrote:
>>
>>> On 19/01/2016 13:39, Adhavan Mathiyalagan wrote:
>>>
>>> 
>>>
 What i could understand is application is throwing exception due to
>>> change
 in the getParameter method of ApplicationHttpRequest class ,which
> earlier
 was accepting all datatypes (like Integer)
 is now restricted to 'String'  datatype only .

 Kindly let me know why this change has been done ( in the
>>> getParameter
 method of ApplicationHttpRequest class)
>>>
>>> If only the Apache Tomcat project used some form of version control
>>> system where every change to the source code was tracked along with a
>>> comment that explained why...
>>>
 and the suggest me the path forward
 for fixing the issue.
>>>
>>> Figure out what is inserting someth

Re: Application throwing ClassCast Exception while upgrading from tomcat 8.0.18 to tomcat 8.0.30

2016-01-29 Thread Adhavan Mathiyalagan
Hi Mark,

 Kindly let me know if any further information required apart from the
information that i have provided in the above mail.

Thanks & Regards,
Adhavan.M



On Wed, Jan 27, 2016 at 4:09 PM, Adhavan Mathiyalagan 
wrote:

> Hi Mark,
>
> Kindly find my answer for your query
>
> How are you inserting Integers into that Map?
>
> Displaytag(3pp)  introduces the value for the 'table name parameter
> tag'(highlighted in bold) as integer in the request .
>
> this is used as identifier for the table name.
>
> Http Request Parameter :
>
> {*d-3034713-p=1*,
> Description=[Ljava.lang.String;@9afb582,
> SuToken=[Ljava.lang.String;@6eb56ec5,
> requestMapping=[Ljava.lang.String;@497b804b,
> IVP_Code=[Ljava.lang.String;@4b23e19d,
> RequestTimeStamp=[Ljava.lang.String;@20b130f5,
> OkButton=[Ljava.lang.String;@51053597,
> FW_SubmittedFormPath=[Ljava.lang.String;@2d01760f,
> IVP_Description=[Ljava.lang.String;@3aede9de,
> SuStepName=[Ljava.lang.String;@59950c0b,
> Code=[Ljava.lang.String;@4849d41f}
>
> As the tomcat version ( greater than tomcat 8.0.18) version restricts the
> parameter value type to String only Hence the below class cast exception is
> thrown .
>
> Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast
> to [Ljava.lang.String;
> at
> org.apache.catalina.core.ApplicationHttpRequest.getParameter(ApplicationHttpRequest.java:369)
> at
> org.displaytag.util.DefaultRequestHelper.getParameterMap(DefaultRequestHelper.java:128)
> at
> org.displaytag.util.DefaultRequestHelper.getHref(DefaultRequestHelper.java:75)
> at
> com.ccc.ddd.cfw.wcs.uitemplates.taglib.displaytag.ExtendedRequestHelper.getHref(ExtendedRequestHelper.java:191)
> at org.displaytag.tags.TableTag.initHref(TableTag.java:1061)
> at
> com.ccc.ddd.cfw.wcs.uitemplates.taglib.displaytag.TableTag.initHref(TableTag.java:666)
> at org.displaytag.tags.TableTag.initParameters(TableTag.java:866)
> at org.displaytag.tags.TableTag.doStartTag(TableTag.java:722)
> at
> com.ccc.ddd.cfw.wcs.uitemplates.taglib.displaytag.TableTag.doStartTag(TableTag.java:712)
>
>
> Version of the 3PP Used :
>
> Displaytag version : displaytag 1.1
> Tomcat Version : tomcat 8.0.30
>
> Kindly suggest me the path forward for the issue.
>
> Thanks in Advance.
>
> Adhavan.M
>
>
>
> On Fri, Jan 22, 2016 at 6:46 PM, Mark Thomas  wrote:
>
>> On 22/01/2016 13:01, Adhavan Mathiyalagan wrote:
>> > Hi Mark,
>> >
>> > Kindly let me know if you can conclude if the issue is on the client
>> side
>> > of application or  tomcat restriction that has/will be reverted.
>>
>> Until you answer my previous question, this thread is not going to
>> progress.
>>
>> Mark
>>
>>
>> >
>> > Note : As i mentioned already the application was working without issues
>> > with tomcat version <= 8.0.18
>> >
>> > Thanks ,
>> > Adhavan
>> >
>> >
>> >
>> > On Wed, Jan 20, 2016 at 4:17 AM, Mark Thomas  wrote:
>> >
>> >> On 19/01/2016 16:37, Adhavan Mathiyalagan wrote:
>> >>> Thanks Mark ! Please find my answer
>> >>>
>> >>> Figure out what is inserting something other than String[] as the
>> value
>> >>> into a Map instance.
>> >>>
>> >>> There are lot of places in Client we insert 'Integer' datatype
>> (Also
>> >>> other datatypes) .I fear that it is going to be more
>> >>> tedious thing to identify and fix all the client code.
>> >>>
>> >>>  Is there any other way or path forward to fix this ? (Like upgrading
>> the
>> >>> displaytag version
>> >>> which is currently 1.1)  Or Is the modifying the Client Code is the
>> only
>> >>> path forward ?
>> >>
>> >> It depends. How are you inserting Integers into that Map? I'm trying to
>> >> figure out if this is a client code bug or if the restriction that was
>> >> added to Tomcat was overly strict and needs to be reverted.
>> >>
>> >> Mark
>> >>
>> >>
>> >>>
>> >>> Thanks Again !
>> >>>
>> >>> On Tue, Jan 19, 2016 at 8:12 PM, Mark Thomas 
>> wrote:
>> >>>
>>  On 19/01/2016 13:39, Adhavan Mathiyalagan wrote:
>> 
>>  
>> 
>> > What i could understand is application is throwing exception due to
>>  change
>> > in the getParameter method of ApplicationHttpRequest class ,which
>> >> earlier
>> > was accepting all datatypes (like Integer)
>> > is now restricted to 'String'  datatype only .
>> >
>> > Kindly let me know why this change has been done ( in the
>> getParameter
>> > method of ApplicationHttpRequest class)
>> 
>>  If only the Apache Tomcat project used some form of version control
>>  system where every change to the source code was tracked along with a
>>  comment that explained why...
>> 
>> > and the suggest me the path forward
>> > for fixing the issue.
>> 
>>  Figure out what is inserting something other than String[] as the
>> value
>>  into a Map instance.
>> 
>>  Mark
>> 
>> 
>>  -
>>  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>  For additi

RE: FW: Re: tomcat 6.0.41 heap size issue

2016-01-29 Thread Guo, Denny
We have total 64G physical memory on that server.  We are running 2 tomcat 
instances on that server, and each one has 24G heap size and 512M PermSize. 

We capture the memory dump when we see the heap size message in the log, we 
send dump to developer, however, they could not pinpoint what is the cause. 

The interesting thing is before it really reaches 24G heap size, sometime even 
just 16G,  we actually see the complain about out of space issue. 

-Original Message-
From: Akbar Thanakalacheruvu [mailto:akb...@sumtotalsystems.com] 
Sent: Friday, January 29, 2016 8:55 AM
To: Tomcat Users List
Subject: RE: FW: Re: tomcat 6.0.41 heap size issue

Take heap dump using jvisualvm and analyze the objects that stayed in the 
memory. You might get a rootcause to your problem. 
What is the total RAM of your machine? How much you allocated to Tomcat? 
Is any of your users running an application which requires huge amount of heap 
memory? Either tune that particular application or ask your users to try 
minimize/avoid usage of that application.

-Akbar
-Original Message-
From: Mark Thomas [mailto:ma...@apache.org]
Sent: Friday, January 29, 2016 7:16 AM
To: Tomcat Users List 
Subject: Re: FW: Re: tomcat 6.0.41 heap size issue

On 29/01/2016 11:07, Guo, Denny wrote:
> Yes, we do have this option on for MaxPermSize, it is set to 512M.
> 
> If that is related to PermSize, should we get this message " 
> java.lang.OutOfMemoryError: PermGen space". However we never see this message 
> in the log.

Use a profiler. Find out what is using all that memory.

Mark


> 
> -Original Message-
> From: kidambi madhu [mailto:madhu.kida...@gmail.com]
> Sent: Thursday, January 28, 2016 11:43 PM
> To: Tomcat Users List
> Subject: Re: FW: Re: tomcat 6.0.41 heap size issue
> 
> Ok What's the size of the war file you have deployed to Tomcat?
> 
> I suspect the problem is with PermSize (The class loading part of JVM) than 
> Heap though the error points out Java Heap.
> 
> Pls set the PermSize with -XX:PermSize and -XX:MaxPermSize options and test.
> 
> Thanks,
> Madhu
> 
> On Fri, Jan 29, 2016 at 8:53 AM, Guo, Denny  wrote:
> 
>> Thanks for quick response. Here is the information.
>>
>> java version "1.6.0_45"
>> Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM) 
>> 64-Bit Server VM (build 20.45-b01, mixed mode)
>>
>>
>> -Original Message-
>> From: kidambi madhu [mailto:madhu.kida...@gmail.com]
>> Sent: Thursday, January 28, 2016 10:15 PM
>> To: Tomcat Users List
>> Subject: Re: FW: Re: tomcat 6.0.41 heap size issue
>>
>> Hi Denny,
>>
>> Which JDK you are using Oracle JDK/JRockit and which version.
>>
>> Some memory tuning options depend on JDK product used.
>>
>> Thanks,
>> Madhu
>>
>> On Fri, Jan 29, 2016 at 8:39 AM, Guo, Denny 
>> wrote:
>>
>>>
>>> Hi All,
>>>
>>> Looking for help on tomcat heap size issue.
>>>
>>> We are see below GC activity before tomcat reports the heap size error.
>>> Please see below message. However, we assign -Xmx=24G to the heap 
>>> size, why tomcat reports error even not reach 20G heap size usage ?
>>> Can someone please help. How the tomcat decides how much memory 
>>> allocate to young/old generation?
>>>
>>> We are running tomcat 6.0.41 on red hat linux as per our vendor.
>>>
>>> Thanks,
>>> Denny
>>>
>>> 2016-01-28T21:20:56.173-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222720K)], 26.7667120 secs] [Times:
>>> user=26.77 sys=0.01, real=26.76 secs]
>>> 2016-01-28T21:21:22.942-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222720K)], 26.5016220 secs] [Times:
>>> user=26.51 sys=0.01, real=26.50 secs]
>>> 2016-01-28T21:21:49.444-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 26.7081550 secs] [Times:
>>> user=26.70 sys=0.01, real=26.70 secs]
>>> 2016-01-28T21:22:16.154-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 26.7299520 secs] [Times:
>>> user=26.73 sys=0.01, real=26.72 secs]
>>> 2016-01-28T21:22:42.884-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 26.7488570 secs] [Times:
>>> user=26.75 sys=0.00, real=26.75 secs]
>>> 2016-01-28T21:23:09.635-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 26.7899470 secs] [Times:
>>> user=26.80 sys=0.00, real=26.79 secs]
>>> 2016-01-28T21:23:36.425-0500: [Full GC [PSY

RE: FW: Re: tomcat 6.0.41 heap size issue

2016-01-29 Thread Akbar Thanakalacheruvu
Take heap dump using jvisualvm and analyze the objects that stayed in the 
memory. You might get a rootcause to your problem. 
What is the total RAM of your machine? How much you allocated to Tomcat? 
Is any of your users running an application which requires huge amount of heap 
memory? Either tune that particular application or ask your users to try 
minimize/avoid usage of that application.

-Akbar
-Original Message-
From: Mark Thomas [mailto:ma...@apache.org] 
Sent: Friday, January 29, 2016 7:16 AM
To: Tomcat Users List 
Subject: Re: FW: Re: tomcat 6.0.41 heap size issue

On 29/01/2016 11:07, Guo, Denny wrote:
> Yes, we do have this option on for MaxPermSize, it is set to 512M.
> 
> If that is related to PermSize, should we get this message " 
> java.lang.OutOfMemoryError: PermGen space". However we never see this message 
> in the log.

Use a profiler. Find out what is using all that memory.

Mark


> 
> -Original Message-
> From: kidambi madhu [mailto:madhu.kida...@gmail.com]
> Sent: Thursday, January 28, 2016 11:43 PM
> To: Tomcat Users List
> Subject: Re: FW: Re: tomcat 6.0.41 heap size issue
> 
> Ok What's the size of the war file you have deployed to Tomcat?
> 
> I suspect the problem is with PermSize (The class loading part of JVM) than 
> Heap though the error points out Java Heap.
> 
> Pls set the PermSize with -XX:PermSize and -XX:MaxPermSize options and test.
> 
> Thanks,
> Madhu
> 
> On Fri, Jan 29, 2016 at 8:53 AM, Guo, Denny  wrote:
> 
>> Thanks for quick response. Here is the information.
>>
>> java version "1.6.0_45"
>> Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM) 
>> 64-Bit Server VM (build 20.45-b01, mixed mode)
>>
>>
>> -Original Message-
>> From: kidambi madhu [mailto:madhu.kida...@gmail.com]
>> Sent: Thursday, January 28, 2016 10:15 PM
>> To: Tomcat Users List
>> Subject: Re: FW: Re: tomcat 6.0.41 heap size issue
>>
>> Hi Denny,
>>
>> Which JDK you are using Oracle JDK/JRockit and which version.
>>
>> Some memory tuning options depend on JDK product used.
>>
>> Thanks,
>> Madhu
>>
>> On Fri, Jan 29, 2016 at 8:39 AM, Guo, Denny 
>> wrote:
>>
>>>
>>> Hi All,
>>>
>>> Looking for help on tomcat heap size issue.
>>>
>>> We are see below GC activity before tomcat reports the heap size error.
>>> Please see below message. However, we assign -Xmx=24G to the heap 
>>> size, why tomcat reports error even not reach 20G heap size usage ?
>>> Can someone please help. How the tomcat decides how much memory 
>>> allocate to young/old generation?
>>>
>>> We are running tomcat 6.0.41 on red hat linux as per our vendor.
>>>
>>> Thanks,
>>> Denny
>>>
>>> 2016-01-28T21:20:56.173-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222720K)], 26.7667120 secs] [Times:
>>> user=26.77 sys=0.01, real=26.76 secs]
>>> 2016-01-28T21:21:22.942-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222720K)], 26.5016220 secs] [Times:
>>> user=26.51 sys=0.01, real=26.50 secs]
>>> 2016-01-28T21:21:49.444-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 26.7081550 secs] [Times:
>>> user=26.70 sys=0.01, real=26.70 secs]
>>> 2016-01-28T21:22:16.154-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 26.7299520 secs] [Times:
>>> user=26.73 sys=0.01, real=26.72 secs]
>>> 2016-01-28T21:22:42.884-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 26.7488570 secs] [Times:
>>> user=26.75 sys=0.00, real=26.75 secs]
>>> 2016-01-28T21:23:09.635-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 26.7899470 secs] [Times:
>>> user=26.80 sys=0.00, real=26.79 secs]
>>> 2016-01-28T21:23:36.425-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777216K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 43.0072820 secs] [Times:
>>> user=43.01 sys=0.02, real=43.00 secs]
>>> 2016-01-28T21:24:19.435-0500: [Full GC [PSYoungGen: 761K->0K(2880K)]
>>> [PSOldGen: 16777216K->632811K(4342144K)]
>>> 16777977K->632811K(4345024K)
>>> [PSPermGen: 222628K->222628K(222912K)], 4.9992850 secs] [Times:
>>> user=4.96 sys=0.04, real=5.00 secs]
>>> 2016-01-28T21:24:19.435-0500: [Full GC [PSYoungGen: 761K->0K(2880K)]
>>> [PSOldGen: 16777216K->632811K(4342144K)]
>>> 16777977K->632811K(4345024K)
>>> [PSPermGen: 222628K->2

Re: HTTP communication

2016-01-29 Thread Olaf Kock
I'll second Andre's answer: Just because you declare a 10d timeout, you
can't rely on the connection to stay up for that long. You can't even
rely on a connection to stay up during the download of a simple gif
(although that's so quick that the odds for connection termination are a
lot lower).

This is without looking at the code - just relying on a connection to
stay up is not a proper assumption. You'll have to work around anything
in between to fail and reconnect if necessary. Declaring a 10d timeout -
if it works - will cause the appropriately configured endpoint to assume
it's open. It has no effect on any of the components in between the
endpoints.

Olaf

Am 29.01.2016 um 09:33 schrieb André Warnier (tomcat):
> On 28.01.2016 18:38, Maxim Neshcheret wrote:
>> I have a problem with my java application related to HTTP communication.
>>
>> Application description:
>>
>> 1.  Client – server. Server is running in servlet container. We
>> use Tomcat.
>>
>> Client use java HTTP library to communicate with the server.
>>
>> 2.  When client establish connection to the server it sends GET
>> request (keepalive) and server creates AsyncContext for the client
>> with 10 days timeout.
>>
>> 3.  After connection established server periodically sends data
>> to the client using AsyncContext and on the client side there is
>> special thread which reads and processes the data.
>>
> [ snip ...]
>>
>> Usually this code works fine but it there is no data from server to
>> client for 1 day and after 24 hours (can be 16 or 12) data appears,
>> server cannot send data to the client.
>> In the log there is no error. It is written that everything flushed
>> but client still waiting for data in “final String line =
>> reader.readLine();”
>> When 2nd portion of data is sent by the server, then during flush I
>> see the following error
>>
>> 2016-01-26 00:00:00,051|INFO |GWNotify-2/50   |ClientAbort
>> 2016-01-26 00:00:00,051|TRACE|GWNotify-2/50  
>> |ClientAbortException:java.io.IOException: APR error: -32
>> org.apache.catalina.connector.ClientAbortException:
>> java.io.IOException: APR error: -32
> [snip ...]
>
> Hi.
> I am unqualified to check your code, but a first question would be :
> where is the Client, and where is the Server and what is the
> connection between them like ?
>
> And the reason for the question is : it is not at all unusual, that
> any kind of network connection would be interrupted at some point over
> a 24-hour period, specially if nothing is sent over that connection
> for a long time.
> When a connection "disappears", TCP sends no signal to either the
> client or the server, and an error will only be caught, if one of the
> parties tries to write to the (now gone) connection (which seems to be
> what happens above, when the server tries to write to the Client, and
> gets a "client is no longer there" exception).
>
> If you want to avoid this, you will have to handle this in your code. 
> You cannot just expect the connection to be alive no matter what.
>
>
>
>
> -
> 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: HTTP communication

2016-01-29 Thread Christoph Nenning
> I have a problem with my java application related to HTTP communication.
> 
> Application description:
> 
> 1.  Client – server. Server is running in servlet container. We 
> use Tomcat.
> 
> Client use java HTTP library to communicate with the server.
> 
> 2.  When client establish connection to the server it sends GET 
> request (keepalive) and server creates AsyncContext for the client 
> with 10 days timeout.
> 
> 3.  After connection established server periodically sends data 
> to the client using AsyncContext and on the client side there is 
> special thread which reads and processes the data.
> 
> Client reading thread example:
> 
> private class GetRunnable implements Runnable {
> 
>private final HttpURLConnection httpConn;
>private final MyConnection myConn;
> 
>public GetRunnable(final MyConnection myConn) throws 
> IOException, AppException {
>  this.myConn = myConn;
>  final String jSession = myConn.getJSession();
>  httpConn = openHttpUrlConnection(false, 
> httpPostTimeout, jSession);
>  httpConn.connect();
>  final int respCode = httpConn.getResponseCode();
>  if (respCode != HttpURLConnection.HTTP_OK) {
> String info = "Incorrect response from server, 
> responseCode:" + respCode + ", message:" + 
httpConn.getResponseMessage();
> log.error(info);
> throw new AppException(info);
>  } else {
> log.trace("GET connected");
>  }
>}
> 
>@Override
>public void run() {
>  try (final BufferedReader reader = new BufferedReader
> (new InputStreamReader(httpConn.getInputStream(), "UTF-8")) ) {
> log.info("doGet STARTED");
> final Thread t = Thread.currentThread();
> while (!t.isInterrupted()) {
>log.trace("before readline");
>final String line = reader.readLine();
>log.trace("after readline: [" + line + "]");
> 
>//INFO: DATA PROCESSING HERE
> }
>  } catch (IOException e) {
> log.error("Error while doGet");
>  } catch (Throwable e) {
> log.debug("doGet STOPED...");
> log.error("Error while read input msg, do logoff", 
e);
> logoff();
> throw e;
>  }
>  log.debug("doGet STOPED...");
>  myCallback.onGetClose(myConn, connInfo);
>}
> }
> 
> Server side code to push data looks like this:
> 
> protected int sendMsgs(final MyConnection myConn, final String info) {
> 
>int res;
>try {
>  final AsyncContext lAc = _ac;
>  final ServletRequest req = lAc.getRequest();
>  if (!req.isAsyncStarted()) {
> log.debug("AsyncStarted=false on begin, uid:" + 
> uid + ", sid:" + sid);
> return -1;
>  }
> 
>  final ServletResponse res = lAc.getResponse();
>  ServletOutputStream  os = null;
>  final String text = getData(myConn);
> 
>  if (os == null)
> os = res.getOutputStream();
> 
>  write2stream(os, text, 0x4000);
>  os.println();
> 
>  if (os != null)
> os.flush();
> } catch(IOException ex) {
>  log.error("Notify failed");
> } catch (InterruptedException e) {
>  log.error("Notify failed");
>  Thread.currentThread().interrupt();
>  } catch (Throwable e) {
> log.error("Notify failed");
> logoff(true);
>  }
> 
> return res;
> }
> 
> public static void write2stream(final OutputStream outputStream, 
> final String text, int bufferSize) throws IOException {
>  final CharsetEncoder encoder = getHttpEncodingCharset
> ().newEncoder();
> 
>  final int fullLen = text.length();
>  final int byteBufferSize = Math.min(bufferSize, fullLen);
> 
>  final int en = (int)(byteBufferSize * (double)
> encoder.maxBytesPerChar());
>  final byte[] byteArray = new byte[en];
> 
>   final ByteBuffer byteBuffer = ByteBuffer.wrap(byteArray);
>   final CharBuffer charBuffer = CharBuffer.wrap(text);
>  for(int pos=0, len=byteBufferSize;
>pos < fullLen;
>pos=len, len=Math.min(pos+byteBufferSize,
> fullLen)) {
> 
>   try {
> final CharBuffer window = charBuffer.subSequence(pos, 
len);
> 
>CoderResult res = encoder.encode(window, 
> byteBuffer, true);
> 
> if (!res.isUnderflow())
>   

Re: FW: Re: tomcat 6.0.41 heap size issue

2016-01-29 Thread Mark Thomas
On 29/01/2016 11:07, Guo, Denny wrote:
> Yes, we do have this option on for MaxPermSize, it is set to 512M.
> 
> If that is related to PermSize, should we get this message " 
> java.lang.OutOfMemoryError: PermGen space". However we never see this message 
> in the log.

Use a profiler. Find out what is using all that memory.

Mark


> 
> -Original Message-
> From: kidambi madhu [mailto:madhu.kida...@gmail.com]
> Sent: Thursday, January 28, 2016 11:43 PM
> To: Tomcat Users List
> Subject: Re: FW: Re: tomcat 6.0.41 heap size issue
> 
> Ok What's the size of the war file you have deployed to Tomcat?
> 
> I suspect the problem is with PermSize (The class loading part of JVM) than 
> Heap though the error points out Java Heap.
> 
> Pls set the PermSize with -XX:PermSize and -XX:MaxPermSize options and test.
> 
> Thanks,
> Madhu
> 
> On Fri, Jan 29, 2016 at 8:53 AM, Guo, Denny  wrote:
> 
>> Thanks for quick response. Here is the information.
>>
>> java version "1.6.0_45"
>> Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM)
>> 64-Bit Server VM (build 20.45-b01, mixed mode)
>>
>>
>> -Original Message-
>> From: kidambi madhu [mailto:madhu.kida...@gmail.com]
>> Sent: Thursday, January 28, 2016 10:15 PM
>> To: Tomcat Users List
>> Subject: Re: FW: Re: tomcat 6.0.41 heap size issue
>>
>> Hi Denny,
>>
>> Which JDK you are using Oracle JDK/JRockit and which version.
>>
>> Some memory tuning options depend on JDK product used.
>>
>> Thanks,
>> Madhu
>>
>> On Fri, Jan 29, 2016 at 8:39 AM, Guo, Denny 
>> wrote:
>>
>>>
>>> Hi All,
>>>
>>> Looking for help on tomcat heap size issue.
>>>
>>> We are see below GC activity before tomcat reports the heap size error.
>>> Please see below message. However, we assign -Xmx=24G to the heap
>>> size, why tomcat reports error even not reach 20G heap size usage ?
>>> Can someone please help. How the tomcat decides how much memory
>>> allocate to young/old generation?
>>>
>>> We are running tomcat 6.0.41 on red hat linux as per our vendor.
>>>
>>> Thanks,
>>> Denny
>>>
>>> 2016-01-28T21:20:56.173-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222720K)], 26.7667120 secs] [Times:
>>> user=26.77 sys=0.01, real=26.76 secs]
>>> 2016-01-28T21:21:22.942-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222720K)], 26.5016220 secs] [Times:
>>> user=26.51 sys=0.01, real=26.50 secs]
>>> 2016-01-28T21:21:49.444-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 26.7081550 secs] [Times:
>>> user=26.70 sys=0.01, real=26.70 secs]
>>> 2016-01-28T21:22:16.154-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 26.7299520 secs] [Times:
>>> user=26.73 sys=0.01, real=26.72 secs]
>>> 2016-01-28T21:22:42.884-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 26.7488570 secs] [Times:
>>> user=26.75 sys=0.00, real=26.75 secs]
>>> 2016-01-28T21:23:09.635-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777215K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 26.7899470 secs] [Times:
>>> user=26.80 sys=0.00, real=26.79 secs]
>>> 2016-01-28T21:23:36.425-0500: [Full GC [PSYoungGen:
>>> 761K->761K(2880K)]
>>> [PSOldGen: 16777215K->16777216K(16777216K)]
>>> 16777977K->16777977K(16780096K)
>>> [PSPermGen: 222628K-222628K(222912K)], 43.0072820 secs] [Times:
>>> user=43.01 sys=0.02, real=43.00 secs]
>>> 2016-01-28T21:24:19.435-0500: [Full GC [PSYoungGen: 761K->0K(2880K)]
>>> [PSOldGen: 16777216K->632811K(4342144K)]
>>> 16777977K->632811K(4345024K)
>>> [PSPermGen: 222628K->222628K(222912K)], 4.9992850 secs] [Times:
>>> user=4.96 sys=0.04, real=5.00 secs]
>>> 2016-01-28T21:24:19.435-0500: [Full GC [PSYoungGen: 761K->0K(2880K)]
>>> [PSOldGen: 16777216K->632811K(4342144K)]
>>> 16777977K->632811K(4345024K)
>>> [PSPermGen: 222628K->222628K(222912K)], 4.9992850 secs] [Times:
>>> user=4.96 sys=0.04, real=5.00 secs] Exception in thread "Low Memory
>>> Detector" java.lang.OutOfMemoryError: Java heap space
>>> 2016-01-28T21:24:24.438-0500: [GC [PSYoungGen: 128K->224K(8960K)]
>>> 632939K->633035K(4351104K), 0.0045990 secs] [Times: user=0.02
>>> 632939K->sys=0.00,
>>> real=0.01 secs]
>>> 2016-01-28T21:24:24.444-0500: [GC [PSYoungGen: 288K->192K(9088K)]
>>> 633099K->633003K(4351232K), 0.0032440 secs] [Times: user=0.02
>>> 633099K->sys=0.00,
>>> real=0.00 secs]
>>> 2016-01-28T21:24:24.449-0500: [GC [PSYoungGen: 254K->160K(92

RE: FW: Re: tomcat 6.0.41 heap size issue

2016-01-29 Thread Guo, Denny
Yes, we do have this option on for MaxPermSize, it is set to 512M.

If that is related to PermSize, should we get this message " 
java.lang.OutOfMemoryError: PermGen space". However we never see this message 
in the log.

-Original Message-
From: kidambi madhu [mailto:madhu.kida...@gmail.com]
Sent: Thursday, January 28, 2016 11:43 PM
To: Tomcat Users List
Subject: Re: FW: Re: tomcat 6.0.41 heap size issue

Ok What's the size of the war file you have deployed to Tomcat?

I suspect the problem is with PermSize (The class loading part of JVM) than 
Heap though the error points out Java Heap.

Pls set the PermSize with -XX:PermSize and -XX:MaxPermSize options and test.

Thanks,
Madhu

On Fri, Jan 29, 2016 at 8:53 AM, Guo, Denny  wrote:

> Thanks for quick response. Here is the information.
>
> java version "1.6.0_45"
> Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM)
> 64-Bit Server VM (build 20.45-b01, mixed mode)
>
>
> -Original Message-
> From: kidambi madhu [mailto:madhu.kida...@gmail.com]
> Sent: Thursday, January 28, 2016 10:15 PM
> To: Tomcat Users List
> Subject: Re: FW: Re: tomcat 6.0.41 heap size issue
>
> Hi Denny,
>
> Which JDK you are using Oracle JDK/JRockit and which version.
>
> Some memory tuning options depend on JDK product used.
>
> Thanks,
> Madhu
>
> On Fri, Jan 29, 2016 at 8:39 AM, Guo, Denny 
> wrote:
>
> >
> > Hi All,
> >
> > Looking for help on tomcat heap size issue.
> >
> > We are see below GC activity before tomcat reports the heap size error.
> > Please see below message. However, we assign -Xmx=24G to the heap
> > size, why tomcat reports error even not reach 20G heap size usage ?
> > Can someone please help. How the tomcat decides how much memory
> > allocate to young/old generation?
> >
> > We are running tomcat 6.0.41 on red hat linux as per our vendor.
> >
> > Thanks,
> > Denny
> >
> > 2016-01-28T21:20:56.173-0500: [Full GC [PSYoungGen:
> > 761K->761K(2880K)]
> > [PSOldGen: 16777215K->16777215K(16777216K)]
> > 16777977K->16777977K(16780096K)
> > [PSPermGen: 222628K-222628K(222720K)], 26.7667120 secs] [Times:
> > user=26.77 sys=0.01, real=26.76 secs]
> > 2016-01-28T21:21:22.942-0500: [Full GC [PSYoungGen:
> > 761K->761K(2880K)]
> > [PSOldGen: 16777215K->16777215K(16777216K)]
> > 16777977K->16777977K(16780096K)
> > [PSPermGen: 222628K-222628K(222720K)], 26.5016220 secs] [Times:
> > user=26.51 sys=0.01, real=26.50 secs]
> > 2016-01-28T21:21:49.444-0500: [Full GC [PSYoungGen:
> > 761K->761K(2880K)]
> > [PSOldGen: 16777215K->16777215K(16777216K)]
> > 16777977K->16777977K(16780096K)
> > [PSPermGen: 222628K-222628K(222912K)], 26.7081550 secs] [Times:
> > user=26.70 sys=0.01, real=26.70 secs]
> > 2016-01-28T21:22:16.154-0500: [Full GC [PSYoungGen:
> > 761K->761K(2880K)]
> > [PSOldGen: 16777215K->16777215K(16777216K)]
> > 16777977K->16777977K(16780096K)
> > [PSPermGen: 222628K-222628K(222912K)], 26.7299520 secs] [Times:
> > user=26.73 sys=0.01, real=26.72 secs]
> > 2016-01-28T21:22:42.884-0500: [Full GC [PSYoungGen:
> > 761K->761K(2880K)]
> > [PSOldGen: 16777215K->16777215K(16777216K)]
> > 16777977K->16777977K(16780096K)
> > [PSPermGen: 222628K-222628K(222912K)], 26.7488570 secs] [Times:
> > user=26.75 sys=0.00, real=26.75 secs]
> > 2016-01-28T21:23:09.635-0500: [Full GC [PSYoungGen:
> > 761K->761K(2880K)]
> > [PSOldGen: 16777215K->16777215K(16777216K)]
> > 16777977K->16777977K(16780096K)
> > [PSPermGen: 222628K-222628K(222912K)], 26.7899470 secs] [Times:
> > user=26.80 sys=0.00, real=26.79 secs]
> > 2016-01-28T21:23:36.425-0500: [Full GC [PSYoungGen:
> > 761K->761K(2880K)]
> > [PSOldGen: 16777215K->16777216K(16777216K)]
> > 16777977K->16777977K(16780096K)
> > [PSPermGen: 222628K-222628K(222912K)], 43.0072820 secs] [Times:
> > user=43.01 sys=0.02, real=43.00 secs]
> > 2016-01-28T21:24:19.435-0500: [Full GC [PSYoungGen: 761K->0K(2880K)]
> > [PSOldGen: 16777216K->632811K(4342144K)]
> > 16777977K->632811K(4345024K)
> > [PSPermGen: 222628K->222628K(222912K)], 4.9992850 secs] [Times:
> > user=4.96 sys=0.04, real=5.00 secs]
> > 2016-01-28T21:24:19.435-0500: [Full GC [PSYoungGen: 761K->0K(2880K)]
> > [PSOldGen: 16777216K->632811K(4342144K)]
> > 16777977K->632811K(4345024K)
> > [PSPermGen: 222628K->222628K(222912K)], 4.9992850 secs] [Times:
> > user=4.96 sys=0.04, real=5.00 secs] Exception in thread "Low Memory
> > Detector" java.lang.OutOfMemoryError: Java heap space
> > 2016-01-28T21:24:24.438-0500: [GC [PSYoungGen: 128K->224K(8960K)]
> > 632939K->633035K(4351104K), 0.0045990 secs] [Times: user=0.02
> > 632939K->sys=0.00,
> > real=0.01 secs]
> > 2016-01-28T21:24:24.444-0500: [GC [PSYoungGen: 288K->192K(9088K)]
> > 633099K->633003K(4351232K), 0.0032440 secs] [Times: user=0.02
> > 633099K->sys=0.00,
> > real=0.00 secs]
> > 2016-01-28T21:24:24.449-0500: [GC [PSYoungGen: 254K->160K(9280K)]
> > 633098K->633003K(4351424K), 0.0032180 secs] [Times: user=0.02
> > 633098K->sys=0.00,
> > real=0.01 secs]
> > Jan 28, 2016 9:24:24 PM
> > org.apache.catalina.core.Conta

Re: HTTP communication

2016-01-29 Thread tomcat

On 28.01.2016 18:38, Maxim Neshcheret wrote:

I have a problem with my java application related to HTTP communication.

Application description:

1.  Client – server. Server is running in servlet container. We use Tomcat.

Client use java HTTP library to communicate with the server.

2.  When client establish connection to the server it sends GET request 
(keepalive) and server creates AsyncContext for the client with 10 days timeout.

3.  After connection established server periodically sends data to the 
client using AsyncContext and on the client side there is special thread which 
reads and processes the data.


[ snip ...]


Usually this code works fine but it there is no data from server to client for 
1 day and after 24 hours (can be 16 or 12) data appears, server cannot send 
data to the client.
In the log there is no error. It is written that everything flushed but client 
still waiting for data in “final String line = reader.readLine();”
When 2nd portion of data is sent by the server, then during flush I see the 
following error

2016-01-26 00:00:00,051|INFO |GWNotify-2/50   |ClientAbort
2016-01-26 00:00:00,051|TRACE|GWNotify-2/50   
|ClientAbortException:java.io.IOException: APR error: -32
org.apache.catalina.connector.ClientAbortException: java.io.IOException: APR 
error: -32

[snip ...]

Hi.
I am unqualified to check your code, but a first question would be : where is the Client, 
and where is the Server and what is the connection between them like ?


And the reason for the question is : it is not at all unusual, that any kind of network 
connection would be interrupted at some point over a 24-hour period, specially if nothing 
is sent over that connection for a long time.
When a connection "disappears", TCP sends no signal to either the client or the server, 
and an error will only be caught, if one of the parties tries to write to the (now gone) 
connection (which seems to be what happens above, when the server tries to write to the 
Client, and gets a "client is no longer there" exception).


If you want to avoid this, you will have to handle this in your code.  You cannot just 
expect the connection to be alive no matter what.





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