[ANN] Apache Tomcat 8.5.75 available

2022-02-28 Thread Christopher Schultz

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

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.76 is a bugfix and feature release. The notable 
changes compared to 8.5.75 include:


- Correct a regression in the fix for 65454 that meant that
   minSpareThreads and maxThreads settings were ignored when the
   Connector used an internal executor

- Improve the detection of the Linux duplicate accept bug and reduce
   (hopefully avoid) instances of false positives.

- Back-port fixes for BZ 65408 to refactor socket-close operations
  to improve resilience when objects are re-used by applications.

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



Re: Tomcat 9 Class Loader conflicts

2022-02-28 Thread Christopher Schultz

Ricardo,

On 2/28/22 15:32, Ricardo Osorio wrote:

Hi,
I have Tomcat 9.0.53 and i deployed a war file APP.war with 2 differents
libs

- app/WEB-INF/lib/javax.mail-1.6.0.jar
- app/WEB-INF/lib/mail-1.4.jar

QA environment hardware properties:
Mem:   6809
Architecture:x86_64
CPU op-mode(s):32-bit, 64-bit
CPU(s):   2
Model name:   Intel(R) Xeon(R) CPU E7-4850 v4 @ 2.10GHz

Production environment hardware properties:
Mem:   25960
Architecture:x86_64
CPU op-mode(s):32-bit, 64-bit
CPU(s):   13
Model name:   Intel(R) Xeon(R) CPU E7-4890 v2 @ 2.80GHz


In my QA env tomcat class loaders use javax.mail-1.6.0.jar for method
javax.mail.Authenticator
[23.922s][info][class,load] javax.mail.Authenticator source:
file:/tomcat-9.0.54/webapps/app/WEB-INF/lib/javax.mail-1.6.0.jar

but in my Prod env tomcat use mail-1.4.jar for same method
[12.306s][info][class,load] javax.mail.Authenticator source:
file:/tomcat-9.0.54/webapps/app/WEB-INF/lib/mail-1.4.jar

Do you know why Tomcat class loader use different libs in two different
environments?
Do you have best practices to force tomcat to always use the latest libs in
different environments?


The libraries are not loaded in any particular order. The difference you 
are seeing is the order that the filesystem is returning the files when 
a directory-scan is being done. It's totally arbitrary and unpredictable 
unless you understand how the filesystem organizes files. It can even 
change due to other factors than just e.g. updating a file or changing 
its timestamp.


Please see https://bz.apache.org/bugzilla/show_bug.cgi?id=57129 for lots 
more information.


-chris

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



Tomcat 9 Class Loader conflicts

2022-02-28 Thread Ricardo Osorio
Hi,
I have Tomcat 9.0.53 and i deployed a war file APP.war with 2 differents
libs

   - app/WEB-INF/lib/javax.mail-1.6.0.jar
   - app/WEB-INF/lib/mail-1.4.jar

QA environment hardware properties:
Mem:   6809
Architecture:x86_64
CPU op-mode(s):32-bit, 64-bit
CPU(s):   2
Model name:   Intel(R) Xeon(R) CPU E7-4850 v4 @ 2.10GHz

Production environment hardware properties:
Mem:   25960
Architecture:x86_64
CPU op-mode(s):32-bit, 64-bit
CPU(s):   13
Model name:   Intel(R) Xeon(R) CPU E7-4890 v2 @ 2.80GHz


In my QA env tomcat class loaders use javax.mail-1.6.0.jar for method
javax.mail.Authenticator
[23.922s][info][class,load] javax.mail.Authenticator source:
file:/tomcat-9.0.54/webapps/app/WEB-INF/lib/javax.mail-1.6.0.jar

but in my Prod env tomcat use mail-1.4.jar for same method
[12.306s][info][class,load] javax.mail.Authenticator source:
file:/tomcat-9.0.54/webapps/app/WEB-INF/lib/mail-1.4.jar

Do you know why Tomcat class loader use different libs in two different
environments?
Do you have best practices to force tomcat to always use the latest libs in
different environments?

Thanks & Regards
Ricardo


Re: Re: Tomcat 8.5.75 Servlet WriteListener and ReadListener setting thread

2022-02-28 Thread Rémy Maucherat
On Mon, Feb 28, 2022 at 4:39 PM Istvan SZEKELY
 wrote:
>
> I've written a NonBlocking ReadWrite test (testDelayedNBReadWrite, in the 
> attached file). I'm not sure if it is a valid test case (though works on 
> 8.5.73, fails on 8.5.75). If it is valid, i can make a PR if needed.

