Exception under heavy load when doing Boss.register.

Wesly smith weslysmith0 at gmail.com
Thu Dec 11 17:23:35 EST 2008


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/
>
>
> _______________________________________________
> netty-dev mailing list
> netty-dev at ...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=1642169&i=0>
> https://lists.jboss.org/mailman/listinfo/netty-dev
>
> *attachment0* (204 bytes) Download Attachment<http://n2.nabble.com/attachment/1642169/0/attachment0>
>
>
> ------------------------------
>  This email is a reply to your post @
> http://n2.nabble.com/Exception-under-heavy-load-when-doing-Boss.register.-tp1640932p1642169.html
> You can reply by email or by visting the link above.
>
>

-- 
View this message in context: http://n2.nabble.com/Exception-under-heavy-load-when-doing-Boss.register.-tp1640932p1645478.html
Sent from the Netty Developer Group mailing list archive at Nabble.com.




More information about the netty-dev mailing list