HTTPs load cause exception in client side

Pankaj Bathwal pankaj.bathwal at agnity.com
Thu Jun 17 11:35:25 EDT 2010


Thanks for responses.

Trustin,
I am running server and client on the same windows machine so I am not sure
if it is a firewall issue but may be you are correct; also strange thing is
that my request completes successfully.

Marc-Andre,
(I am new to Netty - 3 week, Please correct me if I am wrong)
Pipeline Factory is used for providing separate handlers to the pipeline
which I am doing myself in the loop. Also I need to pass some parameter to
my Request Handler which factory does not allow me to do. So I am not using
the factory.

Anyways I tried my test on Linux machine, now strangely I am getting
different exception and again even if exception is thrown my request
completes successfully. 

Here is the stack trace of new exception:
javax.net.ssl.SSLException: Received fatal alert: internal_error
        at
com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
        at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1366)
        at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1334)
        at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1496
)
        at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:967
)
        at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:
793)
        at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:669)
        at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:607)
        at
org.jboss.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:757)
        at
org.jboss.netty.handler.ssl.SslHandler.decode(SslHandler.java:491)
        at
org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.jav
a:282)
        at
org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecode
r.java:216)
        at
org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:345)
        at
org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:332)
        at
org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:323)
        at
org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.j
ava:275)
        at
org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:196)
        at
org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
va:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
08)
        at java.lang.Thread.run(Thread.java:619)


Thanks,
Pankaj


-----Original Message-----
From: netty-users-bounces at lists.jboss.org
[mailto:netty-users-bounces at lists.jboss.org] On Behalf Of Marc-André
Laverdière
Sent: Thursday, June 17, 2010 6:26 PM
To: Netty Users
Subject: Re: HTTPs load cause exception in client side

I am wondering if not using a separate pipeline factory isn't messing
things up too.

Marc-André LAVERDIÈRE
"Perseverance must finish its work so that you may be mature and
complete, not lacking anything." -James 1:4
mlaverd.theunixplace.com/blog

 /"\
 \ /    ASCII Ribbon Campaign
  X      against HTML e-mail
 / \



