Re: how to tune cacheMaxSize

2021-08-17 Thread Michael Richardson

Christopher Schultz  wrote:
> Not at all. EC2 is entirely reasonable for such purposes. Amazon will
> even grant you a signed BAA if you ask for one.

Canada is not the US, and OHIP has rules differently than others.
And the clinic would like to survive having our third-world telco go down.

>> No, I'm not building myself.  There is an oscar.deb, which btw,
>> results in the same 100%.

> Okay, good. Does OSCAR distribute the .deb file? I'm ... weirdly
> surprised by that.

OSCAR has a .deb that tries to be all singing, all dancing.
It's not the only solution.

>> It also does other stuff like configure mariadb locally (which I don't
>> want).

> Interesting. You want control over your own database, or you don't want
> the db to be local (e.g. you want a remote db)?

Exactly.

>> This is the only time I've seen this error, I've also used the manager
>> web application before.

> Hmm. Same error there? Or same 100% CPU circumstances there?

Same 100% CPU.

>> I tried that.  It says something about there being no socket open.  My
>> impression is that "jstack" was an Oracle Java only tool.

> Nope, it's in all of the OpenJDK builds. You might need a "JDK" instead
> of a"JRE".

okay, I'll try again and post the result.

> When you issue "kill -3", the thread dump should appear on stdout,
> which should be captured in logs/catalina.[date].log. If that's not
> happening, then I'm a bit confused...

It's not happening.

> Okay, try this:

> 1. Stop Tomcat, clear all logs, delete your oscar.war file and the
> exploded directory in CATALINA_BASE/webapps/oscar (or wherever your
> appBase points to).  2. Copy your oscar.war file into appBase, making
> sure that operation completes 3. Start Tomcat, but like this instead of
> what you usually do:

>$ sudo -iu tomcatuser $ $CATALINA_BASE/bin/catalina.sh run

> That "run" is important: it will run Tomcat in the current console
> instead of in the background as a service. You'll get stdout directly
> on your console, no log files to worry about.

okay.

--
]   Never tell me the odds! | ipv6 mesh networks [
]   Michael Richardson, Sandelman Software Works|IoT architect   [
] m...@sandelman.ca  http://www.sandelman.ca/|   ruby on rails[



signature.asc
Description: PGP signature


Re: Tomcat "JNDI Datasource How-To" documentation & driver managers

2021-08-17 Thread Andrew Tanton
Thank you - very helpful & much appreciated.

On Sat, Aug 14, 2021 at 4:24 PM Mark Thomas  wrote:

> On 14/08/2021 01:51, Andrew Tanton wrote:
> > In the Tomcat "JNDI Datasource How-To" documentation page
> > <
> http://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#comments_section
> >,
> > there is an unusually opinionated section, which discusses the Java
> service
> > provider (driver manager) mechanism:
>
> I suspect that was me after spending quite a but of time unpicking
> various issues associated with DriverManager where Tomcat was getting
> blamed. Goes to check the history...
>
> Yep. Here is the bug report:
> https://bz.apache.org/bugzilla/show_bug.cgi?id=52025
> which triggered this doc update:
> https://svn.apache.org/viewvc?view=revision=1184919
>
> > "*However, the implementation is fundamentally broken in all Java
> versions
> > for a servlet container environment. The problem is
> > that java.sql.DriverManager will scan for the drivers only once.*"
> >
> > Can someone help me understand what this means in more practical terms?
>
> This will be a lot simpler to explain with the source code to hand:
>
> https://github.com/openjdk/jdk/blob/master/src/java.sql/share/classes/java/sql/DriverManager.java
>
> > The page goes on to say:
> >
> > "*...web applications that have database drivers in
> > their WEB-INF/lib directory cannot rely on the service provider mechanism
> > and should register the drivers explicitly.*"
> >
> > And, indeed, I have found that placing my JDBC driver in Tomcat's
> > $CATALINA_HOME/lib
> > or $CATALINA_BASE/lib will be loaded correctly, without explicit
> > registration.
> >
> > MY QUESTIONS:
> >
> > (1) I don't understand why the "scan only once" limitation results in
> this
> > behavior - so what am I missing, here, conceptually?
>
> There are several inter-related elements.
>
> Scan once caused problems as if two web apps both have JDBC drivers then
> the DriverManager scan will only load the Driver for the app that
> triggers the scan first.
>
> An added complication is that the memory leak protection code
> essentially ensures that the scan is performed by Tomcat internal code
> so no JDBC drivers in WEB-INF/lib for any wweb application are seen by
> the scan. Hence, the JDBC drivers need to be in CATALINA_BASE/lib.
>   > (2) Where is this "scan only once" behavior documented?
>
> It is sort of implied in the DriverManager Javadoc but you need to read
> the source code to get a clear picture.
>
> > (3) What is it about a servlet container environment which allows this
> > problem to exist?
>
> Dynamic loading and unloading of web applications and use of a dedicated
> class loader per web application.
>
> You can also get various memory leaks associated with DriverManager as
> well (which Tomcat automatically protects you against).
>
> Mark
>
>
> >
> > Thank you.
> >
> > For reference, here is the documentation link I used above:
> >
> >
> >
> http://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html
> >
> > (The wording in the documentation has been this way for several Tomcat
> > versions, going back a few years.)
> >
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: how to tune cacheMaxSize

