LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   3 minute delay with socket in java (http://www.linuxquestions.org/questions/slackware-14/3-minute-delay-with-socket-in-java-670341/)

mcnalu 09-16-2008 04:12 PM

3 minute delay with socket in java
 
I noticed that whenever a java application opens a socket there is a several minute delay. For example, netbeans takes ages to start up as it goes off to look for updates. I also noticed this in java apps that I've written.

For example, this simple test code:
Code:

            for (int i = 0; i < 5; i++) {
                long time_start = System.currentTimeMillis();
                Socket s = new Socket("192.168.1.1", 80);
                long time_end = System.currentTimeMillis();
                System.out.println("Time to open socket (ms): " + (time_end - time_start));
                s.close();
            }

prints out
Code:

Time to open socket (ms): 189088
Time to open socket (ms): 5
Time to open socket (ms): 2
Time to open socket (ms): 3
Time to open socket (ms): 2

The there is always a ~3 minute delay on the first opening of a socket in a java app. The above behaviour also occurs if the IP is outside my LAN.

I'm running slackware 12.1 behind a wireless router with NAT at home. I've tried static IP and DHCP and playing with the hosts and resolv.conf files, but to no avail. At work with the same laptop (wired router, NAT and different ISP) there is no problem.

Curiously, it worked fine at home and work when I was using the same laptop with slackware 11.

Any ideas would be most welcome before I remove all the hair on my head.

Edit: Seems to be this issue - http://bugs.sun.com/bugdatabase/view...bug_id=6483406

mcnalu 09-24-2008 02:08 AM

Problem solved. I had blacklisted ipv6 - it seems that was causing the 3 min 9s delay. I removed ipv6 from /etc/modprobe.d/blacklist and all was well again.

I had blacklisted it because of 5 sec delays in dns lookup (experienced before in slackware 11), but it seems that isn't a problem in my new slackware 12.1 setup.


All times are GMT -5. The time now is 02:03 PM.