Thanks for the test, this is what I had in mind. As I kind of expected
when reading about the sequential technique used, the previous fix was
causing a new problem since the thread id was not reset until the full
recycle, making the new check inaccurate as well in another scenario.
https://github.com/apache/tomcat/commit/2739565fa5286623e8bb31823770595de14b6370

The fix will be in the next round of monthly releases (9.0.60).

Thanks !

Rémy


>
> On 2022/02/24 10:42:29 Rémy Maucherat wrote:
> > On Thu, Feb 24, 2022 at 10:31 AM Istvan SZEKELY
> >  wrote:
> > >
> > > Hello!
> > >
> > > I have an application where a ReadListener and a WriteListener (call it
> > > MyWriteListener) set to the ServletInputStream and the ServletOutputStream
> > > objects. Updating the Tomcat container from 8.5.73 to 8.5.75, the follow
> > > error occured. The ServletOutputStream objects's isReady function always
> > > returns false (within MyWriteListener.onWritePossible).
> > >
> > > I think its because of this commit:
> > > https://github.com/apache/tomcat/commit/2bfbbef65d1b1b07da46c8dcd6cee96cb5567998#diff-1ffbc1c154370a6c5385c168a0846a1c385aacbf5f880feb74cb1c27baa76003
> > >
> > > The ReadListener is set first, where dispatch fired
> > > (action(ActionCode.DISPATCH_EXECUTE, null);). There the request threadId
> > > updated (req.setRequestThread();).
> > > Then  when i'm setting the WriteListener (within the same thread), the
> > > DISPACTH_EXECUTE action not fired (due to threadId equals request objects
> > > thread id).  Thus registeredForWrite flag remains is true state, causing
> > > the isReady false behaviour.
> > >
> > > Is this a Tomcat bug, or I should do something differently. I could't set
> > > WriteListener within a different thread, but it feels weird. Should i do
> > > something else?
> >
> > I think I see the problem, but would you have test code or example
> > like this testcase to submit ?
> > https://github.com/apache/tomcat/blob/main/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java#L951
> > It would allow verifying and validating a fix.
> >
> > Rémy
> >
> > > Thank You in Advance,
> > >  Istvan
> >
> > -
> > 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: Re: Tomcat 8.5.75 Servlet WriteListener and ReadListener setting thread

2022-02-28 Thread Istvan SZEKELY
I've written a NonBlocking ReadWrite test (testDelayedNBReadWrite, in the
attached file). I'm not sure if it is a valid test case (though works on
8.5.73, fails on 8.5.75). If it is valid, i can make a PR if needed.

On 2022/02/24 10:42:29 Rémy Maucherat wrote:
> On Thu, Feb 24, 2022 at 10:31 AM Istvan SZEKELY
>  wrote:
> >
> > Hello!
> >
> > I have an application where a ReadListener and a WriteListener (call it
> > MyWriteListener) set to the ServletInputStream and the
ServletOutputStream
> > objects. Updating the Tomcat container from 8.5.73 to 8.5.75, the follow
> > error occured. The ServletOutputStream objects's isReady function always
> > returns false (within MyWriteListener.onWritePossible).
> >
> > I think its because of this commit:
> >
https://github.com/apache/tomcat/commit/2bfbbef65d1b1b07da46c8dcd6cee96cb5567998#diff-1ffbc1c154370a6c5385c168a0846a1c385aacbf5f880feb74cb1c27baa76003
> >
> > The ReadListener is set first, where dispatch fired
> > (action(ActionCode.DISPATCH_EXECUTE, null);). There the request threadId
> > updated (req.setRequestThread();).
> > Then  when i'm setting the WriteListener (within the same thread), the
> > DISPACTH_EXECUTE action not fired (due to threadId equals request
objects
> > thread id).  Thus registeredForWrite flag remains is true state, causing
> > the isReady false behaviour.
> >
> > Is this a Tomcat bug, or I should do something differently. I could't
set
> > WriteListener within a different thread, but it feels weird. Should i do
> > something else?
>
> I think I see the problem, but would you have test code or example
> like this testcase to submit ?
>
https://github.com/apache/tomcat/blob/main/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java#L951
> It would allow verifying and validating a fix.
>
> Rémy
>
> > Thank You in Advance,
> >  Istvan
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.catalina.nonblocking;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.net.HttpURLConnection;
import java.net.Socket;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

import javax.net.SocketFactory;
import javax.servlet.AsyncContext;
import javax.servlet.AsyncEvent;
import javax.servlet.AsyncListener;
import javax.servlet.DispatcherType;
import javax.servlet.ReadListener;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.WriteListener;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.junit.Assert;
import org.junit.Test;