2021-08-17 Thread Christopher Schultz

Michael,

On 8/16/21 16:14, Michael Richardson wrote:


Christopher Schultz  wrote:
 > Okay, all that looks fine to me, except the "9.0.16" part. That version
 > is *very/8 old. I see you are running Ubuntu: are you running the
 > latest release? That 9.0.16 number if rinning a bell about an older
 > release which was capped at 9.0.16. YOu might want to consider
 > upgrading everything once you figure all of this out. No need to muddy
 > the waters quite, yet, though.

Ubuntu 18.04.  I shall look for a ppa with newer tomcat.
It's a VM, I could go to Core 20.


Okay. We can get to that, later, but it's probably a good idea since 
it's probably nearing EOL. (I didn't bother checking.)



 > A few more things:

 > 1. It takes 12 seconds to initialize the server? That seems
 > ... slow. Is this on Amazon? What instance type? The memory size
 > 3.75GiB is ringing a bell, too.

I could go to 8G for the VM if you think that's relevant.
My reading is that I'm not even using 1G of ram at this point.


Nah, it's not important. But if it were an EC2 VM it's entirely possible 
that you are simply asking too much of it and the slowness/100% CPU is 
just "it's trying to do too much work."



No, it's not in Amazon.  It's a Dell Xeon workstation in the basement of my
wife's clinic.  Patient record confidentiality would probably contraindicate 
EC2 :-)


Not at all. EC2 is entirely reasonable for such purposes. Amazon will 
even grant you a signed BAA if you ask for one.



 > 2. You shouldn't have the "docs"
 > project depployed on a production system.

I installed it there to grep/read them, then decided that I'd install
that on my desktop.
Okay, no problem. As long as you know what you are doing. Often, seeing 
the "docs" application deployed means (somewhat ironically) "someone 
didn't read the documentation for going to production."



 > 3. I don't see any message
 > "Deploying deployment descriptor blah/blah/oscar/blah"

Yes, exactly.


Hmm.


Christopher Schultz  wrote:
 >> 14-Aug-2021 17:16:45.464 SEVERE [Catalina-utility-1]
 >> org.apache.catalina.startup.HostConfig.deployWAR Error deploying web
 >> application archive [/var/lib/tomcat9/webapps/oscar.war]
 >> java.lang.IllegalStateException: Error starting child at
 >> 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:716)
 >> ...
 >>

 > That certainly looks bad. Are you building OSCAR yourself, or is it
 > pre-built? I'm assuming that all local customizations are done using
 > separate config files or in the database, right? Can you get a fresh
 > copy of the oscar.war file?

