You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Mario Ruebsam <ma...@googlemail.com> on 2007/09/14 13:21:26 UTC

Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Hello,

after migrating successful from Little-G Jetty 1.1 to Little-G Jetty 2.0.1
I detected some strange behavior when closing the Servlets response writer.
Every time the writer is closed Geronimo or Jetty creates 10 new Threads
in the DefaultThreadPool. The code snippet is below.

In G 1.1 the same code has no impact on threads.
Does anybody has the same experience? Is this a Jetty or a Geronimo problem?

public void doGet(HttpServletRequest pRequest, HttpServletResponse pResponse) 
throws IOException, ServletException {
	<... do some stuff ...>

	PrintWriter tOut = pResponse.getWriter();
	tOut.write(tData);
	tOut.close();
}


Thanks,
Mario

Re: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by Kevan Miller <ke...@gmail.com>.
On Sep 14, 2007, at 11:34 AM, Mario Ruebsam wrote:

> I did some debugging and followed the code until:
>
> SelectChannelConnector$ConnectorEndPoint(SelectChannelEndPoint).run 
> () line: 422
>
> when this line is called the Treads will be created.

Nice. Thanks for digging into this Mario!

>
> I guess this is Jetty code because I could not found it
> in the Geronimo sources.

Correct.

>
> Which Jetty version is used is Geronimo 2.0.1?
> When I look in the sources pom.xml it is 6.1.5, is this the used  
> Version?

Yes, we use 6.1.5. See geronimo-jetty6-jee5-2.0.1/repository/org/ 
mortbay/jetty/jetty/6.1.5/jetty-6.1.5.jar in your installation...

Perhaps Jan or Greg can comment on the behavior you're seeing...

--kevan




Re: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by Mario Ruebsam <ma...@googlemail.com>.
The new Treads are created by more than one Servlet requests
when loading a page. The page itself and also serving some
static files.
The new Threads appear all at the same time because of a
synchronized block in SelectChannelEndPoint.undispatch();
Which is called at the line number mentioned in my last mail.

All that looks like normal behaviour. The problem I see is
that all newly created Threads stay alive and none of theses
Threads is reused after that.

I guess there is some problem reusing the Threads in the pool and
every request creates new Threads. The number of 10 new threads
mentioned before relates magically to exact 10 servlet requests
in my test case. On other pages there are lesser or more.
So the number means nothing.

I have no idea about the Thread pool management and don't know
where to start so I give the ball back to you guys on the list.

Thanks,
Mario


Mario Ruebsam wrote:
> Ok, I will download or checkout the Jetty 6.1.5 sources to do some further
> investigation on it.
> 
> Thanks,
> Mario
> 
> 
> Paul McMahan wrote:
>> Mario,  thanks for doing the extra debugging to narrow down where the 
>> problem is at.  Yes the jetty version is 6.1.5.   You can also find 
>> the version number of a component in the admin console's System 
>> modules portlet or by the directory name in Geronimo's repository,  in 
>> this case $G/repository/org/mortbay/jetty/jetty/6.1.5
>>
>> Best wishes,
>> Paul
>>
>>
>> On Sep 14, 2007, at 11:34 AM, Mario Ruebsam wrote:
>>
>>> I did some debugging and followed the code until:
>>>
>>> SelectChannelConnector$ConnectorEndPoint(SelectChannelEndPoint).run() 
>>> line: 422
>>>
>>> when this line is called the Treads will be created.
>>>
>>> I guess this is Jetty code because I could not found it
>>> in the Geronimo sources.
>>>
>>> Which Jetty version is used is Geronimo 2.0.1?
>>> When I look in the sources pom.xml it is 6.1.5, is this the used 
>>> Version?
>>>
>>> Thanks,
>>> Mario
>>>
>>>
>>> Mario Ruebsam wrote:
>>>> Hello,
>>>> after migrating successful from Little-G Jetty 1.1 to Little-G Jetty 
>>>> 2.0.1
>>>> I detected some strange behavior when closing the Servlets response 
>>>> writer.
>>>> Every time the writer is closed Geronimo or Jetty creates 10 new 
>>>> Threads
>>>> in the DefaultThreadPool. The code snippet is below.
>>>> In G 1.1 the same code has no impact on threads.
>>>> Does anybody has the same experience? Is this a Jetty or a Geronimo 
>>>> problem?
>>>> public void doGet(HttpServletRequest pRequest, HttpServletResponse 
>>>> pResponse) throws IOException, ServletException {
>>>>     <... do some stuff ...>
>>>>     PrintWriter tOut = pResponse.getWriter();
>>>>     tOut.write(tData);
>>>>     tOut.close();
>>>> }
>>>> Thanks,
>>>> Mario
>>>
>>
>>
> 
> 


Re: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by Mario Ruebsam <ma...@googlemail.com>.
Ok, I will download or checkout the Jetty 6.1.5 sources to do some further
investigation on it.

Thanks,
Mario


Paul McMahan wrote:
> Mario,  thanks for doing the extra debugging to narrow down where the 
> problem is at.  Yes the jetty version is 6.1.5.   You can also find the 
> version number of a component in the admin console's System modules 
> portlet or by the directory name in Geronimo's repository,  in this case 
> $G/repository/org/mortbay/jetty/jetty/6.1.5
> 
> Best wishes,
> Paul
> 
> 
> On Sep 14, 2007, at 11:34 AM, Mario Ruebsam wrote:
> 
>> I did some debugging and followed the code until:
>>
>> SelectChannelConnector$ConnectorEndPoint(SelectChannelEndPoint).run() 
>> line: 422
>>
>> when this line is called the Treads will be created.
>>
>> I guess this is Jetty code because I could not found it
>> in the Geronimo sources.
>>
>> Which Jetty version is used is Geronimo 2.0.1?
>> When I look in the sources pom.xml it is 6.1.5, is this the used Version?
>>
>> Thanks,
>> Mario
>>
>>
>> Mario Ruebsam wrote:
>>> Hello,
>>> after migrating successful from Little-G Jetty 1.1 to Little-G Jetty 
>>> 2.0.1
>>> I detected some strange behavior when closing the Servlets response 
>>> writer.
>>> Every time the writer is closed Geronimo or Jetty creates 10 new Threads
>>> in the DefaultThreadPool. The code snippet is below.
>>> In G 1.1 the same code has no impact on threads.
>>> Does anybody has the same experience? Is this a Jetty or a Geronimo 
>>> problem?
>>> public void doGet(HttpServletRequest pRequest, HttpServletResponse 
>>> pResponse) throws IOException, ServletException {
>>>     <... do some stuff ...>
>>>     PrintWriter tOut = pResponse.getWriter();
>>>     tOut.write(tData);
>>>     tOut.close();
>>> }
>>> Thanks,
>>> Mario
>>
> 
> 


Re: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by Paul McMahan <pa...@gmail.com>.
Mario,  thanks for doing the extra debugging to narrow down where the  
problem is at.  Yes the jetty version is 6.1.5.   You can also find  
the version number of a component in the admin console's System  
modules portlet or by the directory name in Geronimo's repository,   
in this case $G/repository/org/mortbay/jetty/jetty/6.1.5

Best wishes,
Paul


On Sep 14, 2007, at 11:34 AM, Mario Ruebsam wrote:

> I did some debugging and followed the code until:
>
> SelectChannelConnector$ConnectorEndPoint(SelectChannelEndPoint).run 
> () line: 422
>
> when this line is called the Treads will be created.
>
> I guess this is Jetty code because I could not found it
> in the Geronimo sources.
>
> Which Jetty version is used is Geronimo 2.0.1?
> When I look in the sources pom.xml it is 6.1.5, is this the used  
> Version?
>
> Thanks,
> Mario
>
>
> Mario Ruebsam wrote:
>> Hello,
>> after migrating successful from Little-G Jetty 1.1 to Little-G  
>> Jetty 2.0.1
>> I detected some strange behavior when closing the Servlets  
>> response writer.
>> Every time the writer is closed Geronimo or Jetty creates 10 new  
>> Threads
>> in the DefaultThreadPool. The code snippet is below.
>> In G 1.1 the same code has no impact on threads.
>> Does anybody has the same experience? Is this a Jetty or a  
>> Geronimo problem?
>> public void doGet(HttpServletRequest pRequest, HttpServletResponse  
>> pResponse) throws IOException, ServletException {
>>     <... do some stuff ...>
>>     PrintWriter tOut = pResponse.getWriter();
>>     tOut.write(tData);
>>     tOut.close();
>> }
>> Thanks,
>> Mario
>


Re: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by Mario Ruebsam <ma...@googlemail.com>.
I did some debugging and followed the code until:

SelectChannelConnector$ConnectorEndPoint(SelectChannelEndPoint).run() line: 422

when this line is called the Treads will be created.

I guess this is Jetty code because I could not found it
in the Geronimo sources.

Which Jetty version is used is Geronimo 2.0.1?
When I look in the sources pom.xml it is 6.1.5, is this the used Version?

Thanks,
Mario


Mario Ruebsam wrote:
> Hello,
> 
> after migrating successful from Little-G Jetty 1.1 to Little-G Jetty 2.0.1
> I detected some strange behavior when closing the Servlets response writer.
> Every time the writer is closed Geronimo or Jetty creates 10 new Threads
> in the DefaultThreadPool. The code snippet is below.
> 
> In G 1.1 the same code has no impact on threads.
> Does anybody has the same experience? Is this a Jetty or a Geronimo 
> problem?
> 
> public void doGet(HttpServletRequest pRequest, HttpServletResponse 
> pResponse) throws IOException, ServletException {
>     <... do some stuff ...>
> 
>     PrintWriter tOut = pResponse.getWriter();
>     tOut.write(tData);
>     tOut.close();
> }
> 
> 
> Thanks,
> Mario
> 


Re: Threads not released/reused in Geronimo 2.0.1 and Jetty, was: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by Matt Hogstrom <ma...@hogstrom.org>.
On Sep 17, 2007, at 12:56 PM, David Jencks wrote:

>
> On Sep 17, 2007, at 11:44 AM, Joe Bohn wrote:
>
>> David,
>>
>> Should we expose these attributes in the config.xml and config- 
>> substitions.properties in our default assemblies so that they are  
>> more easily edited?
>
> https://issues.apache.org/jira/browse/GERONIMO-3475
>
>> Also, is the current default of 500 still appropriate?   It looks  
>> like this was changed from 300 to 500 as part of your work to hook  
>> the connectors up to the thread pools.
> dunno, we can try 300 and see what happens.
>

I think a MaxThread value of 150 would be adequate and not consume  
too many system resources.  I would expect that many people are  
running on a 2-way system with a couple of gig of memory.

I'll ask about this on the dev list.

Re: Threads not released/reused in Geronimo 2.0.1 and Jetty, was: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by David Jencks <da...@yahoo.com>.
On Sep 17, 2007, at 11:44 AM, Joe Bohn wrote:

> David,
>
> Should we expose these attributes in the config.xml and config- 
> substitions.properties in our default assemblies so that they are  
> more easily edited?

https://issues.apache.org/jira/browse/GERONIMO-3475

> Also, is the current default of 500 still appropriate?   It looks  
> like this was changed from 300 to 500 as part of your work to hook  
> the connectors up to the thread pools.
dunno, we can try 300 and see what happens.

thanks
david jencks

>
> Joe
>
>
> David Jencks wrote:
>> Thanks for pointing out that this is overly difficult to configure.
>> In your var/config/config.xml add this to the rmi-naming module  
>> element
>>    <gbean name="DefaultThreadPool">
>>         <attribute name="keepAliveTime">5000</attribute>
>>         <attribute name="poolSize">${threadPoolSize}</attribute>
>>     </gbean>
>> and add this in var/config/config-substitutions.properties
>> threadPoolSize=100
>> (or whatever value you want)
>> You can hardcode the size in the config.xml but it may be easier  
>> to change from config-substitutions.
>> thanks
>> david jencks
>> On Sep 17, 2007, at 4:29 AM, Mario Ruebsam wrote:
>>> Ok, now that I run Geronimo 2.0.1 with console I see the max thread
>>> setting of 500. The Little-G Version is also set to this default
>>> max thread count. The question for me is now why this increase in
>>> max thread count compared with the 1.1 version? Some systems like
>>> HP-UX have a default of 128 threads per process and in my special
>>> case it was already set to 512.
>>> Is there an option to set it lower in Little-G without the console?
>>>
>>> Thanks,
>>> Mario
>>>
>>>
>>> Mario Ruebsam wrote:
>>>> The increasing creation of Threads happens also when I start
>>>> the default Geronimo/Jetty 2.0.1 distribution.
>>>> Even the usage of the console leads to creation of new Threads
>>>> and none of the existing Threads will be reused.
>>>> I tested it in the following environment:
>>>> Windows XP, Java 1.6.0_02
>>>> HP-UX, Java 1.5.0_9
>>>> Thanks,
>>>> Mario


