users@grizzly.java.net

Re: Performance test failing due to race condition problems

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Fri, 07 Mar 2008 14:37:08 -0500

Salut,

Simon Trudeau wrote:
> I am trying to concurrently connect to 2500 servers at a time using my
> client application. Unfortunately, I run into all sorts of instability
> issues:
>

On which platform are you. Those clients all try to connect to remove
server, right (no local server)?

>
>
> After connecting my 1268th client (it may vary) to the server, I get the
> following exception:
>
>
>
> Exception in thread "pool-1-thread-10"
> java.nio.channels.NotYetConnectedException
>
> at
> com.sun.grizzly.TCPConnectorHandler.write(TCPConnectorHandler.java:387)
>
> ...
>
> java.nio.channels.ClosedChannelException
>
> at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
>
> at
> com.sun.grizzly.TCPConnectorHandler.finishConnect(TCPConnectorHandler.java:565)
>
> at
> client.BtNIOClient$Connector$ClientCallBackHandler.onConnect(BtNIOClient.java:214)
>
>
>
> Running the same test I obtain also:

It seems your server close the connection before you have a chance to
finish the connect method.



>
>
>
> After connecting my 1253th client (it may vary) to the server, I get the
> following exception:
>
>
>
> java.nio.channels.ClosedChannelException
>
> at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(Unknown Source)
>
> at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
>
> at
> com.sun.grizzly.TCPConnectorHandler.write(TCPConnectorHandler.java:403)
>
> ...
>
> 7-Mar-2008 1:48:04 PM com.sun.grizzly.TCPConnectorHandler configureChannel
>
> WARNING: setTcpNoDelay exception
>
> java.net.SocketException: Connection reset by peer:
> sun.nio.ch.Net.setIntOption
>
> at sun.nio.ch.Net.setIntOption0(Native Method)
>
> at sun.nio.ch.Net.setIntOption(Unknown Source)
>
> at sun.nio.ch.SocketChannelImpl$1.setInt(Unknown Source)
>
> at sun.nio.ch.SocketOptsImpl.setBoolean(Unknown Source)
>
> at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(Unknown Source)
>
> at sun.nio.ch.OptionAdaptor.setTcpNoDelay(Unknown Source)
>
> at sun.nio.ch.SocketAdaptor.setTcpNoDelay(Unknown Source)
>
> at
> com.sun.grizzly.TCPConnectorHandler.configureChannel(TCPConnectorHandler.java:596)
>
> at
> com.sun.grizzly.TCPConnectorHandler.finishConnect(TCPConnectorHandler.java:567)
>
> at
> client.BtNIOClient$Connector$ClientCallBackHandler.onConnect(BtNIOClient.java:214)
>
> at
> com.sun.grizzly.CallbackHandlerContextTask.doCall(CallbackHandlerContextTask.java:66)
>
> at
> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
>
> at
> com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:179)


That one should not be the issue. How many file descriptor you machine
enable you right now:

% unlimit -l

>
>
>
> I also get for the same test
>
>
>
> After connecting my 1253th client (it may vary) to the server, I get the
> following exception:
>
>
>
> Exception in thread "pool-1-thread-5" java.lang.IllegalStateException:
> SelectorHandler not yet started
>
> at
> com.sun.grizzly.TCPSelectorHandler.acquireConnectorHandler(TCPSelectorHandler.java:778)
>
> at
> client.BtNIOClient$Connector.initConnector(BtNIOClient.java:181)
>
>
>
> What’s weird is that it always happens around my 1250-1260 th client…
>
>
>
> I am testing with both client and server using the same Controller.
> Tests are ran on a dual core intel machine. You need to run the
> performance test (ClientPerformanceTest.java performanceTest1()) a few
> times to get the exceptions, they don't occur on each run... which is
> weird but which is also consistent with the race condition problems I am
> encountering.
>
>
>
> I have attached my full source code with test to this mail so you can
> run my test and maybe some of you might help me figure out what I did wrong.
>
>
>
> To run the test, just include on the classpath the latest
> grizzly-framework and use java 6.

OK will try to take a look today....

-- Jeanfrancois




>
>
>
>
>
> Thanks,
>
>
>
>
>
> Simon
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net