[Bug 1999711] Re: Snmptrapd cannot reconnect to MySQL server after hitting MySQL wait_timeout

Andreas Hasenack 1999711 at bugs.launchpad.net
Thu Feb 16 23:12:43 UTC 2023


I noticed a follow-up commit in the upstream git repo a week or so after
the original fix:

original fix:
commit 62b2907a46c9e495c1c71114cc8f18ed137b7f34
Author: Chengen Du <chengen.du at canonical.com>
Date:   Wed Nov 23 14:11:36 2022 +0800

    apps/snmptrap: Fix mysql reconnection after hitting wait_timeout
    
    MySQL v8.0 supports ER_CLIENT_INTERACTION_TIMEOUT, which is not handled
    in snmptrapd
    
    Signed-off-by: Chengen Du <chengen.du at canonical.com>


A few days later, this changes "bool" to "int":
commit a1c80f7778da0aaadfb3fc44b213586f632d8d5d
Author: Bart Van Assche <bvanassche at acm.org>
Date:   Mon Dec 5 19:19:40 2022 -0800

    apps/snmptrapd_sql: Fix a recently introduced build error
    
    Fixes: 62b2907a46c9 ("apps/snmptrap: Fix mysql reconnection after hitting wait_timeout")

I vaguely remember a mysql build issue when mysql 8 came along, where
mysql stopped exporting my_bool iirc. I see we use "bool" all the way to
focal, and then in bionic use "int". And the patch correctly flags that
bionic change as being a backport.


Can you detail the test case a bit more, for those not familiar setting up snmp traps? I'll sponsor lunar, but a more detailed step by step test case for the SRU would be great.

-- 
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1999711

Title:
  Snmptrapd cannot reconnect to MySQL server after hitting MySQL
  wait_timeout

Status in net-snmp package in Ubuntu:
  In Progress
Status in net-snmp source package in Bionic:
  In Progress
Status in net-snmp source package in Focal:
  In Progress
Status in net-snmp source package in Jammy:
  In Progress
Status in net-snmp source package in Kinetic:
  In Progress
Status in net-snmp source package in Lunar:
  In Progress

Bug description:
  [Impact]
  wait_timeout is the number of seconds the MySQL server waits for activity before closing the connection.
  MySQL v8.0.24 writes the reason for the connection before closing it, and the client receives a more informative error message (ER_CLIENT_INTERACTION_TIMEOUT).
  Snmptrapd does not handle this error code, so the connection will not reconnect to the MySQL server afterward.

  [Test Plan]
  1. Setup MySQL server and modify wait_timeout to 15 in /etc/MySQL/mysql.conf.d/mysqld.cnf
  2. Setup snmptrapd and execute snmptrap command
  3. Sleep 15 seconds and re-execute snmptrap command, then the connection will fail until the snmptrapd service restarted

  [Where problems could occur]
  Once the error happens, snmptrapd will keep the sql commands and resend it after reconnecting to the MySQL server.
  The regression can be considered as low.

  [Other Info]

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/net-snmp/+bug/1999711/+subscriptions




More information about the Ubuntu-sponsors mailing list