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

mariadbd-multi stop shuts down the wrong server when [client] sets host= or protocol=tcp

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 13.3
    • 13.3
    • Scripts & Clients
    • None
    • Not for Release Notes
    • Q1/2027 Server Maintenance

    Description

      mariadbd-multi stop 2 can shut down a different server than server 2, and leave server 2 running. This happens when the user who runs mariadbd-multi has a [client] group in an option file (for example ~/.my.cnf) with host=127.0.0.1 or protocol=tcp.

      Test case

      BASEDIR=/test/mtest/MDEV-42003/MD031126-mariadb-13.2.0-linux-x86_64-opt
      TMPDIR=/tmp/i6            
      export HOME=$TMPDIR PATH=$BASEDIR/bin:$PATH
      mkdir -p $TMPDIR
      # TCP ports
      P2=4401; P3=4402
       
      for n in 2 3; do
        $BASEDIR/scripts/mariadb-install-db --no-defaults --basedir=$BASEDIR --datadir=$TMPDIR/d$n --auth-root-authentication-method=normal >/dev/null
      done
      cat > $TMPDIR/multi.cnf <<EOF
      [mariadbd_multi]
      mariadbd=$BASEDIR/bin/mariadbd
      mariadb-admin=$BASEDIR/bin/mariadb-admin
      user=root
      [mysqld2]
      datadir=$TMPDIR/d2
      socket=$TMPDIR/s2
      port=$P2
      bind-address=127.0.0.1
      pid-file=$TMPDIR/p2
      log-error=$TMPDIR/e2.err
      [mysqld3]
      datadir=$TMPDIR/d3
      socket=$TMPDIR/s3
      port=$P3
      bind-address=127.0.0.1
      pid-file=$TMPDIR/p3
      log-error=$TMPDIR/e3.err
      EOF
       
      mariadbd-multi --defaults-file=$TMPDIR/multi.cnf --no-log --silent start; sleep 5
      # Both servers must be running before the test
      for n in 2 3; do [ -S $TMPDIR/s$n ] && echo "server $n running" || echo "server $n did NOT start"; done
       
      # Client defaults of the user running mariadbd-multi: port of server 3
      printf '[client]\nhost=127.0.0.1\nport=%s\n' $P3 > $TMPDIR/.my.cnf
       
      mariadbd-multi --defaults-file=$TMPDIR/multi.cnf --no-log --silent --print-commands stop 2; sleep 5
      for n in 2 3; do [ -e $TMPDIR/p$n ] && echo "server $n running" || echo "server $n stopped"; done
      

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.5h
                  0.5h

                  Git Integration

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