Java apps slow startup when connected to network

2

I'm using Arch Linux with kernel 3.0 and brcmsmac to manage my wireless card. My desktop environment is KDE 4.7 and I use networkmanager to handle network. Recently I've been affected by a weird problem wherein whenever I'm connected to a network Java apps such as jEdit take ~30 seconds longer to start but behave normal once started. What could it be due to and how can I fix it?

EDIT:The problem occurs both with Oracle's JRE and OpenJDK, both versions 1.7. I'm behind a HTTP proxy, if that makes a difference.

EDIT:I've discovered the cause of this problem. My /etc/hosts file had the wrong host name in it. After correcting this to my hostname, everything is fine. I realized it was due to DNS thanks to bahamat's excellent answer. I still don't understand why exactly only Java apps were affected but it is fixed anyway.

Sudarshan S

Posted 2011-08-11T16:48:29.913

Reputation: 133

Answers

1

Have you tried looking here?

Q: Why is jEdit so slow to start up?

A: Some plugins require a lot of setup - chances are if you disable one, you will be able to determine the culprit. jEdit normally starts up quite quickly without plugins

  1. To go the Utilities menu and select Activity Log.
  2. Scroll to the area where you see lines like “[notice] JARClassLoader: Starting plugin XXX”.

Your symptoms sound like a DNS timeout though. On Debian sun-java-jre depends on avahi (which is used for mDNS). Perhaps you have a plugin that's trying to do a DNS lookup that's timing out.

bahamat

Posted 2011-08-11T16:48:29.913

Reputation: 5 130

Thanks! But it cant be that because when I'm disconnected from the net, jedit starts within 5 seconds. Its only that when I'm connected it takes ~45 seconds to start. I'll check it anyway – Sudarshan S – 2011-08-11T17:52:56.750

Added some more info for you. – bahamat – 2011-08-11T17:55:54.080

I checked the activity log. Nothing seems to take more than about 100ms. BTW, I tried out Netbeans, which also has a similar extra delay of ~45 secs more if I'm online compared to when I'm offline. How can I be sure if it is a DNS issue and what can I do to resolve it if so? – Sudarshan S – 2011-08-11T18:02:07.953