You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Francesco Bassi <fv...@gmail.com> on 2017/03/24 17:51:27 UTC

ForkJoinPool behaviour changed from 9.0.0-M15 to 9.0.0-M17

Hello.
I have a weird problem that happens only wih tomcat 9.0.0-M17+:

- I need to process a parallel java stream inside a custom ForkJoinPool

If I run the code with 9.0.0-M15, I see that all the threads are properly
created using my factory.

If I run the code with 9.0.0-M17+, some of the threads that are used in the
Stream processing are not coming from my factory, but instead are instance
of
org.apache.catalina.startup.SafeForkJoinWorkerThreadFactory$SafeForkJoinWorkerThread.


Sample prototype code:

        ForkJoinPool pool = new ForkJoinPool(2, p -> new
MyForkJoinWorkerThread(p), null, false);
        pool.submit(() -> {
            Stream<T> stream = createMyStream();
            return stream.parallel().map(t -> {
                System.out.println("THREAD: " +
Thread.currentThread().getClass());
                return t;
            }).collect(Collectors.toArrayList());
        }).get();


It seems that something from the newer tomcats "interferes" with the
ForkJoinPool mechanism in some weird way.
Can someone help me to understand what's going on?

thanks,

--fb

Re: ForkJoinPool behaviour changed from 9.0.0-M15 to 9.0.0-M17

Posted by Francesco Bassi <fv...@gmail.com>.
Thanks a lot.
Your support is great and appropriate, as usual.

I still think there's something wrong with this topic, but more on the Java
8 side.
I'll do some more investigations and, in case, involve them!

--fb

On Fri, Mar 24, 2017 at 8:05 PM, Mark Thomas <ma...@apache.org> wrote:

> On 24 March 2017 17:51:27 GMT+00:00, Francesco Bassi <fv...@gmail.com>
> wrote:
> >Hello.
> >I have a weird problem that happens only wih tomcat 9.0.0-M17+:
> >
> >- I need to process a parallel java stream inside a custom ForkJoinPool
> >
> >If I run the code with 9.0.0-M15, I see that all the threads are
> >properly
> >created using my factory.
> >
> >If I run the code with 9.0.0-M17+, some of the threads that are used in
> >the
> >Stream processing are not coming from my factory, but instead are
> >instance
> >of
> >org.apache.catalina.startup.SafeForkJoinWorkerThreadFactor
> y$SafeForkJoinWorkerThread.
> >
> >
> >Sample prototype code:
> >
> >        ForkJoinPool pool = new ForkJoinPool(2, p -> new
> >MyForkJoinWorkerThread(p), null, false);
> >        pool.submit(() -> {
> >            Stream<T> stream = createMyStream();
> >            return stream.parallel().map(t -> {
> >                System.out.println("THREAD: " +
> >Thread.currentThread().getClass());
> >                return t;
> >            }).collect(Collectors.toArrayList());
> >        }).get();
> >
> >
> >It seems that something from the newer tomcats "interferes" with the
> >ForkJoinPool mechanism in some weird way.
> >Can someone help me to understand what's going on?
>
>
> http://tomcat.apache.org/tomcat-9.0-doc/config/listeners.html#JRE_Memory_
> Leak_Prevention_Listener_-_org.apache.catalina.core.
> JreMemoryLeakPreventionListener
>
> Look for forkJoinCommonPoolProtection
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: ForkJoinPool behaviour changed from 9.0.0-M15 to 9.0.0-M17

Posted by Mark Thomas <ma...@apache.org>.
On 24 March 2017 17:51:27 GMT+00:00, Francesco Bassi <fv...@gmail.com> wrote:
>Hello.
>I have a weird problem that happens only wih tomcat 9.0.0-M17+:
>
>- I need to process a parallel java stream inside a custom ForkJoinPool
>
>If I run the code with 9.0.0-M15, I see that all the threads are
>properly
>created using my factory.
>
>If I run the code with 9.0.0-M17+, some of the threads that are used in
>the
>Stream processing are not coming from my factory, but instead are
>instance
>of
>org.apache.catalina.startup.SafeForkJoinWorkerThreadFactory$SafeForkJoinWorkerThread.
>
>
>Sample prototype code:
>
>        ForkJoinPool pool = new ForkJoinPool(2, p -> new
>MyForkJoinWorkerThread(p), null, false);
>        pool.submit(() -> {
>            Stream<T> stream = createMyStream();
>            return stream.parallel().map(t -> {
>                System.out.println("THREAD: " +
>Thread.currentThread().getClass());
>                return t;
>            }).collect(Collectors.toArrayList());
>        }).get();
>
>
>It seems that something from the newer tomcats "interferes" with the
>ForkJoinPool mechanism in some weird way.
>Can someone help me to understand what's going on?


http://tomcat.apache.org/tomcat-9.0-doc/config/listeners.html#JRE_Memory_Leak_Prevention_Listener_-_org.apache.catalina.core.JreMemoryLeakPreventionListener

Look for forkJoinCommonPoolProtection

Mark

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