Uploaded image for project: 'Percona Server'
  1. Percona Server
  2. PS-3429

LP #1580227: Killed connection threads might get their sockets closed twice on shutdown

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None

      Description

      **Reported in Launchpad by Laurynas Biveinis last update 12-05-2016 13:04:26

      This shows up as a Valgrind warning

      ==18197== Warning: invalid file descriptor -1 in syscall close()
      ==18197== at 0x5F6E5BD: ??? (syscall-template.S:84)
      ==18197== by 0xF95F34: inline_mysql_socket_close (mysql_socket.h:1090)
      ==18197== by 0xF96AF3: vio_shutdown (viosocket.c:490)
      ==18197== by 0x7C6BE0: THD::disconnect() (sql_class.cc:2057)
      ==18197== by 0x637486: close_connection(THD*, unsigned int) (mysqld.cc:2886)
      ==18197== by 0x7D63E3: do_handle_one_connection(THD*) (sql_connect.cc:1547)
      ==18197== by 0x7D5E57: handle_one_connection (sql_connect.cc:1444)
      ==18197== by 0xB98416: pfs_spawn_thread (pfs.cc:1860)
      ==18197== by 0x5F656F9: start_thread (pthread_create.c:333)
      ==18197== by 0x6B22B5C: clone (clone.S:109)

      on e.g.

      rpl.rpl_semi_sync_shutdown_hang 'mix' [ fail ] Found warnings/errors in server log file!
      rpl.rpl_gtid_mts_relay_log_recovery_auto_pos_on_off 'mix' w3 [ fail ] Found warnings/errors in server log file!
      rpl.rpl_report_port 'mix' w1 [ fail ] Found warnings/errors in server log file!
      rpl.rpl_recovery_replicate_same_server_id 'mix' w4 [ fail ] Found warnings/errors in server log file!
      rpl.rpl_change_master_crash_safe 'mix' w2 [ fail ] Found warnings/errors in server log file!
      rpl.rpl_change_master 'mix' w1 [ fail ] Found warnings/errors in server log file!
      rpl.rpl_alter_repository 'mix' w3 [ fail ] Found warnings/errors in server log file!
      rpl.rpl_gtid_deployment_step 'mix' w1 [ fail ] Found warnings/errors in server log file!
      rpl.rpl_recovery_replicate_same_server_id 'row' w4 [ fail ] Found warnings/errors in server log file!
      main.mysql_client_test w4 [ fail ] Found warnings/errors in server log file!
      auth_sec.mysql_native_plugin w3 [ fail ] Found warnings/errors in server log file!

      The reason is that THD::disconnect is getting called twice, once from server thread-killing thread:
      kill_server_threads -> kill_server -> close_connections -> close_connection -> THD::disconnect;
      and the second time from the query thread itself, as in the above stacktrace.

        Smart Checklist

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                lpjirasync lpjirasync (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: