• Praveenkumar Hulakund's avatar
    Bug#14003080:65104: MAX_USER_CONNECTIONS WITH PROCESSLIST EMPTY · b2c3acc9
    Praveenkumar Hulakund authored
    Analysis:
    -------------
    If server is started with limit of MAX_CONNECTIONS and 
    MAX_USER_CONNECTIONS then only MAX_USER_CONNECTIONS of any particular
    users can be connected to server and total MAX_CONNECTIONS of client can
    be connected to server.
    
    Server maintains a counter for total CONNECTIONS and total CONNECTIONS 
    from particular user.
    
    Here, MAX_CONNECTIONS of connections are created to server. Out of this
    MAX_CONNECTIONS, connections from particular user (say USER1) are
    also created. The connections from USER1 is lesser than 
    MAX_USER_CONNECTIONS. After that there was one more connection request from
    USER1. Since USER1 can still create connections as he havent reached
    MAX_USER_CONNECTIONS, server increments counter of CONNECTIONS per user.
    As server already has MAX_CONNECTIONS of connections, next check to total
    CONNECTION count fails. In this case control is returned WITHOUT 
    decrementing the CONNECTIONS per user. So the counter per user CONNECTIONS goes
    on incrementing for each attempt until current connections are closed. 
    And because of this counter per CONNECTIONS reached MAX_USER_CONNECTIONS. 
    So, next connections form USER1 user always returns with MAX_USER_CONNECTION 
    limit error, even when total connection to sever are less than MAX_CONNECTIONS.
    
    Fix:
    -------------
    This issue is occurred because of not handling counters properly in the
    server. Changed the code to handle per user connection counters properly.
    b2c3acc9
sql_acl.cc 292 KB