You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Christophe Pierret <cp...@sparus-software.com> on 2007/10/22 19:09:29 UTC

Executing user code in Poller Thread for NIO connector on timeout (executor is specified in server.xml)

Hi all,
I noticed that user code gets executed inside NIO Poller thread in case
of timeout error, if the executor is specified in server.xml.
Since there is very few poller threads, I guess it is not really a good
idea that the user code run in case of timeouts is run within the Poller
thread.
 
Here the call stack where it occurs for me (baseline 6.0.14).
http-23-Poller-0@e9d daemon, priority=5, in group 'main', status:
'RUNNING'
   error():149, Halley.java
   event():68, Halley.java  =>Implementation of CometProcessor.event()
   internalDoFilterEvent():470, ApplicationFilterChain.java
   doFilterEvent():363, ApplicationFilterChain.java
   event():422, StandardWrapperValve.java
   event():252, StandardContextValve.java
   event():179, StandardHostValve.java
   event():200, ValveBase.java
   event():128, StandardEngineValve.java
   event():175, CoyoteAdapter.java
   event():749, Http11NioProcessor.java
   event():637, Http11NioProtocol.java
   run():2009, NioEndpoint.java
   processSocket():1127, NioEndpoint.java
   cancelledKey():1377, NioEndpoint.java
   timeout():1611, NioEndpoint.java
   run():1452, NioEndpoint.java
   run():595, Thread.java
 
Do you think that this code could be executed within an "executor"
thread instead ?
 
I think that the following lines (in cancelledKey(),
NioEndpoint.java)may be changed from:
processSocket(ka.getChannel(), status, false);//don't dispatch if the
lines below are cancelling the key
if (status == SocketStatus.TIMEOUT ) return; // don't close on comet
timeout
 
to:
processSocket(ka.getChannel(), status, status ==
SocketStatus.TIMEOUT);//don't dispatch if the lines below are cancelling
the key
if (status == SocketStatus.TIMEOUT ) return; // don't close on comet
timeout
 
 
Best regards,
Christophe Pierret

Re: Executing user code in Poller Thread for NIO connector on timeout (executor is specified in server.xml)

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
looking at the code, I'm gonna hold off with the fix until after we tag, 
there is much cleanup to be done on this particular section

Filip

Filip Hanik - Dev Lists wrote:
> absolutely, the other place that issues a timeout, does a dispatch, 
> this one should do it too.
>
> Filip
>
> Christophe Pierret wrote:
>> Hi all,
>> I noticed that user code gets executed inside NIO Poller thread in case
>> of timeout error, if the executor is specified in server.xml.
>> Since there is very few poller threads, I guess it is not really a good
>> idea that the user code run in case of timeouts is run within the Poller
>> thread.
>>  
>> Here the call stack where it occurs for me (baseline 6.0.14).
>> http-23-Poller-0@e9d daemon, priority=5, in group 'main', status:
>> 'RUNNING'
>>    error():149, Halley.java
>>    event():68, Halley.java  =>Implementation of CometProcessor.event()
>>    internalDoFilterEvent():470, ApplicationFilterChain.java
>>    doFilterEvent():363, ApplicationFilterChain.java
>>    event():422, StandardWrapperValve.java
>>    event():252, StandardContextValve.java
>>    event():179, StandardHostValve.java
>>    event():200, ValveBase.java
>>    event():128, StandardEngineValve.java
>>    event():175, CoyoteAdapter.java
>>    event():749, Http11NioProcessor.java
>>    event():637, Http11NioProtocol.java
>>    run():2009, NioEndpoint.java
>>    processSocket():1127, NioEndpoint.java
>>    cancelledKey():1377, NioEndpoint.java
>>    timeout():1611, NioEndpoint.java
>>    run():1452, NioEndpoint.java
>>    run():595, Thread.java
>>  
>> Do you think that this code could be executed within an "executor"
>> thread instead ?
>>  
>> I think that the following lines (in cancelledKey(),
>> NioEndpoint.java)may be changed from:
>> processSocket(ka.getChannel(), status, false);//don't dispatch if the
>> lines below are cancelling the key
>> if (status == SocketStatus.TIMEOUT ) return; // don't close on comet
>> timeout
>>  
>> to:
>> processSocket(ka.getChannel(), status, status ==
>> SocketStatus.TIMEOUT);//don't dispatch if the lines below are cancelling
>> the key
>> if (status == SocketStatus.TIMEOUT ) return; // don't close on comet
>> timeout
>>  
>>  
>> Best regards,
>> Christophe Pierret
>>
>>   
>> ------------------------------------------------------------------------
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 
>> 269.15.5/1084 - Release Date: 10/21/2007 3:09 PM
>>   
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
>


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


Re: Executing user code in Poller Thread for NIO connector on timeout (executor is specified in server.xml)

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
absolutely, the other place that issues a timeout, does a dispatch, this 
one should do it too.

Filip

Christophe Pierret wrote:
> Hi all,
> I noticed that user code gets executed inside NIO Poller thread in case
> of timeout error, if the executor is specified in server.xml.
> Since there is very few poller threads, I guess it is not really a good
> idea that the user code run in case of timeouts is run within the Poller
> thread.
>  
> Here the call stack where it occurs for me (baseline 6.0.14).
> http-23-Poller-0@e9d daemon, priority=5, in group 'main', status:
> 'RUNNING'
>    error():149, Halley.java
>    event():68, Halley.java  =>Implementation of CometProcessor.event()
>    internalDoFilterEvent():470, ApplicationFilterChain.java
>    doFilterEvent():363, ApplicationFilterChain.java
>    event():422, StandardWrapperValve.java
>    event():252, StandardContextValve.java
>    event():179, StandardHostValve.java
>    event():200, ValveBase.java
>    event():128, StandardEngineValve.java
>    event():175, CoyoteAdapter.java
>    event():749, Http11NioProcessor.java
>    event():637, Http11NioProtocol.java
>    run():2009, NioEndpoint.java
>    processSocket():1127, NioEndpoint.java
>    cancelledKey():1377, NioEndpoint.java
>    timeout():1611, NioEndpoint.java
>    run():1452, NioEndpoint.java
>    run():595, Thread.java
>  
> Do you think that this code could be executed within an "executor"
> thread instead ?
>  
> I think that the following lines (in cancelledKey(),
> NioEndpoint.java)may be changed from:
> processSocket(ka.getChannel(), status, false);//don't dispatch if the
> lines below are cancelling the key
> if (status == SocketStatus.TIMEOUT ) return; // don't close on comet
> timeout
>  
> to:
> processSocket(ka.getChannel(), status, status ==
> SocketStatus.TIMEOUT);//don't dispatch if the lines below are cancelling
> the key
> if (status == SocketStatus.TIMEOUT ) return; // don't close on comet
> timeout
>  
>  
> Best regards,
> Christophe Pierret
>
>   
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition. 
> Version: 7.5.488 / Virus Database: 269.15.5/1084 - Release Date: 10/21/2007 3:09 PM
>   


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