No, I'm not building myself.
There is an oscar.deb, which btw, results in the same 100%.


Okay, good. Does OSCAR distribute the .deb file? I'm ... weirdly 
surprised by that.



It also does other stuff like configure mariadb locally (which I don't want).


Interesting. You want control over your own database, or you don't want 
the db to be local (e.g. you want a remote db)?



But, I've used the oscar.war from that deb, and also the oscar.war which
is on the bare-metal version that is running.


Okay.


 >> 14-Aug-2021 17:16:45.506 INFO [Catalina-utility-1]
 >> org.apache.catalina.startup.HostConfig.deployWAR Deployment of web
 >> application archive [/var/lib/tomcat9/webapps/oscar.war] has finished
 >> in [1,684] ms

 > That's nice and fast.

No, it's in error.


:) I was mostly joking.


 >> 14-Aug-2021 17:16:55.661 INFO [Catalina-utility-2]
 >> org.apache.catalina.startup.HostConfig.undeploy Undeploying context
 >> [/oscar] 14-Aug-2021 17:16:58.286 INFO [Catalina-utility-2]
 >> org.apache.catalina.startup.HostConfig.deployWAR Deploying web
 >> application archive [/var/lib/tomcat9/webapps/oscar.war]

 > Strange that it's deploying, then undeploying, then deploying again. Is
 > it possible that there are weird file timestamps? Maybe something in
 > the future?

I think that the cp of the 220M oscar.war hasn't completed when it starts
that first deploy.  That's why the ZIP error.

 >> My guess is that the cp oscar.war /var/lib/tomcat9/webapps hadn't
 >> actually finished yet when it tried to deploy it.

 > That can definitely break things. If you are going to drop a WAR file
 > on Tomcat, make sure that either Tomcat isn't running, or you are using
 > the Manager web application to upload-and-deploy the WAR file which
 > protects you from deploying mid-copy.

This is the only time I've seen this error, I've also used the manager web
application before.


Hmm. Same error there? Or same 100% CPU circumstances there?


 >> So the port is open, so I attempt to visit the /manage URL
 >>
 >> oscar-serv03-[~] root 31 #netstat -tan Active Internet connections
 >> (servers and established) Proto Recv-Q Send-Q Local Address Foreign
 >> Address State tcp 0 0 127.0.0.53:53 

Re: Tomcat 9.0.52 crashes with "java.util.zip.ZipException: invalid LOC header (bad signature)" when started in debug mode - any work-around?

2021-08-17 Thread Maxim Solodovnik
I would 'rm -rf ~/.m2/repository/*'
Much faster than investigating :)

from mobile (sorry for typos ;)


On Tue, Aug 17, 2021, 18:16  wrote:

> When trying to start Tomcat (9.0.52) in debug mode ("Debug on Server") from
> Eclipse (v2020-12 (4.18.0) / Build id: 20201210-1552) I get the following
> error:
>
> 16-Aug-2021 13:52:14.019 SEVERE [main]
> org.apache.catalina.core.ContainerBase.startInternal A child container
> failed during start
>
> java.util.concurrent.ExecutionException:
> org.apache.catalina.LifecycleException: Failed to initialize component
> [org.apache.catalina.webresources.JarResourceSet@61322f9d]
>
> at java.util.concurrent.FutureTask.report(FutureTask.java:122)
>
> ...
>
> Caused by: org.apache.catalina.LifecycleException: Failed to initialize
> component [org.apache.catalina.webresources.JarResourceSet@61322f9d]
>
> at
>
> org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase
> .java:440)
>
> ...
>
> Caused by: java.lang.IllegalArgumentException:
> java.util.zip.ZipException: invalid LOC header (bad signature)
>
> at
>
> org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initIntern
> al(AbstractSingleArchiveResourceSet.java:143)
>
> at
> org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
>
> ... 33 more
>
> Caused by: java.util.zip.ZipException: invalid LOC header (bad
> signature)
>
> at java.util.zip.ZipFile.read(Native Method)
>
> ...
>
> Caused by: java.lang.IllegalArgumentException:
> java.util.zip.ZipException: invalid LOC header (bad signature)
>
> at
>
> org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initIntern
> al(AbstractSingleArchiveResourceSet.java:143)
>
> at
> org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
>
> ... 33 more
>
> Caused by: java.util.zip.ZipException: invalid LOC header (bad
> signature)
>
>
>
>
>
> Any idea how to identify what .jar file is causing this and/or how to
> possibly work around this?
>
>
>
> I added more details on StackOverflow
>
> https://stackoverflow.com/questions/68803170/tomcat-crashes-with-java-util-z
> ip-zipexception-invalid-loc-header-bad-signatu
> ,
> so I don't want to spam the
> mailing list with them here.
>
>
>
> Regards,
>
> Michael
>
>
>
>


