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

[PATCH] MariaDB start script doesn't realize failure of MariaDB startup

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.0.12
    • Fix Version/s: 5.5.39, 10.0.13
    • Component/s: None
    • Labels:
      None
    • Environment:
      Linux testhost 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

      Description

      Startup script(support-files/mysql.server) does not realize failure of MariaDB startup. So Startup script waiting for $service_startup_timeout.

      [root@testhost mysql]# service mysql start
      Starting MySQL...........................................................................................................................................................................................^C

      This startup script call wait_for_ready() function after starting mysqld_safe.
      But mysqld process terminated before wait_for_ready() function is check the mysql server.
      So wait_for_ready() function loop during $service_startup_timeout seconds in spite of mysqld already terminated.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            Hi,

            Are you willing to propose a patch for this?

            Show
            elenst Elena Stepanova added a comment - Hi, Are you willing to propose a patch for this?
            Hide
            Matt74 Seunguck Lee added a comment - - edited

            Hi Elena.

            You already have known this. (I think) ^^.

            I don't know much about why MariaDB team changed original wait_for_pid to wait_for_ready.
            Anyway, What do you think about just checking existence of angel-process(mysqld_safe) together ?

            below snippet is "wait_for_ready" function I have changed.

            wait_for_ready () {
            
              i=0
              while test $i -ne $service_startup_timeout ; do
            
                if $bindir/mysqladmin ping >/dev/null 2>&1; then
                  log_success_msg
                  return 0
                fi
            
                echo $echo_n ".$echo_c"
                i=`expr $i + 1`
                sleep 1
            
                ## Check whether mysqld_safe is still alive
                if ! pgrep -P $$ >/dev/null 2>&1; then
                  ## If mysqld_safe process not exist, we assume starting mysqld failed
                  break
                fi
            
              done
            
              log_failure_msg
              return 1
            }
            

            Thanks.

            Show
            Matt74 Seunguck Lee added a comment - - edited Hi Elena. You already have known this. (I think) ^^. I don't know much about why MariaDB team changed original wait_for_pid to wait_for_ready. Anyway, What do you think about just checking existence of angel-process(mysqld_safe) together ? below snippet is "wait_for_ready" function I have changed. wait_for_ready () { i=0 while test $i -ne $service_startup_timeout ; do if $bindir/mysqladmin ping >/dev/null 2>&1; then log_success_msg return 0 fi echo $echo_n ".$echo_c" i=`expr $i + 1` sleep 1 ## Check whether mysqld_safe is still alive if ! pgrep -P $$ >/dev/null 2>&1; then ## If mysqld_safe process not exist, we assume starting mysqld failed break fi done log_failure_msg return 1 } Thanks.
            Hide
            elenst Elena Stepanova added a comment -

            I don't know much about why MariaDB team changed original wait_for_pid to wait_for_ready.

            It was done in scope of MDEV-5580. Here is the change:
            http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/4085

            Show
            elenst Elena Stepanova added a comment - I don't know much about why MariaDB team changed original wait_for_pid to wait_for_ready. It was done in scope of MDEV-5580 . Here is the change: http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/4085
            Hide
            Matt74 Seunguck Lee added a comment -

            Hi Elena.

            Then I think checking both of mysqldadmin ping and mysqld_safe process will be working.

            Thanks.

            Show
            Matt74 Seunguck Lee added a comment - Hi Elena. Then I think checking both of mysqldadmin ping and mysqld_safe process will be working. Thanks.
            Hide
            serg Sergei Golubchik added a comment - - edited

            Thanks for the idea. I've applied a slightly different patch:

            +    if kill -0 $! 2>/dev/null ; then
            +      :  # mysqld_safe is still running
            +    else
            +      # mysqld_safe is no longer running, abort the wait loop
            +      break
            +    fi
            

            mainly to avoid using new tools and constructs in the script. Because pgrep -P and if ! are not used in mysql.server yet, but kill -0 is already there, so I didn't add any new potential compatibility issues by reusing it.

            Show
            serg Sergei Golubchik added a comment - - edited Thanks for the idea. I've applied a slightly different patch: + if kill -0 $! 2>/dev/null ; then + : # mysqld_safe is still running + else + # mysqld_safe is no longer running, abort the wait loop + break + fi mainly to avoid using new tools and constructs in the script. Because pgrep -P and if ! are not used in mysql.server yet, but kill -0 is already there, so I didn't add any new potential compatibility issues by reusing it.

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                Matt74 Seunguck Lee
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h