2010/6/17 "??? (Trustin Lee)" <trustin at gmail.com>:
> I guess that might be:
>
>
http://stackoverflow.com/questions/1477003/an-established-connection-was-abo
rted-by-the-software-in-your-host-machine
>
> "The connection was being dropped by some switch because the machine
> bandwidth was too high (above the limit)"
>
> Maybe you generated too much traffic and Windows thought your
> application is a worm? :)
>
> Trustin
>
> On 06/17/2010 04:34 PM, Pankaj Bathwal wrote:
>>
>>
>> I am using Netty 3.1.5 GA on Windows XP SP2 and JDK 1.6
>>
>>
>>
>> I have made a HTTPS Server and HTTPs Client using Netty and now I want
>> to do some load testing.
>>
>>
>>
>> My code for load generation is given below;
>>
>> Rest of the code like “HttpResponseHandler” and other has been copied
>> from example code “org.jboss.netty.example.http.snoop”.
>>
>> (I can send them if needed)
>>
>>
>>
>> Single request using this client works fine but running multiple request
>> leads to issue.
>>
>> After running few requests this load client starts printing some
>> exception and I don’t understand the cause of it.
>>
>> Please let me know what wrong I am doing in my client code
>>
>>
>>
>> Here is the stack trace of the exception that is printed:
>>
>>
>>
>> _java.io.IOException_: An established connection was aborted by the
>> software in your host machine
>>
>>       at sun.nio.ch.SocketDispatcher.read0(_Native Method_)
>>
>>       at sun.nio.ch.SocketDispatcher.read(Unknown Source)
>>
>>       at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
>>
>>       at sun.nio.ch.IOUtil.read(Unknown Source)
>>
>>       at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
>>
>>       at
>>
org.jboss.netty.buffer.HeapChannelBuffer.setBytes(_HeapChannelBuffer.java:15
6_)
>>
>>       at
>>
org.jboss.netty.buffer.AbstractChannelBuffer.writeBytes(_AbstractChannelBuff
er.java:425_)
>>
>>       at
>> org.jboss.netty.channel.socket.nio.NioWorker.read(_NioWorker.java:305_)
>>
>>       at
>>
org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(_NioWorker.
java:275_)
>>
>>       at
>> org.jboss.netty.channel.socket.nio.NioWorker.run(_NioWorker.java:196_)
>>
>>       at
>>
org.jboss.netty.util.internal.IoWorkerRunnable.run(_IoWorkerRunnable.java:46
_)
>>
>>       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
>> Source)
>>
>>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
>>
>>       at java.lang.Thread.run(Unknown Source)
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *_CODE executed in a thread to send HTTPS request in a loop._*
>>
>>
>>
>>
>>
>>       *public* *synchronized* *void* run()
>>
>>             {
>>
>>                   *int* lCount = 0;
>>
>>                   *while* (mShutdown == *false* && lCount <
mExecutionCount)
>>
>>                   {
>>
>>
>>
>>                         *try*
>>
>>                         {
>>
>>
>>
>>                           // Configure the client.
>>
>>                           ClientBootstrap bootstrap = *new*
ClientBootstrap(
>>
>>                                     /mClientSocketFactory/);
>>
>>
>>
>>                           ChannelPipeline pipeline =
>> bootstrap.getPipeline();
>>
>>
>>
>>                           SSLEngine engine =
>>
>>
>> HttpsServerSslContextFactory./getClientContext/().createSSLEngine();
>>
>>                           engine.setUseClientMode(*true*);
>>
>>
>>
>>
>>
>>                           pipeline.addLast("ssl", *new*
SslHandler(engine));
>>
>>                           pipeline.addLast("decoder", *new*
>> HttpResponseDecoder());
>>
>>                           pipeline.addLast("encoder", *new*
>> HttpRequestEncoder());
>>
>>                           pipeline.addLast("handler", *new*
>> HttpResponseHandler(
>>
>>                                                             lCount,
>> *true*));
>>
>>
>>
>>                           // Start the connection attempt.
>>
>>                           ChannelFuture future = bootstrap.connect(
>>
>>                                     *new* InetSocketAddress(mHost,
mPort));
>>
>>
>>
>>
>>
>>                           // Wait until the connection attempt succeeds
>> or fails.
>>
>>                           Channel channel =
>> future.awaitUninterruptibly().getChannel();
>>
>>
>>
>>                           *if* (!future.isSuccess()) {
>>
>>                               Thread./sleep/(100);
>>
>>                               ++lCount;
>>
>>                               *continue*;
>>
>>                           }
>>
>>
>>
>>                           URI uri = *new* URI(mURL);
>>
>>
>>
>>                           // Send the HTTP request.
>>
>>                           HttpRequest request = *new* DefaultHttpRequest(
>>
>>                                   HttpVersion./HTTP_1_1/,
HttpMethod./GET/,
>>
>>                                   uri.toASCIIString());
>>
>>
>>
>>                           request.setHeader(HttpHeaders.Names./HOST/,
>> mHost);
>>
>>
>>
>>                          
request.setHeader(HttpHeaders.Names./CONNECTION/,
>>
>>
>> HttpHeaders.Values./CLOSE/);
>>
>>
>>
>>                           CookieEncoder httpCookieEncoder = *new*
>> CookieEncoder(*false*);
>>
>>
>>
>>                           httpCookieEncoder.addCookie("my-cookie",
"foo");
>>
>>                           httpCookieEncoder.addCookie("another-cookie",
>> "bar");
>>
>>                           request.setHeader(HttpHeaders.Names./COOKIE/,
>>
>>
>>   httpCookieEncoder.encode());
>>
>>
>>
>>                           ChannelFuture writeChannel =
>> channel.write(request);
>>
>>
>>
>>                           writeChannel.awaitUninterruptibly();
>>
>>
>>
>>                           // Wait for the server to close the connection.
>>
>>                          
channel.getCloseFuture().awaitUninterruptibly();
>>
>>
>>
>>
>>
>>                         }
>>
>>                     *catch* (Exception e)
>>
>>                         {
>>
>>                         ++lCount;
>>
>>                         System./out/.println("HTTP Request failed : ");
>>
>>                         }
>>
>>
>>
>>                     *if* (++lCount >= *this*.mExecutionCount)
>>
>>                     {
>>
>>                         *break*;
>>
>>                     }
>>
>>
>>
>>                   }
>>
>>             }
>>
>>
>>
>> Thanks,
>>
>> Pankaj Bathwal
>>
>>
>>
>>
>>
>
> --
> what we call human nature in actuality is human habit
> http://gleamynode.net/
>
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>

_______________________________________________
netty-users mailing list
netty-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/netty-users




More information about the netty-users mailing list