Exception under heavy load when doing Boss.register.

Trustin Lee tlee at redhat.com
Fri Dec 12 05:57:54 EST 2008


Glad that it worked!  Please keep us updated with your ongoing feed
back. :)

Cheers,
Trustin

On Fri, Dec 12, 2008 at 07:34:49AM +0900, Wesly smith wrote:
> 
> Updated to the newest trunk (rev 608), punched with 500,000 connections, and
> the problem is gone.It is a nice fix, and thanks a lot for the work.
> 
> On Thu, Dec 11, 2008 at 4:23 PM, wesly smith0 <weslysmith0 at gmail.com> wrote:
> 
>> I will follow up when I try the newest (rev 608 today) version on svn.
>>
>>
>> On Thu, Dec 11, 2008 at 12:40 AM, Trustin Lee-2 (via Nabble) <
>> ml-user+63047-178166325 at n2.nabble.com<ml-user%2B63047-178166325 at n2.nabble.com>
>>> wrote:
>>
>>> Could you try the latest revision in the Subversion repository?  I have
>>> made significant improvement in NioClientSocketPipelineSink.
>>>
>>> HTH,
>>> Trustin
>>>
>>> On Thu, Dec 11, 2008 at 07:32:55AM +0900, Wesly smith wrote:
>>>>
>>>> Exception under heavy load when doing Boss.register, the stack trace is
>>> the
>>>> below.
>>>>
>>>> I saw those NPE under the load > 1500 connections/seconds for about 4K
>>>> content as request. The code actually is a client code which connects
>>> out to
>>>> a backend http server.
>>>>
>>>> I am using Netty 3.1.0.ALPHA2 .
>>>>
>>>> ====================
>>>> NioClientSocketChannel(id: 22f23fe5-011e-1000-ab7e-017cbfed9cbb) -
>>> (cause:
>>>> NullPointerException)
>>>>         java.lang.NullPointerException
>>>>         at
>>>> sun.nio.ch.EPollSelectorImpl.implRegister(EPollSelectorImpl.java:144)
>>>>         at sun.nio.ch.SelectorImpl.register(SelectorImpl.java:115)
>>>>         at
>>>>
>>> java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:180)
>>>
>>>>         at
>>>>
>>> org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.register(NioClientSocketPipelineSink.java:211)
>>>
>>>>         at
>>>>
>>> org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.connect(NioClientSocketPipelineSink.java:154)
>>>
>>>>         at
>>>>
>>> org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:106)
>>>
>>>>         at org.jboss.netty.channel.Channels.connect(Channels.java:554)
>>>>         at
>>>>
>>> org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:166)
>>>>         at
>>>>
>>> org.jboss.netty.bootstrap.ClientBootstrap$Connector.channelOpen(ClientBootstrap.java:269)
>>>
>>>>         at
>>>> org.jboss.netty.channel.Channels.fireChannelOpen(Channels.java:189)
>>>>         at
>>>>
>>> org.jboss.netty.channel.socket.nio.NioClientSocketChannel.<init>(NioClientSocketChannel.java:88)
>>>
>>>>         at
>>>>
>>> org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory.newChannel(NioClientSocketChannelFactory.java:145)
>>>
>>>>         at
>>>>
>>> org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory.newChannel(NioClientSocketChannelFactory.java:92)
>>>
>>>>         at
>>>>
>>> org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:224)
>>>>         at
>>>>
>>> org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:190)
>>>>         at
>>>>
>>> com.acme.test.http.netty.ia.InvocationAgentImpl.handleRequest(InvocationAgentImpl.java:127)
>>>
>>>>         at
>>>>
>>> com.acme.runtime.ep.ia.impl.AsynchronousRequestProcessor$3.doInContext(AsynchronousRequestProcessor.java:186)
>>>
>>>>         at
>>>>
>>> com.acme.runtime.ep.impl.MessageContextImpl.doInUserContext(MessageContextImpl.java:92)
>>>
>>>>         at
>>>>
>>> com.acme.runtime.ep.ia.impl.AsynchronousRequestProcessor.doProcess(AsynchronousRequestProcessor.java:181)
>>>
>>>>         at
>>>>
>>> com.acme.runtime.ep.ia.impl.RequestProcessor$1.doInContext(RequestProcessor.java:255)
>>>
>>>>         at
>>>>
>>> com.acme.runtime.ep.impl.MessageContextImpl.doInContext(MessageContextImpl.java:70)
>>>
>>>>         at
>>>>
>>> com.acme.runtime.ep.ia.impl.RequestProcessor.doProcess(RequestProcessor.java:206)
>>>
>>>>         at
>>>>
>>> com.acme.runtime.ep.ia.impl.RequestProcessor.doProcess(RequestProcessor.java:60)
>>>
>>>>         at
>>>>
>>> com.acme.runtime.ep.impl.seda.BaseProcessor.process(BaseProcessor.java:89)
>>>>         at com.acme.tc.seda.Stage$Worker.run(Stage.java:249)
>>>>         at
>>>>
>>> com.acme.tc.seda.LinkedListExecutor$Worker.run(LinkedListExecutor.java:300)
>>>>         at java.lang.Thread.run(Thread.java:619)
>>>>
>>>> The code snip I used:
>>>> =======================
>>>> NioClientSocketChannelFactory  factory = new
>>>> NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors
>>>
>>>> .newCachedThreadPool());
>>>> ClientBootstrap client = new ClientBootstrap(factory);
>>>> client.setPipelineFactory(new PipelineFactory(getComponentContext()));
>>>> client.setOption("tcpNoDelay", true);
>>>> client.setOption("keepAlive", true);
>>>>
>>>> final String host = StringUtils.trimToNull(getConfig().get("hostName"));
>>>
>>>> if (host == null)
>>>> {
>>>> getLogger().error("hostname property required");
>>>> throw new Exception("hostName property required");
>>>> }
>>>> final String port = StringUtils.trimToNull(getConfig().get("port"));
>>>> if (host == null)
>>>> {
>>>> getLogger().error("Port property required");
>>>> throw new Exception("port property required");
>>>> }
>>>>
>>>> SocketAddress staticAddress = new InetSocketAddress(host,
>>>> Integer.parseInt(port));
>>>>
>>>> ...
>>>>
>>>> ChannelFuture future = client.connect(staticAddress);  // This is the
>>> line
>>>> where gets the NPE, it is the source referred above as:
>>>> InvocationAgentImpl.java:127
>>>>
>>>> future.addListener(new ChannelFutureListener()
>>>> {
>>>> @Override
>>>> public void operationComplete(ChannelFuture future) throws Exception
>>>> {
>>>> if (!future.isSuccess())
>>>> {
>>>> getLogger().error(future.getCause().toString());
>>>> // etc ... XXXXX ...
>>>> }
>>>> else
>>>> {
>>>> Channel c = future.getChannel();
>>>> c.write(http);
>>>> }
>>>> }
>>>> });
>>>>
>>>> // Also after each message
>>>> // after we send the response, we close the channel associated with this
>>>
>>>> event.
>>>> event.getChannel().close();
>>>> in the callback function: void messageReceived(final
>>> ChannelHandlerContext
>>>> chctx, final MessageEvent event)
>>>>
>>>
>>> --
>>> Trustin Lee, Principal Software Engineer, JBoss, a division of Red Hat
>>> --
>>> what we call human nature in actuality is human habit
>>> --
>>> http://gleamynode.net/
>>>
>>>
>>
> 
 
-- 
Trustin Lee, Principal Software Engineer, JBoss, a division of Red Hat
--
what we call human nature in actuality is human habit
--
http://gleamynode.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/netty-dev/attachments/20081212/e6264cbc/attachment.bin 


More information about the netty-dev mailing list