Tomcat 9.0.52 crashes with "java.util.zip.ZipException: invalid LOC header (bad signature)" when started in debug mode - any work-around?

2021-08-17 Thread michael.moser
When trying to start Tomcat (9.0.52) in debug mode ("Debug on Server") from
Eclipse (v2020-12 (4.18.0) / Build id: 20201210-1552) I get the following
error:

16-Aug-2021 13:52:14.019 SEVERE [main]
org.apache.catalina.core.ContainerBase.startInternal A child container
failed during start

java.util.concurrent.ExecutionException:
org.apache.catalina.LifecycleException: Failed to initialize component
[org.apache.catalina.webresources.JarResourceSet@61322f9d]

at java.util.concurrent.FutureTask.report(FutureTask.java:122)

...

Caused by: org.apache.catalina.LifecycleException: Failed to initialize
component [org.apache.catalina.webresources.JarResourceSet@61322f9d]

at
org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase
.java:440)

...

Caused by: java.lang.IllegalArgumentException:
java.util.zip.ZipException: invalid LOC header (bad signature)

at
org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initIntern
al(AbstractSingleArchiveResourceSet.java:143)

at
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)

... 33 more

Caused by: java.util.zip.ZipException: invalid LOC header (bad
signature)

at java.util.zip.ZipFile.read(Native Method)

...

Caused by: java.lang.IllegalArgumentException:
java.util.zip.ZipException: invalid LOC header (bad signature)

at
org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initIntern
al(AbstractSingleArchiveResourceSet.java:143)

at
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)

... 33 more

Caused by: java.util.zip.ZipException: invalid LOC header (bad
signature)

 

 

Any idea how to identify what .jar file is causing this and/or how to
possibly work around this?

 

I added more details on StackOverflow
https://stackoverflow.com/questions/68803170/tomcat-crashes-with-java-util-z
ip-zipexception-invalid-loc-header-bad-signatu, so I don't want to spam the
mailing list with them here.

 

Regards,

Michael

 



[ANN] Apache Tomcat 8.5.70 available

2021-08-17 Thread Mark Thomas

The Apache Tomcat team announces the immediate availability of Apache
Tomcat 8.5.70.

Apache Tomcat 8 is an open source software implementation of the Java
Servlet, JavaServer Pages, Java Unified Expression Language, Java
WebSocket and Java Authentication Service Provider Interface for
Containers technologies.

Apache Tomcat 8.5.70 is a bugfix and feature release. The notable 
changes compared to 8.5.69 include:


- Correct a regression in the previous release in the HTTP/2 flow
  control window management along with additional improvements to HTTP/2
  flow control

- Make the CorsFilter simpler to extend

- To avoid unnecessary cache revalidation, do not add an HTTP Expires
  header when setting adding an HTTP header of CacheControl: private

Along with lots of other bug fixes and improvements.

Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/tomcat-8.5-doc/changelog.html

Downloads:
http://tomcat.apache.org/download-80.cgi

Migration guides from Apache Tomcat 7.x and 8.0.x:
http://tomcat.apache.org/migration.html

Enjoy!

- The Apache Tomcat team

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