[Freeswitch-users] org.freeswitch.esl.client warns of resource misuse

Adam Kelloway adam.kelloway at newpace.ca
Thu May 5 16:11:11 MSD 2011


Hi David,

This was with version 0.9.2 and netty-3.2.1.Final.jar.

Thanks very much,

Adam

On 3:59 PM, david varnes wrote:
> Hi Adam,
>
> On 4 May 2011 04:15, Adam Kelloway<adam.kelloway at newpace.ca>  wrote:
>> Hi there,
>>
>> This is directed at those involved in the development of the
>> org.freeswitch.esl.client library. Apologies if this has already been
>> mentioned, I couldn't find any references to it.
>>
>> In evaluating this library, I noticed that AbstractOutboundPipelineFactory
>> implementation of ChannelPipelineFactory.getPipeline() creates a new
>> ExecutionHandler each time it is called, which results in a increasing
>> number of thread pools being used that eventually triggers the following
>> warning:
>>
>> org.jboss.netty.util.internal.SharedResourceMisuseDetector
>> WARNING: You are creating too many MemoryAwareThreadPoolExecutor instances.
>> MemoryAwareThreadPoolExecutor is a shared resource that must be reused
>> across the application, so that only a few instances are created.
>>
>> Looking at the documentation for ExecutionHandler, I noticed that the
>> example implementation provides a dedicated ExecutionHandler instance, which
>> is passed to all pipelines returned in getPipeline(). Note the comment in
>> the example that states it "Must be shared".
>>
>> From
>> http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution/ExecutionHandler.html:
>> --------------
>> public class DatabaseGatewayPipelineFactory implements
>> ChannelPipelineFactory {
>>
>> private final ExecutionHandler executionHandler;
>>
>> public DatabaseGatewayPipelineFactory(ExecutionHandler executionHandler) {
>>    this.executionHandler =xecutionHandler;
>> }
>>
>> public ChannelPipeline getPipeline() {
>>    return Channels.pipeline(
>>      new DatabaseGatewayProtocolEncoder(),
>>      new DatabaseGatewayProtocolDecoder(),
>>      executionHandler, // Must be shared
>>      new DatabaseQueryingHandler());
>>    }
>> }
>> -------------
>>
>> Is there any particular reason why AbstractOutboundPipelineFactory does not
>> provide a dedicated ExecutionHandler that may be shared by all pipelines, or
>> is this simply an oversight?
> Very good question.  Off the top of my head I would say this is an oversight.
>
> Which version of esl-client and netty are you seeing this with ?
>
> Should be straight forward to sort this out.
> I have a few pending changes to commit into the esl-client, and will
> try to get to it asap.
>
> Thanks for the post.
>
> Also, I should find somewhere to log bugs (and patches :-), not sure
> if the official JIRA
> system is available.
>
> regards
> davidv
>
>
>> Thanks and keep up the good work,
>>
>> Adam Kelloway
>>
>
>


-- 
Adam Kelloway
Software Engineer
NewPace Technology Development Inc.
adam.kelloway at newpace.ca
+1 902-406-8375 x1031
www.newpace.ca




More information about the FreeSWITCH-users mailing list