Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SSL Handshake Takes 19 seconds -- Why?

843811Sep 28 2002 — edited Oct 8 2002
Folks, I'm having a problem using HttpsURLConnection to open a SSL session to a web server and with ONE webserver and ONE webserver only the SSL handshake takes 19 to 30 seconds. On all the other webservers the handshake takes only a few seconds. I'm tearing my hair out.

I've already over-ridden the defaultSSLSocketFactory with one that has a pre-seeded SecureRandom().

From a sniffer I see the other Webserver send his certificates then we wait 19 seconds then my client code sends out the SSL client hello.

Could someone please suggest what idiotic thing I could be doing wrong or what it could be?

Here's the output from the SSL trace and a thread dump. All help appreciated. As a reminder, it's only ONE webserver out of 100s that this hang occurs on.


SSL TRACE:
init context
trigger seeding of SecureRandom
done seeding SecureRandom
httpsUrlConnection.connect() // hangs around for 19 seconds
%% No cached client session
*** ClientHello, v3.1


THREAD DUMP:
Full thread dump Java HotSpot(TM) Client VM (1.4.1-b21 mixed mode):

"Signal Dispatcher" daemon prio=10 tid=0x008C5FE0 nid=0x738 waiting on condition [0..0]

"Finalizer" daemon prio=9 tid=0x0090F490 nid=0x780 in Object.wait() [ab5f000..ab5fd88]
at java.lang.Object.wait(Native Method)
- waiting on <02F27D30> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
- locked <02F27D30> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x0090E008 nid=0x7b8 in Object.wait() [ab1f000..ab1fd88]
at java.lang.Object.wait(Native Method)
- waiting on <02F27D98> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:426)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:113)
- locked <02F27D98> (a java.lang.ref.Reference$Lock)

"main" prio=5 tid=0x002354E8 nid=0x570 runnable [6f000..6fc3c]
at java.net.Inet4AddressImpl.getHostByAddr(Native Method)
at java.net.InetAddress$1.getHostByAddr(InetAddress.java:722)
at java.net.InetAddress.getHostFromNameService(InetAddress.java:464)
at java.net.InetAddress.getHostName(InetAddress.java:407)
at java.net.InetAddress.getHostName(InetAddress.java:379)
at java.net.InetSocketAddress.getHostName(InetSocketAddress.java:145)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.doConnect(DashoA6275)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:386)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:602)
- locked <02A55EC0> (a sun.net.www.protocol.https.HttpsClient)
at sun.net.www.protocol.https.HttpsClient.<init>(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.a(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.a(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.a(DashoA6275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.plainConnect(DashoA6275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect (DashoA6275)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(DashoA6275)
at HttpTester.getViaHTTP(HttpTester.java:306)
at HttpTester.<init>(HttpTester.java:105)
at HttpTester.main(HttpTester.java:119)

"VM Thread" prio=5 tid=0x0090CDD0 nid=0x14c runnable

"VM Periodic Task Thread" prio=10 tid=0x008C4390 nid=0x7c8 waiting on condition

"Suspend Checker Thread" prio=10 tid=0x008C55F8 nid=0x720 runnable
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 5 2002
Added on Sep 28 2002
10 comments
2,093 views