Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-19643

Invalid #ifndef WINDOWS causes error because of needless "Semisync slave socket fd" check

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.3.13, 10.3.14, 10.3.15
    • 10.3.17, 10.4.7
    • Replication
    • None
    • Windows

    Description

      On Windows, sometimes slave stops unexpectedlly. log shows the following error.

      > 2019-05-30 3:21:55 6 [ERROR] Semisync slave socket fd is 580. select()
      > cannot handle if the socket fd is greater than 64 (FD_SETSIZE).
      > 2019-05-30 3:21:55 6 [Note] Stopping ack receiver thread

      Searched MariaDB implementation, above log message is printed here.

      https://github.com/MariaDB/server/blob/dde2ca4aa108b611b5fdfc970146b28461ef08bf/sql/semisync_master_ack_receiver.h#L214-L222

      #ifndef WINDOWS
            if (socket_id > FD_SETSIZE)
            {
              sql_print_error("Semisync slave socket fd is %u. "
                              "select() cannot handle if the socket fd is "
                              "greater than %u (FD_SETSIZE).", socket_id, FD_SETSIZE);
              return 0;
            }
      #endif //WINDOWS
      

      It seems that #ifndef WINDOWS is incorrect, it should be _WIN32.
      Because of incorrect #ifndef definition, needless check is executed on Windows.

      It seems that master can't receive ack from slave, slave waits until master response, then it causes timeout and disconnect connection.(maybe)

      In contrast to MySQL case, it uses _WIN32.

      https://github.com/mysql/mysql-server/blob/8.0/plugin/semisync/semisync_master_socket_listener.h#L114-L120

      #ifndef _WIN32
            if (socket_id > FD_SETSIZE) {
              LogErr(ERROR_LEVEL, ER_SEMISYNC_FAILED_TO_HANDLE_SOCKET, socket_id,
                     FD_SETSIZE);
              return false;
            }
      #endif // _WIN32
      

      Attachments

        Activity

          People

            wlad Vladislav Vaintroub
            kenhys Kentaro Hayashi
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.