Exception under heavy load when doing Boss.register, the stack trace is the below.

Wesly smith weslysmith0 at gmail.com
Wed Dec 10 17:39:50 EST 2008


The layout of the previous post is so bad, Repost again
..... Sorry, please delete another same post.


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)

-- 
View this message in context: http://n2.nabble.com/Exception-under-heavy-load-when-doing-Boss.register%2C-the-stack-trace-is-the-below.-tp1640959p1640959.html
Sent from the Netty User Group mailing list archive at Nabble.com.




More information about the netty-users mailing list