Re: Threads not released/reused in Geronimo 2.0.1 and Jetty, was: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by Joe Bohn <jo...@earthlink.net>.
David,

Should we expose these attributes in the config.xml and 
config-substitions.properties in our default assemblies so that they are 
more easily edited?  Also, is the current default of 500 still 
appropriate?   It looks like this was changed from 300 to 500 as part of 
your work to hook the connectors up to the thread pools.

Joe


David Jencks wrote:
> Thanks for pointing out that this is overly difficult to configure.
> 
> In your var/config/config.xml add this to the rmi-naming module element
> 
>    <gbean name="DefaultThreadPool">
>         <attribute name="keepAliveTime">5000</attribute>
>         <attribute name="poolSize">${threadPoolSize}</attribute>
>     </gbean>
> 
> and add this in var/config/config-substitutions.properties
> threadPoolSize=100
> 
> (or whatever value you want)
> 
> You can hardcode the size in the config.xml but it may be easier to 
> change from config-substitutions.
> 
> thanks
> david jencks
> 
> 
> 
> On Sep 17, 2007, at 4:29 AM, Mario Ruebsam wrote:
> 
>> Ok, now that I run Geronimo 2.0.1 with console I see the max thread
>> setting of 500. The Little-G Version is also set to this default
>> max thread count. The question for me is now why this increase in
>> max thread count compared with the 1.1 version? Some systems like
>> HP-UX have a default of 128 threads per process and in my special
>> case it was already set to 512.
>> Is there an option to set it lower in Little-G without the console?
>>
>> Thanks,
>> Mario
>>
>>
>> Mario Ruebsam wrote:
>>> The increasing creation of Threads happens also when I start
>>> the default Geronimo/Jetty 2.0.1 distribution.
>>> Even the usage of the console leads to creation of new Threads
>>> and none of the existing Threads will be reused.
>>> I tested it in the following environment:
>>> Windows XP, Java 1.6.0_02
>>> HP-UX, Java 1.5.0_9
>>> Thanks,
>>> Mario
> 
> 

Re: Threads not released/reused in Geronimo 2.0.1 and Jetty, was: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by Mario Ruebsam <ma...@googlemail.com>.
Hello David,

thanks much for the tip, this will help saving resources on our notebook
installations with Little-G.

Thanks,
Mario



David Jencks wrote:
> Thanks for pointing out that this is overly difficult to configure.
> 
> In your var/config/config.xml add this to the rmi-naming module element
> 
>    <gbean name="DefaultThreadPool">
>         <attribute name="keepAliveTime">5000</attribute>
>         <attribute name="poolSize">${threadPoolSize}</attribute>
>     </gbean>
> 
> and add this in var/config/config-substitutions.properties
> threadPoolSize=100
> 
> (or whatever value you want)
> 
> You can hardcode the size in the config.xml but it may be easier to 
> change from config-substitutions.
> 
> thanks
> david jencks
> 
> 
> 
> On Sep 17, 2007, at 4:29 AM, Mario Ruebsam wrote:
> 
>> Ok, now that I run Geronimo 2.0.1 with console I see the max thread
>> setting of 500. The Little-G Version is also set to this default
>> max thread count. The question for me is now why this increase in
>> max thread count compared with the 1.1 version? Some systems like
>> HP-UX have a default of 128 threads per process and in my special
>> case it was already set to 512.
>> Is there an option to set it lower in Little-G without the console?
>>
>> Thanks,
>> Mario
>>
>>
>> Mario Ruebsam wrote:
>>> The increasing creation of Threads happens also when I start
>>> the default Geronimo/Jetty 2.0.1 distribution.
>>> Even the usage of the console leads to creation of new Threads
>>> and none of the existing Threads will be reused.
>>> I tested it in the following environment:
>>> Windows XP, Java 1.6.0_02
>>> HP-UX, Java 1.5.0_9
>>> Thanks,
>>> Mario
> 
> 


