• Magne Mahre's avatar
    Bug#48929 Error in Accept() if using many file descriptors · 2d4687d0
    Magne Mahre authored
    In POSIX systems, the file descriptor set used in the select(2)
    system call is represented by a bit vector of size FD_SETSIZE.
    When select(2) is used on file/socket descriptors with a value
    that is beyond this size, unpredictable errors may occur.
    
    In this case, the error happens when there are a large number
    of tables that need repair.  These tables are opened before
    the sockets for incoming connections are acquired, resulting
    in these sockets getting descriptor id which is higher than
    FD_SETSIZE.
    
    Replacing the call to select(2) with poll(2) fixes the problem,
    as poll takes an array of the wanted descriptors, instead of
    a bit vector.  
    
    MS Windows has a different implementation of 'select', and is not
    affected by this bug.  
    
    
    configure.in:
      Added a test for the <poll.h> file
    sql/mysqld.cc:
      Restructured some of the code to reduce the number of
      #ifdef's.  Removed some HP/UX 10-specific code.
    2d4687d0
configure.in 98.6 KB