Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MySQL reconnect option is not working with upgrade to mysql 8.0.26
Forum Updated to NodeBB v4.3 + New Features

MySQL reconnect option is not working with upgrade to mysql 8.0.26

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    IGIG
    wrote on 13 Oct 2021, 17:21 last edited by
    #1

    We are using Qt 5.12.8 with MySQL database on CentOS 7.
    So far we were using mysql 8.0.21 and in the code there is a call to set MYSQL_OPT_RECONNECT=1 before any connection is made which means if client detects connection drop it will attempt to reconnect.
    There are multiple threads which have connection open with MySQL database.
    It was working as expected until we upgraded to the latest mysql 8.0.26.
    After the upgrade we are getting errors: "The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior."
    It is indeed related to the wait_timeout in MySQL as if the wait_timeout reduced the error can be seen after a shorter time.
    We are also using QxOrm 1.4.7 but this layer hasn't changed and I believe it is transparently setting reconnect option as requested.
    Has anyone else experienced a similar problem?
    Any help will be much appreciated.

    J 1 Reply Last reply 13 Oct 2021, 17:27
    0
    • I IGIG
      13 Oct 2021, 17:21

      We are using Qt 5.12.8 with MySQL database on CentOS 7.
      So far we were using mysql 8.0.21 and in the code there is a call to set MYSQL_OPT_RECONNECT=1 before any connection is made which means if client detects connection drop it will attempt to reconnect.
      There are multiple threads which have connection open with MySQL database.
      It was working as expected until we upgraded to the latest mysql 8.0.26.
      After the upgrade we are getting errors: "The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior."
      It is indeed related to the wait_timeout in MySQL as if the wait_timeout reduced the error can be seen after a shorter time.
      We are also using QxOrm 1.4.7 but this layer hasn't changed and I believe it is transparently setting reconnect option as requested.
      Has anyone else experienced a similar problem?
      Any help will be much appreciated.

      J Online
      J Online
      JonB
      wrote on 13 Oct 2021, 17:27 last edited by
      #2

      @IGIG said in MySQL reconnect option is not working with upgrade to mysql 8.0.26:

      latest mysql 8.0.26.

      MYSQL_OPT_RECONNECT is a MySQL option, nothing Qt about it. So is this just an issue in the new MySQL version?

      1 Reply Last reply
      0
      • I Offline
        I Offline
        IGIG
        wrote on 13 Oct 2021, 17:42 last edited by IGIG
        #3

        I am not sure.
        Is MYSQL_OPT_RECONNECT=1 option just transferred from Qt sqldriver to MySQL client?
        Or is it handled by Qt sqldriver?

        It looks like there were some changes in MySQL 8.0.24 relevant to reconnection option: https://dev.mysql.com/doc/relnotes/connector-odbc/en/news-8-0-24.html

        J 1 Reply Last reply 13 Oct 2021, 17:47
        0
        • M Offline
          M Offline
          mchinand
          wrote on 13 Oct 2021, 17:44 last edited by
          #4

          Are you setting any of the connection options of your QSqlDatabase instance?

          I 1 Reply Last reply 14 Oct 2021, 10:51
          1
          • I IGIG
            13 Oct 2021, 17:42

            I am not sure.
            Is MYSQL_OPT_RECONNECT=1 option just transferred from Qt sqldriver to MySQL client?
            Or is it handled by Qt sqldriver?

            It looks like there were some changes in MySQL 8.0.24 relevant to reconnection option: https://dev.mysql.com/doc/relnotes/connector-odbc/en/news-8-0-24.html

            J Online
            J Online
            JonB
            wrote on 13 Oct 2021, 17:47 last edited by JonB
            #5

            @IGIG
            I would imagine (absolutely no proof!) Qt knows nothing about it and it's purely handed off to "MySQL client library" as per https://dev.mysql.com/doc/c-api/8.0/en/c-api-auto-reconnect.html. That is why I suspected your MySQL side, not Qt, especially since the former only has changed.

            ...But now @mchinand has pointed out it's in the Qt documentation, so maybe I'm wrong :) [Nah, I still don't think Qt does anything with them, that's just a suggested list of strings... You're passing it that way already anyway, aren't you?]

            1 Reply Last reply
            1
            • C Online
              C Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 13 Oct 2021, 18:52 last edited by
              #6

              See https://code.woboq.org/qt5/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp.html#1433 - nothing Qt can do against.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              I 1 Reply Last reply 14 Oct 2021, 11:02
              1
              • M mchinand
                13 Oct 2021, 17:44

                Are you setting any of the connection options of your QSqlDatabase instance?

                I Offline
                I Offline
                IGIG
                wrote on 14 Oct 2021, 10:51 last edited by
                #7

                @mchinand Yes, we do setup MYSQL_OPT_RECONNECT=1 via QxOrm like this:
                qx::QxSqlDatabase::getSingleton()->setConnectOptions("MYSQL_OPT_RECONNECT=1")
                And this option worked so far well with MySQL 8.0.21 but after update to MySQL 8.0.26 it does not anymore.

                1 Reply Last reply
                0
                • C Christian Ehrlicher
                  13 Oct 2021, 18:52

                  See https://code.woboq.org/qt5/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp.html#1433 - nothing Qt can do against.

                  I Offline
                  I Offline
                  IGIG
                  wrote on 14 Oct 2021, 11:02 last edited by
                  #8

                  @Christian-Ehrlicher Thank you. I've seen that and double checked that MYSQL_VERSION_ID is correct. It appears as 80026 on the latest MySQL 8.0.26.

                  1 Reply Last reply
                  0

                  1/8

                  13 Oct 2021, 17:21

                  • Login

                  • Login or register to search.
                  1 out of 8
                  • First post
                    1/8
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved