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

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

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 10.0.12
    • 5.5.39, 10.0.13
    • None
    • None
    • 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.

      Attachments

        Issue Links

          Activity

            Hi,

            Are you willing to propose a patch for this?

            elenst Elena Stepanova added a comment - Hi, Are you willing to propose a patch for this?
            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.

            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.

            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

            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
            Matt74 Seunguck Lee added a comment -

            Hi Elena.

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

            Thanks.

            Matt74 Seunguck Lee added a comment - Hi Elena. Then I think checking both of mysqldadmin ping and mysqld_safe process will be working. Thanks.
            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.

            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

              serg Sergei Golubchik
              Matt74 Seunguck Lee
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.