Re: Threads not released/reused in Geronimo 2.0.1 and Jetty, was: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by David Jencks <da...@yahoo.com>.
Thanks for pointing out that this is overly difficult to configure.

In your var/config/config.xml add this to the rmi-naming module element

    <gbean name="DefaultThreadPool">
         <attribute name="keepAliveTime">5000</attribute>
         <attribute name="poolSize">${threadPoolSize}</attribute>
     </gbean>

and add this in var/config/config-substitutions.properties
threadPoolSize=100

(or whatever value you want)

You can hardcode the size in the config.xml but it may be easier to  
change from config-substitutions.

thanks
david jencks



On Sep 17, 2007, at 4:29 AM, Mario Ruebsam wrote:

> Ok, now that I run Geronimo 2.0.1 with console I see the max thread
> setting of 500. The Little-G Version is also set to this default
> max thread count. The question for me is now why this increase in
> max thread count compared with the 1.1 version? Some systems like
> HP-UX have a default of 128 threads per process and in my special
> case it was already set to 512.
> Is there an option to set it lower in Little-G without the console?
>
> Thanks,
> Mario
>
>
> Mario Ruebsam wrote:
>> The increasing creation of Threads happens also when I start
>> the default Geronimo/Jetty 2.0.1 distribution.
>> Even the usage of the console leads to creation of new Threads
>> and none of the existing Threads will be reused.
>> I tested it in the following environment:
>> Windows XP, Java 1.6.0_02
>> HP-UX, Java 1.5.0_9
>> Thanks,
>> Mario


Re: Threads not released/reused in Geronimo 2.0.1 and Jetty, was: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by Mario Ruebsam <ma...@googlemail.com>.
Ok, now that I run Geronimo 2.0.1 with console I see the max thread
setting of 500. The Little-G Version is also set to this default
max thread count. The question for me is now why this increase in
max thread count compared with the 1.1 version? Some systems like
HP-UX have a default of 128 threads per process and in my special
case it was already set to 512.
Is there an option to set it lower in Little-G without the console?

Thanks,
Mario


Mario Ruebsam wrote:
> The increasing creation of Threads happens also when I start
> the default Geronimo/Jetty 2.0.1 distribution.
> Even the usage of the console leads to creation of new Threads
> and none of the existing Threads will be reused.
> 
> I tested it in the following environment:
> 
> Windows XP, Java 1.6.0_02
> HP-UX, Java 1.5.0_9
> 
> Thanks,
> Mario
> 

Threads not released/reused in Geronimo 2.0.1 and Jetty, was: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by Mario Ruebsam <ma...@googlemail.com>.
The increasing creation of Threads happens also when I start
the default Geronimo/Jetty 2.0.1 distribution.
Even the usage of the console leads to creation of new Threads
and none of the existing Threads will be reused.

I tested it in the following environment:

Windows XP, Java 1.6.0_02
HP-UX, Java 1.5.0_9

Thanks,
Mario

Re: Creation of new threads after closing response writer in Servlet in Little-G Jetty 2.0.1

Posted by Mario Rübsam <mr...@coderesearch.com>.
I did some debugging and followed the code until:

SelectChannelConnector$ConnectorEndPoint(SelectChannelEndPoint).run() line: 422

when this line is called the Treads will be created.

I guess this is Jetty code because I could not found it
in the Geronimo sources.

Which Jetty version is used is Geronimo 2.0.1?
When I look in the sources pom.xml it is 6.1.5, is this the used Version?

Thanks,
Mario


Mario Ruebsam wrote:
> Hello,
> 
> after migrating successful from Little-G Jetty 1.1 to Little-G Jetty 2.0.1
> I detected some strange behavior when closing the Servlets response writer.
> Every time the writer is closed Geronimo or Jetty creates 10 new Threads
> in the DefaultThreadPool. The code snippet is below.
> 
> In G 1.1 the same code has no impact on threads.
> Does anybody has the same experience? Is this a Jetty or a Geronimo 
> problem?
> 
> public void doGet(HttpServletRequest pRequest, HttpServletResponse 
> pResponse) throws IOException, ServletException {
>     <... do some stuff ...>
> 
>     PrintWriter tOut = pResponse.getWriter();
>     tOut.write(tData);
>     tOut.close();
> }
> 
> 
> Thanks,
> Mario
>