org.freeswitch.esl.client warns of resource misuse
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/Execut...:
public class DatabaseGatewayPipelineFactory implements |ChannelPipelineFactory| <http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/ChannelPipelineFactory.html> { *private final |ExecutionHandler| <http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution/ExecutionHandler.html> executionHandler;* public DatabaseGatewayPipelineFactory(|ExecutionHandler| <http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution/ExecutionHandler.html> executionHandler) { this.executionHandler = executionHandler; } public |ChannelPipeline| <http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/ChannelPipeline.html> getPipeline() { return |Channels| <http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/Channels.html>.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? Thanks and keep up the good work, Adam Kelloway
Hi Adam, On 4 May 2011 04:15, Adam Kelloway <adam.kelloway@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/Execut...: -------------- public class DatabaseGatewayPipelineFactory implements ChannelPipelineFactory {
private final ExecutionHandler executionHandler;
public DatabaseGatewayPipelineFactory(ExecutionHandler executionHandler) { this.executionHandler = executionHandler; }
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
-- david varnes e: david.varnes@gmail.com
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@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/Execut...: -------------- 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@newpace.ca +1 902-406-8375 x1031 www.newpace.ca
participants (2)
-
Adam Kelloway
-
david varnes