Construction of a new ServerSocket taking abnormally long - ipv6-related

SUMMARY
It takes 180+ seconds to open a ServerSocket if IPv6 is present on the loopback device.
SYSTEM
Debian unstable
Linux desktop3.mgn 2.4.27-speakup #1 Fri Feb 25 15:43:38 EST 2005 i686 GNU/Linux
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
MORE INFO
Last place within PlainSocketImpl everything's alright is     /**
     * Load net library into runtime.
    static {
     java.security.AccessController.doPrivileged(
            new sun.security.action.LoadLibraryAction("net"));
     initProto();
    }After the call to initProto (which is a native method) it takes 180+ seconds for the last connect() call below (got i from running strace) to timeout:socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 5
listen(5, 1)                            = 0
getsockname(5, {sa_family=AF_INET6, sin6_port=htons(37753), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 0
socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 6
connect(6, {sa_family=AF_INET6, sin6_port=htons(37753), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=3221214872}, 24) = -1 ETIMEDOUT (Connection timed out)TEST PROGRAMimport java.net.*;
public class Test {
     public static void main(String[] args) {
          try {
               long start = System.currentTimeMillis();
               ServerSocket serverSocket = new ServerSocket(4445);  // <-- this is what takes abnormally long
               long stop = System.currentTimeMillis();
               System.out.println("stop - start = " + (stop - start));
          } catch (UnknownHostException e) {
               e.printStackTrace();
               System.exit(-1);
          } catch (java.io.IOException e) {
               e.printStackTrace();
               System.exit(-2);
}CASE "ON"# ip a show dev lo
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
$ java Test
stop - start = 189011CASE "OFF"# ip a del ::1/128 dev lo
# ip a show dev lo
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
$ java Test
stop - start = 18Commands executed to "turn ipv6 on/off":ip a del ::1/128 dev lo
ip a add ::1/128 dev loNo other programs show this delay. Is this a bug?

I think so, I've read something like that in BugParade.
Try Java5 or Java6 (Mustang) with your code.
--Marc                                                                                                                                                                                                                           

Similar Messages

  • LDAP Query from Java taking abnormally long

    Is there any reason why this query would take an abnormally long time? When I run the query from the command line it comes back practically instantly, but when I access it via Java it takes close to 30 seconds.
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.NamingEnumeration;
    import javax.naming.NamingException;
    import javax.naming.directory.Attribute;
    import javax.naming.directory.Attributes;
    import javax.naming.directory.DirContext;
    import javax.naming.directory.InitialDirContext;
    import javax.naming.directory.SearchControls;
    import javax.naming.directory.SearchResult;
    public class LDAPTest {
          * @param args
         public static void main(String[] args) {
              String username = System.getProperty("user.name");
              String LDAPServer = "ldap://ldap.myldapserver.net/";
              //String attribute = "";
              String query = "uid=" +username;
              Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
            env.put(Context.PROVIDER_URL, LDAPServer);
            DirContext context = null;
            NamingEnumeration enumeration = null;
              try {
                   context = new InitialDirContext(env);
                SearchControls ctrl = new SearchControls();
                ctrl.setSearchScope(SearchControls.SUBTREE_SCOPE);
                enumeration = context.search("", query, ctrl);
                //while (enumeration.hasMore()) {
                     SearchResult searchResult = (SearchResult) enumeration.next();
                    Attributes attributes = searchResult.getAttributes();
                    Attribute attr = attributes.get("cn");
                    String cn = (String) attr.get();
                    System.out.println(" Person Common Name = " + cn);
            } catch (NamingException e) {
                throw new RuntimeException(e);
            } finally {
                if (enumeration != null) {
                    try {
                         enumeration.close();
                    } catch (Exception e) {
                if (context != null) {
                    try {
                         context.close();
                    } catch (Exception e) {
    }

    njb7ty wrote:
    One way to speed it up is to only retreive those attributes your interested in via ctls.setReturningAttributes.
    Also, if you know what sub directories you want to look in, you can create a list of just those subdirectories and look through them one at a time via ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
    SearchControls ctls = new SearchControls();
    ctls.setReturningAttributes((String[])attrIDs.toArray(new String[attrIDs.size()]));
    //only look at the immediate folder level specified (not in sub-folders)
    ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);Hi, thanks. I tried these, unfortunately I don't know enough about ldap to set the onelevel_scope properly. I have narrowed it down as a combination of load and login issues. For example, in our test environment the java program returns instantly with anonymous. In our production environment it returns in about 30-40 seconds with no login credentials supplied. (it does allow anonymous access). I made sure I set the authentication to none when attempting to try this. But when I do an anonymous query from the command line via a ldapsearch program it pulls the results instantly. (i know it is anonymous because if I specify credentials it pulls back additional data). For some reason it just takes really long to resolve in our production environment if I try anonymous access and I haven't figured it out yet. When I supply login credentials to our production environment it comes back in under a fifth of a second.

  • Why is this new update taking sooooo long?

    why is iPhone 4s update taking so long?

    MKRR wrote:
    why is iPhone 4s update taking so long?
      Because all those people who said "I'll cleverly wait until the day after the initial release to download" are all piling on today.
    Seriously, the server loads will likely taper off by the weekend, if you want to wait.

  • Why is downloading new storage taking so long

    I brought som more storage for Iclou ,why is it taking so long for my storage to download ?

    It includes this with the available iCloud storage options on the iPhone.
    10GB - $20/year - 15 GB total iCloud storage.
    20GB - $40/year - 25 GB total iCloud storage.
    50GB - $100/year - 55 GB total iCloud storage.
    Not sure how someone can equate "total iCloud storage" to increasing the iPhone's storage capacity, but the following is included - contact Apple for a full refund within 15 days of an upgrade or within 45 days after a yearly payment. Partial refunds are available where required by law.

  • Why are my new pages taking so long to open in new tab.

    When I try to open a new address in a new tab it takes 20-30 seconds (or more) to load and open.
    Windows 7 premium. Firefox Mozilla (most recent,18).

    Please make sure you have version 18.0.2 and that you have tried clearing cache and cookies.
    Many site issues can be caused by corrupt cookies or cache. In order to try to fix these problems, the first step is to clear both cookies and the cache.
    Note: ''This will temporarily log you out of all sites you're logged in to.''
    To clear cache and cookies do the following:
    #Go to Firefox > History > Clear recent history or (if no Firefox button is shown) go to Tools > Clear recent history.
    #Under "Time range to clear", select "Everything".
    #Now, click the arrow next to Details to toggle the Details list active.
    #From the details list, check ''Cache'' and ''Cookies'' and uncheck everything else.
    #Now click the ''Clear now'' button.
    Further information can be found in the [[Clear your cache, history and other personal information in Firefox]] article.
    Did this fix your problems? Please report back to us!

  • HT4859 Why is my backup to my new iphone taking so long. Ive downloaded all the apps, pictures, all settings are back, all contacts are there, all itunes and videos are there. What does Icloud have left to download?

    I just got a new replacement Iphone 4s and am trying to back up my IPhone 4s from Icloud and it still says that it is restoring the phone. The issue is that its taken a total of maybe 6 hours and all my apps have been downloaded, all photos have been restored, all settings and contacts restored, all itunes music and videos have been restored. Question is, it still says that the phone is restoring, so what exactly is it still restoring??

    That is ironic, but apparently Apple server is "locked" for restore process for three days. During that time it may say it is restoring even past the actual restore time. I have seen where someone successfully stopped that process, by changing apple id password, and where that didn't help to stop process. But 3 days from restore start, that should time out.
    Credit goes to Randers, he is the one who gave that info about three days, but I was also able to verify that myself.

  • Why is it taking so long to download iCloud onto new phone

    Why is it taking so long to download my iCloud onto new phone

    What does download iCloud mean? You don't download iCloud. You download the content that is in your iCloud backup to your phone. If you have a great deal of content in the backup, it can take a good bit of time.
    Define "so long". That doesn't mean anything to anybody here. It's a relative term and we have no idea how much time "so long" is to you.

  • I just downloaded the new update for itunes and the itunes store wont open up it is taking a long time it still hasnt loaded since 5pm

    i just downloaded the new update for itunes and the itunes store wont open up it is taking a long time it still hasnt loaded since 5pm, i also cant sighn in either it just keeps on saying accessing itunes....

    Close your iTunes,
    Go to command Prompt -
    (Win 7/Vista) - START/ALL PROGRAMS/ACCESSORIES, right mouse click "Command Prompt", choose "Run as Administrator".
    (Win XP SP2 &amp; above) - START/ALL PROGRAMS/ACCESSORIES/Command Prompt
    In the "Command Prompt" screen, type in
    netsh winsock reset
    Hit "ENTER" key
    Restart your computer.
    If you do get a prompt after restart windows to remap LSP, just click NO.
    Now launch your iTunes and see if it is working now.
    If you are still having these type of problems after trying the winsock reset, refer to this article to identify which software in your system is inserting LSP:
    iTunes 10.5 for Windows: May see performance issues and blank iTunes Store
    http://support.apple.com/kb/TS4123?viewlocale=en_US

  • Transferring to my new iMac from my MacBook is taking a long time. Is this normal?

    Transferring from my old MacBook to my me iMac is taking a long time. Is this normal?

    See Pondini's Setup New Mac guide for starters.

  • What is taking so long with the new Cabinet

    I have been waiting for Infinity now for what seems ages.
    The new Infinity cabinet was installed back in early November, the estimated date for cabinet activiation was Sept 2011, then Dec 2011 and now March 2012.
    What can be taking so long with getting this cabinet up and running, at the end of this month is it close on 4 months. I havent seen any activity around the cabinet for some time, other cabinets in the area were installed and were available to accept orders within a month.
    I have tried calling and I just get given the date as possibly March, is there any way to get a more accurate date, is there a problem with the cabinet, a problem with power?
    For some reason the cabinet has been installed on the opposite side of the road to the existing BT cabinet which I thought was a little strange, as surly that makes it a little more hard work to get online and reroute cables etc.
    I live in Skelmersdale and I believe the Cabinet is 46.
    If anyone is able to provide any more information on this I would appreciated it.

    There's lots of possibilities.
    There could be a delay in supplier equipment (MSAN to go in the cab)
    Ducting could be collapsed so they can't get the fiber to the cab until that's replaced.
    The power company could be causing delays to power the cabinet up.
    Road works may be needed to connect the FTTC cabinet to the existing cabinet.
    There's a couple more reasons it could be delayed too.
    If you want to say thanks for a helpful answer,please click on the Ratings star on the left-hand side If the the reply answers your question then please mark as ’Mark as Accepted Solution’

  • Why is apple taking so long to ship the new iphone 5

    why is the iphone five taking so long to ship

    When iphone orders go over the number of units produced, they have to wait until they fill up the inventory before shipping.

  • Why is my new MacBook Pro taking so long to start and the shuts down as soon as it completely loads?

    Why is my MacBook Pro taking so long to load and then shutting down?

    Sorry no one answered.  Do you still need assistance?

  • My app taking an abnormally long time to download.

    I'm trying to download "Grand Theft Auto: San Andreas" and it is taking REALLY long to download, it's been about two days. Anything that could help it?

    If you go into the Purchases page of the App Store you should be able to monitor progress. If there is none, try quitting, maybe even restarting the Mac to force the session to close, then try to download again thru the Purchases page. There will be no charge as the initial download did not conclude successfully.

  • External hard drive taking really long time to reformat

    I'm reformatting a Seagate 2TB external hard drive that connects using USB 3.0 to my 2014 Macbook Pro (OS X 10.9.4).
    For some idiotic reason (because I had never used it before and wanted to see what happened), when I went to reformat the drive in Disk Utility from FAT32 into 'Mac OS Journaled (Extended)' I selected the option for "7 Pass Secure Erase".  It initially told me it should take "1 day, 7 hours", which seemed like a lot but was consistent with what other Support Communities people have said for such a large drive.
    It's now been reformatting for 20 hours, and the estimated time remaining says "1 day, 1 hour".  The progress bar has moved and it says it's on pass #3, but this seems like it's taking an abnormally long time.  Has something gone wrong?  For reference, I did a 1-pass into reformat into FAT32 on a similar 1TB external and it only took me around 20 minutes (so I estimated the new one would take ~5 hours (20 * ~2X storage space, 7 passes). I know "estimated time" on a computer always defies the laws of mathematics, but if "6 hours" is actually 20 hours, will I really be waiting for another 80 hours?  Can I do anything to speed this up?
    More importantly, can I stop the reformat and try it a gain with 1-pass, now that I've initiated the idiot way of doing it?  I don't want to screw the drive up or make it unreadable, it's brand new, but I don't want to have to leave my laptop on for the next 3 and a half days.
    Please help!  Thanks so much!

    SquareWarren wrote:
    I'm reformatting a Seagate 2TB external hard drive that connects using USB 3.0...
    ...I know "estimated time" on a computer always defies the laws of mathematics, but if "6 hours" is actually 20 hours, will I really be waiting for another 80 hours?  Can I do anything to speed this up?...
    I don't know which Seagate external you're using but my experience with a number of GoFlex externals has been that very little thought was given to ventilation, and, as a result, the drives tended to overheat. Watching the transfer rate using Activity Monitor during normal backup use, I found that after running a while and getting hot, the transfer rate went from MB's to KB's/sec. You're not actually transferring anything but the drive is being written to, so I'd expect the write speed to drop and what is already going to be a long process will just get longer. Sorry.

  • Database open (recovery) taking too long

    Hi,
    Ive been using your awesome BerkeleyDB Java Edition for a couple of years, and have been very happy with it.
    I am currently facing an issue with trying to open the database after a disk-full issue (which resulted in the database being unable to write, and hence not closed properly).
    While recovery seems to be operating, it has been taking an inordinate amount of time - 16 hours so far. My database has data of around 200GB, which inflated to over 450GB during deletion of entries, hence gobbling up all free space on disk.
    My questions are:
    * Should i continue to wait for recovery?
    * Is there any chance that recovery is looping?
    * Is there an easier way (DBDump?) to extract data from the database without having to perform recovery?
    Some other information that may help:
    * The recovery has decreased the size of the last significant file, and created 3 new files since it started running.
    * I have been monitoring the open files (using lsof), and they change every now and then to other files, though a good amount of its time is spent near the end of the database.
    Thus, i feel like recovery is running normally, just taking too long. Please let me know your opinion.
    A few other things i should mention regarding my issue:
    * The database was, till yesterday, running on bdb java 3.3.75. After running several hours of recovery, i upgraded to 4.1.10 (since i read about a possible recovery looping bug in one of the versions)
    * Once 4.1.10 started recovery, it spat out errors regarding the last 2 files. Only on deleting those 2 files (the last being 0 bytes, the 2nd-last being about 5k) did the recovery start. Note that the older 3.3.75's recovery never complained about those files. I can post the errors here if relevant.
    * Some of the jdb files (about 500 files out of the 47,000 files that make up the database) are 100 MB files, since i had experimented with larger sized files for a few days, then reverted the setting.
    Would any of these above affect a successful recovery?
    My setup is:
    OS:Linux CentOS 5.2, 64-bit, kernel 2.6.18-92.el5
    JVM: Sun Java 1.6.0_20, 64-bit
    Memory: 16 GB RAM, of which 8 GB is allocated to the java process (-Xmx8000M -Xms8000M)
    BDB cache set to use 6GB RAM (envconfig.setCacheSize(6000000000))
    Only the BDB basic API is being used (Environment, database, cursors). We do not use DPL, or HA features.
    Awaiting your kind response,
    Sushant A

    Hi Sushant,
    * Should i continue to wait for recovery?* Is there any chance that recovery is looping?>
    I'm not aware of a bug that would cause recovery to loop, however, you may want to take thread dumps to see if it is progressing. It isn't easy to tell, however, since each phase of recovery is in fact a loop. What you can tell easily from the thread dumps is whether recovery is blocked (completely stopped) for some reason. I don't know of a bug that would cause this, but it's something I would check for.
    Assuming it is not blocked, I suggest that you leave recovery running, and additionally (in parallel) try to obtain some information about your log. While recovery is running you can run the DbPrintLog utility, which does not itself run recovery. I suggest running the following command, which will tell us in general what your log looks like and in particular how far apart the checkpoints are:
    java -jar je-x.y.z.jar DbPrintLog -h <envHome> -S > <output>Please post the output.
    If checkpoints are not running in your application for some reason, or they are running very infrequently, this can cause VERY long recoveries. Unfortunately, you may have such a problem in your app and not be aware of it, until you crash and have to recover. To guard against this sort of thing in the future, you should keep an eye on the checkpoint frequency. EnvironmentStats.getNCheckpoints and getEndOfLog can together be used to tell how much log is written between checkpoints. We will also be able to see this from the DbPrintLog -S output.
    * Is there an easier way (DBDump?) to extract data from the database without having to perform recovery?DbDump normally runs recovery. DbDump with the -r or -R option does not run recovery, but has other drawbacks. With -r, a large amount of memory may be necessary to dump an accurate representation of your data set. If this fails because you run out of memory, -R can be used, but this will dump multiple versions of each record and it will be up to you to interpret the output.
    If regular recovery does not succeed, then DbDump -r is the next thing to try.
    Would any of these above affect a successful recovery?No, I don't believe so.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Adobe Flash Player problems

    Hi have installed latest version of Adobe Flash player but when i go to a site that ueses this app it says i need to down load latest version ? Can any one help me

  • How can I retrieve my address book data??

    I have an old Palm V.  My hotsync cable is bad, it won't sync any more.  And it won't charge the palm, which has been out of charge for, oh, maybe a year. So I've still used the Palm Desktop program, to keep track of my telephone numbers, etc.   Well

  • Submit Form Via Webmail Is Not Creating Email In Drafts Folder

    Bottom Line Up Front: PDF's Submit via Email (Webmail) is not creating the email in the Webmail account. What I am using: ============= * Adobe Acrobat Pro XI; however, I have a lot of users using Adobe Reader. * Yahoo! email What I am trying to do:

  • I cannot leave the first page of a series of slected websites 1, 2, 3 and so on, I always return to the same first page.

    When searching an item with Google, a page full of websites is presented, with on the bottom of the page a choice of more websites on the following pages: 1 2 3 4 5 (all with underscore). When I try to click the next page, always the first page is pr

  • License issue after System Restore

    Hello All, We are facing an issue while doing a system restore on Windows 2003 / MS SQL 2005 / SAP 4.7D EXT 110. We followed the System copy option using SAPInst to do our system restore. When SAPinst prompted for DB import we stopped the SAPINST Too