mysql connections timing out



  • Hi there,

    I noticed recurring timeouts of mysql connections on my server. Here is my process list:

    +-------+--------+-----------+--------+---------+------+----------+------------------+
    | Id    | User   | Host      | db     | Command | Time | State    | Info             |
    +-------+--------+-----------+--------+---------+------+----------+------------------+
    | 11511 | kopano | localhost | kopano | Sleep   | 1319 |          | NULL             |
    | 11513 | kopano | localhost | kopano | Sleep   | 1319 |          | NULL             |
    | 11514 | kopano | localhost | kopano | Sleep   | 1319 |          | NULL             |
    | 11515 | kopano | localhost | kopano | Sleep   |   24 |          | NULL             |
    | 11516 | kopano | localhost | kopano | Sleep   |    4 |          | NULL             |
    | 11517 | kopano | localhost | kopano | Sleep   |   25 |          | NULL             |
    | 11518 | kopano | localhost | kopano | Sleep   |   14 |          | NULL             |
    | 11519 | kopano | localhost | kopano | Sleep   |    4 |          | NULL             |
    | 11520 | kopano | localhost | kopano | Sleep   |   19 |          | NULL             |
    | 11521 | kopano | localhost | kopano | Sleep   |    9 |          | NULL             |
    | 11522 | kopano | localhost | kopano | Sleep   |   14 |          | NULL             |
    | 11523 | kopano | localhost | kopano | Sleep   |    9 |          | NULL             |
    | 11565 | kopano | localhost | kopano | Sleep   | 1221 |          | NULL             |
    | 11566 | kopano | localhost | kopano | Sleep   |  109 |          | NULL             |
    | 12017 | root   | localhost | NULL   | Query   |    0 | starting | show processlist |
    +-------+--------+-----------+--------+---------+------+----------+------------------+
    

    As you can see, four connections are starting to run towards a timeout (which is set to 8 hours as the mysql server default). Looking at the mysql error log I can see those timeouts happening indeed, mostly three at a time.

    2019-08-21T19:22:26.697198Z 2 [Note] Aborted connection 2 to db: 'kopano' user: 'kopano' host: 'localhost' (Got timeout reading communication packets)
    2019-08-21T19:22:26.700024Z 4 [Note] Aborted connection 4 to db: 'kopano' user: 'kopano' host: 'localhost' (Got timeout reading communication packets)
    2019-08-21T19:22:26.776091Z 5 [Note] Aborted connection 5 to db: 'kopano' user: 'kopano' host: 'localhost' (Got timeout reading communication packets)
    
    

    I don’t think this imposes any problem but I am curious what might be the reason for this behaviour.

    mysql 5.7.27
    Kopano 8.7.5
    Ubuntu 18.04



  • Hi,

    I have the same effect on MariaDB with the newest Kopano DEV packages.

    Best regards,

    Ihon


  • Kopano

    Hi @genesis74,

    that seems odd. Since you have a subscription, did you get in contact with our support regarding this?



  • Hi @fbartels ,

    no, I didn‘t. Since I have a small installation with only minimum support time I do not want to use it for optimization purpose. Also, I do not expect it to be solved in 30 mins.



  • It is conceivable that some threads of kopano-server never get a chance to process any work items, a result of which can be that the mysql connection that belongs to that worker thread accrues long idle times.



  • Hi @jengelh,

    your post led me to trying to reduce the number of kopano server threads. The result is that the number of mysql connections shown by the mysql process list is decreasing - but the number of connections staying idle for a long time remains constant. Even with only one kopano server thread there are 5 connections to mysql with 3 ones having long idle times and one where the idle time is reset only intermittently. Searching on the web points me to suggestions to check the client code for clean connection handling, especially connection closing. Well … I was hoping to find out if this effect is only happening on very few systems (or only mine) or if it is a common issue. At least @lhon seems to encounter that effect, too.



  • I see nothing wrong here. Yes, connections will run into timeouts (obviously), but that is a normal and anticipated practice. k-server will just reconnect.


Log in to reply