-   Slackware (
-   -   3 minute delay with socket in java (

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:

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

prints out

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 -

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 10:16 PM.