import org.apache.catalina.Context;
import org.apache.catalina.Wrapper;
import org.apache.catalina.core.AsyncContextImpl;
import org.apache.catalina.startup.BytesStreamer;
import org.apache.catalina.startup.SimpleHttpClient;
import org.apache.catalina.startup.TesterServlet;
import org.apache.catalina.startup.Tomcat;
import org.apache.catalina.startup.TomcatBaseTest;
import org.apache.catalina.valves.TesterAccessLogValve;
import org.apache.coyote.Request;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.buf.ByteChunk;

public class TestNonBlockingAPI extends TomcatBaseTest {

private static final Log log = LogFactory.getLog(TestNonBlockingAPI.class);

private static final int CHUNK_SIZE = 1024 * 1024;
private static final int WRITE_SIZE  = CHUNK_SIZE * 10;
private static final byte[] DATA = new byte[WRITE_SIZE];
private static 

[ANN] Apache Tomcat 9.0.59 available

2022-02-28 Thread Rémy Maucherat
The Apache Tomcat team announces the immediate availability of Apache
Tomcat 9.0.59.

Apache Tomcat 9 is an open source software implementation of the Java
Servlet, JavaServer Pages, Java Unified Expression Language, Java
WebSocket and JASPIC technologies.

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

- Add support for additional user attributes to TomcatPrincipal and
   GenericPrincipal

- Correct a regression in the fix for 65454 that meant that
   minSpareThreads and maxThreads settings were ignored when the
   Connector used an internal executor

- Improve the detection of the Linux duplicate accept bug and reduce
   (hopefully avoid) instances of false positives.

Along with lots of other bug fixes and improvements.

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


Downloads:
https://tomcat.apache.org/download-90.cgi

Migration guides from Apache Tomcat 7.x and 8.x:
https://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



[ANN] Apache Tomcat 10.0.17 available

2022-02-28 Thread Mark Thomas

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

This release is targeted at Jakarta EE 9.

Applications that run on Tomcat 9 and earlier will not run on Tomcat 10 
without changes. Java EE applications designed for Tomcat 9 and earlier 
may be placed in the $CATALINA_BASE/webapps-javaee directory and Tomcat 
will automatically convert them to Jakarta EE and copy them to the 
webapps directory. This conversion is performed using the Apache Tomcat 
migration tool for Jakarta EE tool which is also available as a separate 
download for off-line use.


Apache Tomcat 10 is an open source software implementation of the
Jakarta Servlet, Jakarta Server Pages, Jakarta Expression Language,
Jakarta WebSocket, Jakarta Authentication and Jakarta Annotations
specifications.

The notable changes compared to 10.0.16 include:

- Add support for additional user attributes to TomcatPrincipal and
  GenericPrincipal

- Correct a regression in the fix for 65454 that meant that
  minSpareThreads and maxThreads settings were ignored when the
  Connector used an internal executor

- Improve the detection of the Linux duplicate accept bug and reduce
  (hopefully avoid) instances of false positives.

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

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

Migration guides from Apache Tomcat 7.0.x, 8.5.x and 9.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



[ANN] Apache Tomcat 10.1.0-M11 (alpha) available

2022-02-28 Thread Mark Thomas

The Apache Tomcat team announces the immediate availability of Apache
Tomcat 10.1.0-M11 (alpha).

Apache Tomcat 10 is an open source software implementation of the
Jakarta Servlet, Jakarta Server Pages, Jakarta Expression Language,
Jakarta WebSocket, Jakarta Authentication and Jakarta Annotations
specifications.

Applications that run on Tomcat 9 and earlier will not run on Tomcat 10 
without changes. Java EE applications designed for Tomcat 9 and earlier 
may be placed in the $CATALINA_BASE/webapps-javaee directory and Tomcat 
will automatically convert them to Jakarta EE and copy them to the 
webapps directory. This conversion is performed using the Apache Tomcat 
migration tool for Jakarta EE tool which is also available as a separate 
download for off-line use.


Apache Tomcat 10.1.0-M11 is a milestone release of the 10.1.x branch and 
has been made to provide users with early access to the new features in 
Apache Tomcat 10.1.x so that they may provide feedback. The notable 
changes compared to 10.1.0-M10 include:


- Add support for additional user attributes to TomcatPrincipal and
  GenericPrincipal

- Correct a regression in the fix for 65454 that meant that
  minSpareThreads and maxThreads settings were ignored when the
  Connector used an internal executor

- Improve the detection of the Linux duplicate accept bug and reduce
  (hopefully avoid) instances of false positives.

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

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

Migration guides from Apache Tomcat 7.0.x, 8.5.x and 9.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