You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Shiva Kumar K R <sh...@securelyshare.com> on 2018/02/05 14:36:29 UTC

Is tomcat 8.5.24 uses thread pool by default.

Hi,

Component details:
Tomcat = 8.5.24
Java = 1.8
OS = Ubuntu 16.04 LTS

Is above tomcat uses thread pool to process requests out of the box without
any explicit configuration of thread pool.

I faced an issue while using threadlocal which was returning data stored in
previous request instead of current request.

Thank You,
Shiva Kumar K R

Re: Is tomcat 8.5.24 uses thread pool by default.

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Shiva,

On 2/5/18 9:36 AM, Shiva Kumar K R wrote:
> Hi,
> 
> Component details: Tomcat = 8.5.24 Java = 1.8 OS = Ubuntu 16.04
> LTS
> 
> Is above tomcat uses thread pool to process requests out of the box
> without any explicit configuration of thread pool.

Yes. Tomcat always uses a thread-pool. Do you mean "executor" (which
is just a very specific type of thread pool)?

> I faced an issue while using threadlocal which was returning data
> stored in previous request instead of current request.

You need to be very careful when using ThreadLocals in a
multi-threaded context such as a web server. It's best to remove all
ThreadLocals at the end of every request, preferably in a "finally"
block, or in a an appropriate Listener.

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

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlp4cY8dHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFhh9xAAqtNg69c97s+GhbBi
KDLgwvKkl34ZUgur3dtMOf3hrSu7MeyfT3qZ5UyhcPmOELIuRQL8cB71xiDB+B+F
l29RW2KF62N8AST2OlbY7Kw9DMS3nZHyjGPvT69sXkYpnM1OoSKvZY5ar6yzGGgF
Pd30iw/XaYHolr+je6iarpxBSqfNjIfowY6n7ldi4pIG0oBz/5blMr99JpvjraiU
t25eaKS/bpAaVWV+koHbwnct1eedlZ9Z0wJaFv7/+64h33T14VSNyUXtYVTTUMB6
SLpsQikJxcDq2Jdi6f436uA12uvk52QK4yAAmAsKI3Yl33iKWXI9JMAgR0q2lVSx
+DqGVs3se88hhrS33E3isUA8wEyCPpDzNSIAWre6GQWRkAjd3/j1XhjtwW+rZTpo
Y3dOI/eiZN25gYmTGtzEBjv/0YRALamZoMqlHmKeKg7x/JPAB88eYAPvwSbOCIMr
Uu0JBfFJ6bf9OCNTvKMgxFNVVsocX7cQ0JbV8O7eb5wrenCcfoBHyt3z9gDGaEBb
xnw9WNlZ4qkUBreWoLEz321YM2BuKKLroAGg6v9XEet+YvnTsXk9Wh3jaOMNBe/o
czoVOJwDskoE9TyXPHExReTKjnm/xSJ94AslDnIwfbmmioWx57kLmeduf6yvy8rV
qrbDA3LH1gO9ItvxYkzxDbr4wfM=
=roju
-----END PGP SIGNATURE-----

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


Re: Is tomcat 8.5.24 uses thread pool by default.

Posted by Shiva Kumar K R <sh...@securelyshare.com>.
Hi,

I got u right. Thanks for the quick answer.

On 05-Feb-2018 8:32 PM, "Shiva Kumar K R" <sh...@securelyshare.com> wrote:

> Hi,
>
> Thanks for the response, u r right I'll do the cleanup. And is tomcat uses
> new thread for each request or reuse existing thread.
>
> Thank you,
> Shiva
>
> On 05-Feb-2018 8:28 PM, "Johan Compagner" <jc...@servoy.com> wrote:
>
>> If that is the case then the problem is also that you don't clean up the
>> threadlocals..
>> That is a problem by itself, you should always after a request have
>> cleanup
>> all your threadlocals
>>
>> On 5 February 2018 at 15:36, Shiva Kumar K R <sh...@securelyshare.com>
>> wrote:
>>
>> > Hi,
>> >
>> > Component details:
>> > Tomcat = 8.5.24
>> > Java = 1.8
>> > OS = Ubuntu 16.04 LTS
>> >
>> > Is above tomcat uses thread pool to process requests out of the box
>> without
>> > any explicit configuration of thread pool.
>> >
>> > I faced an issue while using threadlocal which was returning data
>> stored in
>> > previous request instead of current request.
>> >
>> > Thank You,
>> > Shiva Kumar K R
>> >
>>
>>
>>
>> --
>> Johan Compagner
>> Servoy
>>
>

Re: Is tomcat 8.5.24 uses thread pool by default.

Posted by Shiva Kumar K R <sh...@securelyshare.com>.
Hi,

Thanks for the response, u r right I'll do the cleanup. And is tomcat uses
new thread for each request or reuse existing thread.

Thank you,
Shiva

On 05-Feb-2018 8:28 PM, "Johan Compagner" <jc...@servoy.com> wrote:

> If that is the case then the problem is also that you don't clean up the
> threadlocals..
> That is a problem by itself, you should always after a request have cleanup
> all your threadlocals
>
> On 5 February 2018 at 15:36, Shiva Kumar K R <sh...@securelyshare.com>
> wrote:
>
> > Hi,
> >
> > Component details:
> > Tomcat = 8.5.24
> > Java = 1.8
> > OS = Ubuntu 16.04 LTS
> >
> > Is above tomcat uses thread pool to process requests out of the box
> without
> > any explicit configuration of thread pool.
> >
> > I faced an issue while using threadlocal which was returning data stored
> in
> > previous request instead of current request.
> >
> > Thank You,
> > Shiva Kumar K R
> >
>
>
>
> --
> Johan Compagner
> Servoy
>

Re: Is tomcat 8.5.24 uses thread pool by default.

Posted by Johan Compagner <jc...@servoy.com>.
If that is the case then the problem is also that you don't clean up the
threadlocals..
That is a problem by itself, you should always after a request have cleanup
all your threadlocals

On 5 February 2018 at 15:36, Shiva Kumar K R <sh...@securelyshare.com>
wrote:

> Hi,
>
> Component details:
> Tomcat = 8.5.24
> Java = 1.8
> OS = Ubuntu 16.04 LTS
>
> Is above tomcat uses thread pool to process requests out of the box without
> any explicit configuration of thread pool.
>
> I faced an issue while using threadlocal which was returning data stored in
> previous request instead of current request.
>
> Thank You,
> Shiva Kumar K R
>



-- 
Johan Compagner
Servoy